blob: 1e873be8b78dad9644f8a2e9a01b8f8bafa8a358 [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:
Maks Orlovich1b208512018-06-13 21:08:1725 scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory() 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;
Travis Skare13393cb2018-07-19 02:47:5638 DocumentSuggestionsService* GetDocumentSuggestionsService(
39 bool create_if_necessary) const override;
blundelld130d592015-06-21 19:29:1340 const SearchTermsData& GetSearchTermsData() const override;
blundellfb1215ee2015-06-19 20:18:1241 scoped_refptr<ShortcutsBackend> GetShortcutsBackend() override;
42 scoped_refptr<ShortcutsBackend> GetShortcutsBackendIfExists() override;
dcheng4af48582016-04-19 00:29:3543 std::unique_ptr<KeywordExtensionsDelegate> GetKeywordExtensionsDelegate(
blundellb11c2787e2015-06-22 10:05:1044 KeywordProvider* keyword_provider) override;
blundelld130d592015-06-21 19:29:1345 std::string GetAcceptLanguages() const override;
blundellff1502c2015-06-22 11:34:3746 std::string GetEmbedderRepresentationOfAboutScheme() override;
47 std::vector<base::string16> GetBuiltinURLs() override;
48 std::vector<base::string16> GetBuiltinsToProvideAsUserTypes() override;
Gheorghe Comanici034cff62018-01-27 03:34:0049 // GetCurrentVisitTimestamp is only implemented for desktop users. For mobile
50 // users, the function returns base::Time().
51 base::Time GetCurrentVisitTimestamp() const override;
blundelld130d592015-06-21 19:29:1352 bool IsOffTheRecord() const override;
53 bool SearchSuggestEnabled() const override;
Justin Donnelly904e7cb2018-04-10 14:56:0554 bool IsTabUploadToGoogleActive() const override;
Gheorghe Comanici682504102017-11-30 17:47:2555 bool IsAuthenticated() const override;
Daniel Chenga542fca2014-10-21 09:51:2956 void Classify(
hashimoto663b9f42014-08-26 04:29:2057 const base::string16& text,
58 bool prefer_keyword,
59 bool allow_exact_keyword_match,
60 metrics::OmniboxEventProto::PageClassification page_classification,
61 AutocompleteMatch* match,
mostynb01d8b10e2014-10-13 09:44:4462 GURL* alternate_nav_url) override;
Daniel Chenga542fca2014-10-21 09:51:2963 void DeleteMatchingURLsForKeywordFromHistory(
hashimoto663b9f42014-08-26 04:29:2064 history::KeywordID keyword_id,
mostynb01d8b10e2014-10-13 09:44:4465 const base::string16& term) override;
Daniel Chenga542fca2014-10-21 09:51:2966 void PrefetchImage(const GURL& url) override;
Justin Donnelly4e448cb2017-07-07 21:32:1367 void StartServiceWorker(const GURL& destination_url) override;
blundell62bf65f2015-06-19 08:30:4668 void OnAutocompleteControllerResultReady(
69 AutocompleteController* controller) override;
Kevin Bailey55841fa72018-03-12 22:52:0570 bool IsTabOpenWithURL(const GURL& url,
71 const AutocompleteInput* input) override;
hashimoto663b9f42014-08-26 04:29:2072
Justin Donnellya7a6fec852017-08-01 14:59:2273 // For testing.
74 void set_storage_partition(content::StoragePartition* storage_partition) {
75 storage_partition_ = storage_partition;
76 }
77
Kevin Bailey55841fa72018-03-12 22:52:0578 bool StrippedURLsAreEqual(const GURL& url1,
79 const GURL& url2,
Kevin Bailey499298a2018-03-16 14:54:4380 const AutocompleteInput* input) const;
Kevin Bailey55841fa72018-03-12 22:52:0581
hashimoto663b9f42014-08-26 04:29:2082 private:
83 Profile* profile_;
84 ChromeAutocompleteSchemeClassifier scheme_classifier_;
blundell0c5bb2532015-06-16 14:23:1485 UIThreadSearchTermsData search_terms_data_;
hashimoto663b9f42014-08-26 04:29:2086
Justin Donnellya7a6fec852017-08-01 14:59:2287 // Injectable storage partitiion, used for testing.
88 content::StoragePartition* storage_partition_;
89
Ryo Hashimoto884ad192014-08-28 05:54:3090 DISALLOW_COPY_AND_ASSIGN(ChromeAutocompleteProviderClient);
hashimoto663b9f42014-08-26 04:29:2091};
92
Ryo Hashimoto884ad192014-08-28 05:54:3093#endif // CHROME_BROWSER_AUTOCOMPLETE_CHROME_AUTOCOMPLETE_PROVIDER_CLIENT_H_