hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 1 | // 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 Hashimoto | 884ad19 | 2014-08-28 05:54:30 | [diff] [blame] | 5 | #ifndef CHROME_BROWSER_AUTOCOMPLETE_CHROME_AUTOCOMPLETE_PROVIDER_CLIENT_H_ |
| 6 | #define CHROME_BROWSER_AUTOCOMPLETE_CHROME_AUTOCOMPLETE_PROVIDER_CLIENT_H_ |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 7 | |
avi | e4d7b6f | 2015-12-26 00:59:18 | [diff] [blame] | 8 | #include "base/macros.h" |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 9 | #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |
blundell | 0c5bb253 | 2015-06-16 14:23:14 | [diff] [blame] | 10 | #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
blundell | 2102f7c | 2015-07-09 10:00:53 | [diff] [blame] | 11 | #include "components/omnibox/browser/autocomplete_provider_client.h" |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 12 | |
| 13 | class Profile; |
| 14 | |
Justin Donnelly | a7a6fec85 | 2017-08-01 14:59:22 | [diff] [blame] | 15 | namespace content { |
| 16 | class StoragePartition; |
| 17 | } |
| 18 | |
Ryo Hashimoto | 884ad19 | 2014-08-28 05:54:30 | [diff] [blame] | 19 | class ChromeAutocompleteProviderClient : public AutocompleteProviderClient { |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 20 | public: |
Ryo Hashimoto | 884ad19 | 2014-08-28 05:54:30 | [diff] [blame] | 21 | explicit ChromeAutocompleteProviderClient(Profile* profile); |
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 22 | ~ChromeAutocompleteProviderClient() override; |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 23 | |
Ryo Hashimoto | 884ad19 | 2014-08-28 05:54:30 | [diff] [blame] | 24 | // AutocompleteProviderClient: |
paulmeyer | b582426 | 2015-06-17 18:08:44 | [diff] [blame] | 25 | net::URLRequestContextGetter* GetRequestContext() override; |
blundell | d130d59 | 2015-06-21 19:29:13 | [diff] [blame] | 26 | PrefService* GetPrefs() override; |
| 27 | const AutocompleteSchemeClassifier& GetSchemeClassifier() const override; |
| 28 | AutocompleteClassifier* GetAutocompleteClassifier() override; |
paulmeyer | b582426 | 2015-06-17 18:08:44 | [diff] [blame] | 29 | history::HistoryService* GetHistoryService() override; |
blundell | d130d59 | 2015-06-21 19:29:13 | [diff] [blame] | 30 | scoped_refptr<history::TopSites> GetTopSites() override; |
paulmeyer | b582426 | 2015-06-17 18:08:44 | [diff] [blame] | 31 | bookmarks::BookmarkModel* GetBookmarkModel() override; |
| 32 | history::URLDatabase* GetInMemoryDatabase() override; |
blundell | b11c2787e | 2015-06-22 10:05:10 | [diff] [blame] | 33 | InMemoryURLIndex* GetInMemoryURLIndex() override; |
blundell | 0c5bb253 | 2015-06-16 14:23:14 | [diff] [blame] | 34 | TemplateURLService* GetTemplateURLService() override; |
blundell | d130d59 | 2015-06-21 19:29:13 | [diff] [blame] | 35 | const TemplateURLService* GetTemplateURLService() const override; |
Gheorghe Comanici | 86bbdf6 | 2017-08-28 17:20:33 | [diff] [blame] | 36 | ContextualSuggestionsService* GetContextualSuggestionsService( |
| 37 | bool create_if_necessary) const override; |
blundell | d130d59 | 2015-06-21 19:29:13 | [diff] [blame] | 38 | const SearchTermsData& GetSearchTermsData() const override; |
blundell | fb1215ee | 2015-06-19 20:18:12 | [diff] [blame] | 39 | scoped_refptr<ShortcutsBackend> GetShortcutsBackend() override; |
| 40 | scoped_refptr<ShortcutsBackend> GetShortcutsBackendIfExists() override; |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 41 | std::unique_ptr<KeywordExtensionsDelegate> GetKeywordExtensionsDelegate( |
blundell | b11c2787e | 2015-06-22 10:05:10 | [diff] [blame] | 42 | KeywordProvider* keyword_provider) override; |
vitaliii | ee92054 | 2016-11-25 15:20:23 | [diff] [blame] | 43 | physical_web::PhysicalWebDataSource* GetPhysicalWebDataSource() override; |
blundell | d130d59 | 2015-06-21 19:29:13 | [diff] [blame] | 44 | std::string GetAcceptLanguages() const override; |
blundell | ff1502c | 2015-06-22 11:34:37 | [diff] [blame] | 45 | std::string GetEmbedderRepresentationOfAboutScheme() override; |
| 46 | std::vector<base::string16> GetBuiltinURLs() override; |
| 47 | std::vector<base::string16> GetBuiltinsToProvideAsUserTypes() override; |
Gheorghe Comanici | 034cff6 | 2018-01-27 03:34:00 | [diff] [blame] | 48 | // GetCurrentVisitTimestamp is only implemented for desktop users. For mobile |
| 49 | // users, the function returns base::Time(). |
| 50 | base::Time GetCurrentVisitTimestamp() const override; |
blundell | d130d59 | 2015-06-21 19:29:13 | [diff] [blame] | 51 | bool IsOffTheRecord() const override; |
| 52 | bool SearchSuggestEnabled() const override; |
blundell | d130d59 | 2015-06-21 19:29:13 | [diff] [blame] | 53 | bool TabSyncEnabledAndUnencrypted() const override; |
Gheorghe Comanici | 68250410 | 2017-11-30 17:47:25 | [diff] [blame] | 54 | bool IsAuthenticated() const override; |
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 55 | void Classify( |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 56 | const base::string16& text, |
| 57 | bool prefer_keyword, |
| 58 | bool allow_exact_keyword_match, |
| 59 | metrics::OmniboxEventProto::PageClassification page_classification, |
| 60 | AutocompleteMatch* match, |
mostynb | 01d8b10e | 2014-10-13 09:44:44 | [diff] [blame] | 61 | GURL* alternate_nav_url) override; |
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 62 | void DeleteMatchingURLsForKeywordFromHistory( |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 63 | history::KeywordID keyword_id, |
mostynb | 01d8b10e | 2014-10-13 09:44:44 | [diff] [blame] | 64 | const base::string16& term) override; |
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 65 | void PrefetchImage(const GURL& url) override; |
Justin Donnelly | 4e448cb | 2017-07-07 21:32:13 | [diff] [blame] | 66 | void StartServiceWorker(const GURL& destination_url) override; |
blundell | 62bf65f | 2015-06-19 08:30:46 | [diff] [blame] | 67 | void OnAutocompleteControllerResultReady( |
| 68 | AutocompleteController* controller) override; |
Kevin Bailey | 89866997 | 2017-11-06 15:34:49 | [diff] [blame] | 69 | bool IsTabOpenWithURL(const GURL& url) override; |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 70 | |
Justin Donnelly | a7a6fec85 | 2017-08-01 14:59:22 | [diff] [blame] | 71 | // For testing. |
| 72 | void set_storage_partition(content::StoragePartition* storage_partition) { |
| 73 | storage_partition_ = storage_partition; |
| 74 | } |
| 75 | |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 76 | private: |
| 77 | Profile* profile_; |
| 78 | ChromeAutocompleteSchemeClassifier scheme_classifier_; |
blundell | 0c5bb253 | 2015-06-16 14:23:14 | [diff] [blame] | 79 | UIThreadSearchTermsData search_terms_data_; |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 80 | |
Justin Donnelly | a7a6fec85 | 2017-08-01 14:59:22 | [diff] [blame] | 81 | // Injectable storage partitiion, used for testing. |
| 82 | content::StoragePartition* storage_partition_; |
| 83 | |
Ryo Hashimoto | 884ad19 | 2014-08-28 05:54:30 | [diff] [blame] | 84 | DISALLOW_COPY_AND_ASSIGN(ChromeAutocompleteProviderClient); |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 85 | }; |
| 86 | |
Ryo Hashimoto | 884ad19 | 2014-08-28 05:54:30 | [diff] [blame] | 87 | #endif // CHROME_BROWSER_AUTOCOMPLETE_CHROME_AUTOCOMPLETE_PROVIDER_CLIENT_H_ |