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 | 2102f7c | 2015-07-09 10:00:53 | [diff] [blame] | 10 | #include "components/omnibox/browser/autocomplete_provider_client.h" |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 11 | |
| 12 | class Profile; |
| 13 | |
Justin Donnelly | a7a6fec85 | 2017-08-01 14:59:22 | [diff] [blame] | 14 | namespace content { |
| 15 | class StoragePartition; |
| 16 | } |
| 17 | |
Mark Pearson | cb618ec | 2018-07-28 16:13:42 | [diff] [blame] | 18 | namespace unified_consent { |
| 19 | class UrlKeyedDataCollectionConsentHelper; |
| 20 | } |
| 21 | |
Ryo Hashimoto | 884ad19 | 2014-08-28 05:54:30 | [diff] [blame] | 22 | class ChromeAutocompleteProviderClient : public AutocompleteProviderClient { |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 23 | public: |
Ryo Hashimoto | 884ad19 | 2014-08-28 05:54:30 | [diff] [blame] | 24 | explicit ChromeAutocompleteProviderClient(Profile* profile); |
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 25 | ~ChromeAutocompleteProviderClient() override; |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 26 | |
Ryo Hashimoto | 884ad19 | 2014-08-28 05:54:30 | [diff] [blame] | 27 | // AutocompleteProviderClient: |
Maks Orlovich | 1b20851 | 2018-06-13 21:08:17 | [diff] [blame] | 28 | scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory() override; |
blundell | d130d59 | 2015-06-21 19:29:13 | [diff] [blame] | 29 | PrefService* GetPrefs() override; |
| 30 | const AutocompleteSchemeClassifier& GetSchemeClassifier() const override; |
| 31 | AutocompleteClassifier* GetAutocompleteClassifier() override; |
paulmeyer | b582426 | 2015-06-17 18:08:44 | [diff] [blame] | 32 | history::HistoryService* GetHistoryService() override; |
blundell | d130d59 | 2015-06-21 19:29:13 | [diff] [blame] | 33 | scoped_refptr<history::TopSites> GetTopSites() override; |
paulmeyer | b582426 | 2015-06-17 18:08:44 | [diff] [blame] | 34 | bookmarks::BookmarkModel* GetBookmarkModel() override; |
| 35 | history::URLDatabase* GetInMemoryDatabase() override; |
blundell | b11c2787e | 2015-06-22 10:05:10 | [diff] [blame] | 36 | InMemoryURLIndex* GetInMemoryURLIndex() override; |
blundell | 0c5bb253 | 2015-06-16 14:23:14 | [diff] [blame] | 37 | TemplateURLService* GetTemplateURLService() override; |
blundell | d130d59 | 2015-06-21 19:29:13 | [diff] [blame] | 38 | const TemplateURLService* GetTemplateURLService() const override; |
Tommy C. Li | 06ec26a | 2019-06-10 18:01:42 | [diff] [blame^] | 39 | RemoteSuggestionsService* GetRemoteSuggestionsService( |
Gheorghe Comanici | 86bbdf6 | 2017-08-28 17:20:33 | [diff] [blame] | 40 | bool create_if_necessary) const override; |
Travis Skare | 13393cb | 2018-07-19 02:47:56 | [diff] [blame] | 41 | DocumentSuggestionsService* GetDocumentSuggestionsService( |
| 42 | bool create_if_necessary) const override; |
Orin Jaworski | 76893bb | 2018-10-08 18:12:54 | [diff] [blame] | 43 | OmniboxPedalProvider* GetPedalProvider() const override; |
blundell | fb1215ee | 2015-06-19 20:18:12 | [diff] [blame] | 44 | scoped_refptr<ShortcutsBackend> GetShortcutsBackend() override; |
| 45 | scoped_refptr<ShortcutsBackend> GetShortcutsBackendIfExists() override; |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 46 | std::unique_ptr<KeywordExtensionsDelegate> GetKeywordExtensionsDelegate( |
blundell | b11c2787e | 2015-06-22 10:05:10 | [diff] [blame] | 47 | KeywordProvider* keyword_provider) override; |
blundell | d130d59 | 2015-06-21 19:29:13 | [diff] [blame] | 48 | std::string GetAcceptLanguages() const override; |
Mark Pearson | 3fb0e316 | 2018-08-27 21:53:57 | [diff] [blame] | 49 | std::string GetEmbedderRepresentationOfAboutScheme() const override; |
blundell | ff1502c | 2015-06-22 11:34:37 | [diff] [blame] | 50 | std::vector<base::string16> GetBuiltinURLs() override; |
| 51 | std::vector<base::string16> GetBuiltinsToProvideAsUserTypes() override; |
Gheorghe Comanici | 034cff6 | 2018-01-27 03:34:00 | [diff] [blame] | 52 | // GetCurrentVisitTimestamp is only implemented for desktop users. For mobile |
| 53 | // users, the function returns base::Time(). |
| 54 | base::Time GetCurrentVisitTimestamp() const override; |
blundell | d130d59 | 2015-06-21 19:29:13 | [diff] [blame] | 55 | bool IsOffTheRecord() const override; |
| 56 | bool SearchSuggestEnabled() const override; |
Mark Pearson | cb618ec | 2018-07-28 16:13:42 | [diff] [blame] | 57 | bool IsPersonalizedUrlDataCollectionActive() const override; |
Gheorghe Comanici | 68250410 | 2017-11-30 17:47:25 | [diff] [blame] | 58 | bool IsAuthenticated() const override; |
Travis Skare | 6e7d8014 | 2018-09-11 23:51:05 | [diff] [blame] | 59 | bool IsSyncActive() const override; |
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 60 | void Classify( |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 61 | const base::string16& text, |
| 62 | bool prefer_keyword, |
| 63 | bool allow_exact_keyword_match, |
| 64 | metrics::OmniboxEventProto::PageClassification page_classification, |
| 65 | AutocompleteMatch* match, |
mostynb | 01d8b10e | 2014-10-13 09:44:44 | [diff] [blame] | 66 | GURL* alternate_nav_url) override; |
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 67 | void DeleteMatchingURLsForKeywordFromHistory( |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 68 | history::KeywordID keyword_id, |
mostynb | 01d8b10e | 2014-10-13 09:44:44 | [diff] [blame] | 69 | const base::string16& term) override; |
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 70 | void PrefetchImage(const GURL& url) override; |
Justin Donnelly | 4e448cb | 2017-07-07 21:32:13 | [diff] [blame] | 71 | void StartServiceWorker(const GURL& destination_url) override; |
blundell | 62bf65f | 2015-06-19 08:30:46 | [diff] [blame] | 72 | void OnAutocompleteControllerResultReady( |
| 73 | AutocompleteController* controller) override; |
Kevin Bailey | 55841fa7 | 2018-03-12 22:52:05 | [diff] [blame] | 74 | bool IsTabOpenWithURL(const GURL& url, |
| 75 | const AutocompleteInput* input) override; |
Orin Jaworski | abf577a | 2018-11-09 02:23:24 | [diff] [blame] | 76 | bool IsBrowserUpdateAvailable() const override; |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 77 | |
Justin Donnelly | a7a6fec85 | 2017-08-01 14:59:22 | [diff] [blame] | 78 | // For testing. |
| 79 | void set_storage_partition(content::StoragePartition* storage_partition) { |
| 80 | storage_partition_ = storage_partition; |
| 81 | } |
| 82 | |
Kevin Bailey | 55841fa7 | 2018-03-12 22:52:05 | [diff] [blame] | 83 | bool StrippedURLsAreEqual(const GURL& url1, |
| 84 | const GURL& url2, |
Kevin Bailey | 499298a | 2018-03-16 14:54:43 | [diff] [blame] | 85 | const AutocompleteInput* input) const; |
Kevin Bailey | 55841fa7 | 2018-03-12 22:52:05 | [diff] [blame] | 86 | |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 87 | private: |
| 88 | Profile* profile_; |
| 89 | ChromeAutocompleteSchemeClassifier scheme_classifier_; |
Orin Jaworski | 76893bb | 2018-10-08 18:12:54 | [diff] [blame] | 90 | std::unique_ptr<OmniboxPedalProvider> pedal_provider_; |
Mark Pearson | cb618ec | 2018-07-28 16:13:42 | [diff] [blame] | 91 | std::unique_ptr<unified_consent::UrlKeyedDataCollectionConsentHelper> |
| 92 | url_consent_helper_; |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 93 | |
Justin Donnelly | a7a6fec85 | 2017-08-01 14:59:22 | [diff] [blame] | 94 | // Injectable storage partitiion, used for testing. |
| 95 | content::StoragePartition* storage_partition_; |
| 96 | |
Ryo Hashimoto | 884ad19 | 2014-08-28 05:54:30 | [diff] [blame] | 97 | DISALLOW_COPY_AND_ASSIGN(ChromeAutocompleteProviderClient); |
hashimoto | 663b9f4 | 2014-08-26 04:29:20 | [diff] [blame] | 98 | }; |
| 99 | |
Ryo Hashimoto | 884ad19 | 2014-08-28 05:54:30 | [diff] [blame] | 100 | #endif // CHROME_BROWSER_AUTOCOMPLETE_CHROME_AUTOCOMPLETE_PROVIDER_CLIENT_H_ |