blob: 0a357ff3f2962d8afcbfc27e429f5baecbe24e8f [file] [log] [blame]
hashimoto663b9f42014-08-26 04:29:201// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Ryo Hashimoto884ad192014-08-28 05:54:305#ifndef CHROME_BROWSER_AUTOCOMPLETE_CHROME_AUTOCOMPLETE_PROVIDER_CLIENT_H_
6#define CHROME_BROWSER_AUTOCOMPLETE_CHROME_AUTOCOMPLETE_PROVIDER_CLIENT_H_
hashimoto663b9f42014-08-26 04:29:207
avie4d7b6f2015-12-26 00:59:188#include "base/macros.h"
hashimoto663b9f42014-08-26 04:29:209#include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
blundell0c5bb2532015-06-16 14:23:1410#include "chrome/browser/search_engines/ui_thread_search_terms_data.h"
blundell2102f7c2015-07-09 10:00:5311#include "components/omnibox/browser/autocomplete_provider_client.h"
hashimoto663b9f42014-08-26 04:29:2012
13class Profile;
14
Justin Donnellya7a6fec852017-08-01 14:59:2215namespace content {
16class StoragePartition;
17}
18
Ryo Hashimoto884ad192014-08-28 05:54:3019class ChromeAutocompleteProviderClient : public AutocompleteProviderClient {
hashimoto663b9f42014-08-26 04:29:2020 public:
Ryo Hashimoto884ad192014-08-28 05:54:3021 explicit ChromeAutocompleteProviderClient(Profile* profile);
Daniel Chenga542fca2014-10-21 09:51:2922 ~ChromeAutocompleteProviderClient() override;
hashimoto663b9f42014-08-26 04:29:2023
Ryo Hashimoto884ad192014-08-28 05:54:3024 // AutocompleteProviderClient:
paulmeyerb5824262015-06-17 18:08:4425 net::URLRequestContextGetter* GetRequestContext() override;
blundelld130d592015-06-21 19:29:1326 PrefService* GetPrefs() override;
27 const AutocompleteSchemeClassifier& GetSchemeClassifier() const override;
28 AutocompleteClassifier* GetAutocompleteClassifier() override;
paulmeyerb5824262015-06-17 18:08:4429 history::HistoryService* GetHistoryService() override;
blundelld130d592015-06-21 19:29:1330 scoped_refptr<history::TopSites> GetTopSites() override;
paulmeyerb5824262015-06-17 18:08:4431 bookmarks::BookmarkModel* GetBookmarkModel() override;
32 history::URLDatabase* GetInMemoryDatabase() override;
blundellb11c2787e2015-06-22 10:05:1033 InMemoryURLIndex* GetInMemoryURLIndex() override;
blundell0c5bb2532015-06-16 14:23:1434 TemplateURLService* GetTemplateURLService() override;
blundelld130d592015-06-21 19:29:1335 const TemplateURLService* GetTemplateURLService() const override;
Gheorghe Comanici86bbdf62017-08-28 17:20:3336 ContextualSuggestionsService* GetContextualSuggestionsService(
37 bool create_if_necessary) const override;
blundelld130d592015-06-21 19:29:1338 const SearchTermsData& GetSearchTermsData() const override;
blundellfb1215ee2015-06-19 20:18:1239 scoped_refptr<ShortcutsBackend> GetShortcutsBackend() override;
40 scoped_refptr<ShortcutsBackend> GetShortcutsBackendIfExists() override;
dcheng4af48582016-04-19 00:29:3541 std::unique_ptr<KeywordExtensionsDelegate> GetKeywordExtensionsDelegate(
blundellb11c2787e2015-06-22 10:05:1042 KeywordProvider* keyword_provider) override;
vitaliiiee920542016-11-25 15:20:2343 physical_web::PhysicalWebDataSource* GetPhysicalWebDataSource() override;
blundelld130d592015-06-21 19:29:1344 std::string GetAcceptLanguages() const override;
blundellff1502c2015-06-22 11:34:3745 std::string GetEmbedderRepresentationOfAboutScheme() override;
46 std::vector<base::string16> GetBuiltinURLs() override;
47 std::vector<base::string16> GetBuiltinsToProvideAsUserTypes() override;
blundelld130d592015-06-21 19:29:1348 bool IsOffTheRecord() const override;
49 bool SearchSuggestEnabled() const override;
blundelld130d592015-06-21 19:29:1350 bool TabSyncEnabledAndUnencrypted() const override;
Gheorghe Comanici682504102017-11-30 17:47:2551 bool IsAuthenticated() const override;
Daniel Chenga542fca2014-10-21 09:51:2952 void Classify(
hashimoto663b9f42014-08-26 04:29:2053 const base::string16& text,
54 bool prefer_keyword,
55 bool allow_exact_keyword_match,
56 metrics::OmniboxEventProto::PageClassification page_classification,
57 AutocompleteMatch* match,
mostynb01d8b10e2014-10-13 09:44:4458 GURL* alternate_nav_url) override;
Daniel Chenga542fca2014-10-21 09:51:2959 void DeleteMatchingURLsForKeywordFromHistory(
hashimoto663b9f42014-08-26 04:29:2060 history::KeywordID keyword_id,
mostynb01d8b10e2014-10-13 09:44:4461 const base::string16& term) override;
Daniel Chenga542fca2014-10-21 09:51:2962 void PrefetchImage(const GURL& url) override;
Justin Donnelly4e448cb2017-07-07 21:32:1363 void StartServiceWorker(const GURL& destination_url) override;
blundell62bf65f2015-06-19 08:30:4664 void OnAutocompleteControllerResultReady(
65 AutocompleteController* controller) override;
Kevin Bailey898669972017-11-06 15:34:4966 bool IsTabOpenWithURL(const GURL& url) override;
hashimoto663b9f42014-08-26 04:29:2067
Justin Donnellya7a6fec852017-08-01 14:59:2268 // For testing.
69 void set_storage_partition(content::StoragePartition* storage_partition) {
70 storage_partition_ = storage_partition;
71 }
72
hashimoto663b9f42014-08-26 04:29:2073 private:
74 Profile* profile_;
75 ChromeAutocompleteSchemeClassifier scheme_classifier_;
blundell0c5bb2532015-06-16 14:23:1476 UIThreadSearchTermsData search_terms_data_;
hashimoto663b9f42014-08-26 04:29:2077
Justin Donnellya7a6fec852017-08-01 14:59:2278 // Injectable storage partitiion, used for testing.
79 content::StoragePartition* storage_partition_;
80
Ryo Hashimoto884ad192014-08-28 05:54:3081 DISALLOW_COPY_AND_ASSIGN(ChromeAutocompleteProviderClient);
hashimoto663b9f42014-08-26 04:29:2082};
83
Ryo Hashimoto884ad192014-08-28 05:54:3084#endif // CHROME_BROWSER_AUTOCOMPLETE_CHROME_AUTOCOMPLETE_PROVIDER_CLIENT_H_