blob: 2aee5675cb371c9f058436f6b4938f0d7a2d86cc [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"
blundell2102f7c2015-07-09 10:00:5310#include "components/omnibox/browser/autocomplete_provider_client.h"
hashimoto663b9f42014-08-26 04:29:2011
12class Profile;
13
Justin Donnellya7a6fec852017-08-01 14:59:2214namespace content {
15class StoragePartition;
16}
17
Mark Pearsoncb618ec2018-07-28 16:13:4218namespace unified_consent {
19class UrlKeyedDataCollectionConsentHelper;
20}
21
Ryo Hashimoto884ad192014-08-28 05:54:3022class ChromeAutocompleteProviderClient : public AutocompleteProviderClient {
hashimoto663b9f42014-08-26 04:29:2023 public:
Ryo Hashimoto884ad192014-08-28 05:54:3024 explicit ChromeAutocompleteProviderClient(Profile* profile);
Daniel Chenga542fca2014-10-21 09:51:2925 ~ChromeAutocompleteProviderClient() override;
hashimoto663b9f42014-08-26 04:29:2026
Ryo Hashimoto884ad192014-08-28 05:54:3027 // AutocompleteProviderClient:
Maks Orlovich1b208512018-06-13 21:08:1728 scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory() override;
blundelld130d592015-06-21 19:29:1329 PrefService* GetPrefs() override;
30 const AutocompleteSchemeClassifier& GetSchemeClassifier() const override;
31 AutocompleteClassifier* GetAutocompleteClassifier() override;
paulmeyerb5824262015-06-17 18:08:4432 history::HistoryService* GetHistoryService() override;
blundelld130d592015-06-21 19:29:1333 scoped_refptr<history::TopSites> GetTopSites() override;
paulmeyerb5824262015-06-17 18:08:4434 bookmarks::BookmarkModel* GetBookmarkModel() override;
35 history::URLDatabase* GetInMemoryDatabase() override;
blundellb11c2787e2015-06-22 10:05:1036 InMemoryURLIndex* GetInMemoryURLIndex() override;
blundell0c5bb2532015-06-16 14:23:1437 TemplateURLService* GetTemplateURLService() override;
blundelld130d592015-06-21 19:29:1338 const TemplateURLService* GetTemplateURLService() const override;
Tommy C. Li06ec26a2019-06-10 18:01:4239 RemoteSuggestionsService* GetRemoteSuggestionsService(
Gheorghe Comanici86bbdf62017-08-28 17:20:3340 bool create_if_necessary) const override;
Travis Skare13393cb2018-07-19 02:47:5641 DocumentSuggestionsService* GetDocumentSuggestionsService(
42 bool create_if_necessary) const override;
Orin Jaworski76893bb2018-10-08 18:12:5443 OmniboxPedalProvider* GetPedalProvider() const override;
blundellfb1215ee2015-06-19 20:18:1244 scoped_refptr<ShortcutsBackend> GetShortcutsBackend() override;
45 scoped_refptr<ShortcutsBackend> GetShortcutsBackendIfExists() override;
dcheng4af48582016-04-19 00:29:3546 std::unique_ptr<KeywordExtensionsDelegate> GetKeywordExtensionsDelegate(
blundellb11c2787e2015-06-22 10:05:1047 KeywordProvider* keyword_provider) override;
blundelld130d592015-06-21 19:29:1348 std::string GetAcceptLanguages() const override;
Mark Pearson3fb0e3162018-08-27 21:53:5749 std::string GetEmbedderRepresentationOfAboutScheme() const override;
blundellff1502c2015-06-22 11:34:3750 std::vector<base::string16> GetBuiltinURLs() override;
51 std::vector<base::string16> GetBuiltinsToProvideAsUserTypes() override;
Gheorghe Comanici034cff62018-01-27 03:34:0052 // GetCurrentVisitTimestamp is only implemented for desktop users. For mobile
53 // users, the function returns base::Time().
54 base::Time GetCurrentVisitTimestamp() const override;
blundelld130d592015-06-21 19:29:1355 bool IsOffTheRecord() const override;
56 bool SearchSuggestEnabled() const override;
Mark Pearsoncb618ec2018-07-28 16:13:4257 bool IsPersonalizedUrlDataCollectionActive() const override;
Gheorghe Comanici682504102017-11-30 17:47:2558 bool IsAuthenticated() const override;
Travis Skare6e7d80142018-09-11 23:51:0559 bool IsSyncActive() const override;
Daniel Chenga542fca2014-10-21 09:51:2960 void Classify(
hashimoto663b9f42014-08-26 04:29:2061 const base::string16& text,
62 bool prefer_keyword,
63 bool allow_exact_keyword_match,
64 metrics::OmniboxEventProto::PageClassification page_classification,
65 AutocompleteMatch* match,
mostynb01d8b10e2014-10-13 09:44:4466 GURL* alternate_nav_url) override;
Daniel Chenga542fca2014-10-21 09:51:2967 void DeleteMatchingURLsForKeywordFromHistory(
hashimoto663b9f42014-08-26 04:29:2068 history::KeywordID keyword_id,
mostynb01d8b10e2014-10-13 09:44:4469 const base::string16& term) override;
Daniel Chenga542fca2014-10-21 09:51:2970 void PrefetchImage(const GURL& url) override;
Justin Donnelly4e448cb2017-07-07 21:32:1371 void StartServiceWorker(const GURL& destination_url) override;
blundell62bf65f2015-06-19 08:30:4672 void OnAutocompleteControllerResultReady(
73 AutocompleteController* controller) override;
Kevin Bailey55841fa72018-03-12 22:52:0574 bool IsTabOpenWithURL(const GURL& url,
75 const AutocompleteInput* input) override;
Orin Jaworskiabf577a2018-11-09 02:23:2476 bool IsBrowserUpdateAvailable() const override;
hashimoto663b9f42014-08-26 04:29:2077
Justin Donnellya7a6fec852017-08-01 14:59:2278 // For testing.
79 void set_storage_partition(content::StoragePartition* storage_partition) {
80 storage_partition_ = storage_partition;
81 }
82
Kevin Bailey55841fa72018-03-12 22:52:0583 bool StrippedURLsAreEqual(const GURL& url1,
84 const GURL& url2,
Kevin Bailey499298a2018-03-16 14:54:4385 const AutocompleteInput* input) const;
Kevin Bailey55841fa72018-03-12 22:52:0586
hashimoto663b9f42014-08-26 04:29:2087 private:
88 Profile* profile_;
89 ChromeAutocompleteSchemeClassifier scheme_classifier_;
Orin Jaworski76893bb2018-10-08 18:12:5490 std::unique_ptr<OmniboxPedalProvider> pedal_provider_;
Mark Pearsoncb618ec2018-07-28 16:13:4291 std::unique_ptr<unified_consent::UrlKeyedDataCollectionConsentHelper>
92 url_consent_helper_;
hashimoto663b9f42014-08-26 04:29:2093
Justin Donnellya7a6fec852017-08-01 14:59:2294 // Injectable storage partitiion, used for testing.
95 content::StoragePartition* storage_partition_;
96
Ryo Hashimoto884ad192014-08-28 05:54:3097 DISALLOW_COPY_AND_ASSIGN(ChromeAutocompleteProviderClient);
hashimoto663b9f42014-08-26 04:29:2098};
99
Ryo Hashimoto884ad192014-08-28 05:54:30100#endif // CHROME_BROWSER_AUTOCOMPLETE_CHROME_AUTOCOMPLETE_PROVIDER_CLIENT_H_