blob: 1766fbe92c263a37f97aa479d03d7899e364dcf2 [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;
Gheorghe Comanici034cff62018-01-27 03:34:0048 // GetCurrentVisitTimestamp is only implemented for desktop users. For mobile
49 // users, the function returns base::Time().
50 base::Time GetCurrentVisitTimestamp() const override;
blundelld130d592015-06-21 19:29:1351 bool IsOffTheRecord() const override;
52 bool SearchSuggestEnabled() const override;
blundelld130d592015-06-21 19:29:1353 bool TabSyncEnabledAndUnencrypted() const override;
Gheorghe Comanici682504102017-11-30 17:47:2554 bool IsAuthenticated() const override;
Daniel Chenga542fca2014-10-21 09:51:2955 void Classify(
hashimoto663b9f42014-08-26 04:29:2056 const base::string16& text,
57 bool prefer_keyword,
58 bool allow_exact_keyword_match,
59 metrics::OmniboxEventProto::PageClassification page_classification,
60 AutocompleteMatch* match,
mostynb01d8b10e2014-10-13 09:44:4461 GURL* alternate_nav_url) override;
Daniel Chenga542fca2014-10-21 09:51:2962 void DeleteMatchingURLsForKeywordFromHistory(
hashimoto663b9f42014-08-26 04:29:2063 history::KeywordID keyword_id,
mostynb01d8b10e2014-10-13 09:44:4464 const base::string16& term) override;
Daniel Chenga542fca2014-10-21 09:51:2965 void PrefetchImage(const GURL& url) override;
Justin Donnelly4e448cb2017-07-07 21:32:1366 void StartServiceWorker(const GURL& destination_url) override;
blundell62bf65f2015-06-19 08:30:4667 void OnAutocompleteControllerResultReady(
68 AutocompleteController* controller) override;
Kevin Bailey898669972017-11-06 15:34:4969 bool IsTabOpenWithURL(const GURL& url) override;
hashimoto663b9f42014-08-26 04:29:2070
Justin Donnellya7a6fec852017-08-01 14:59:2271 // For testing.
72 void set_storage_partition(content::StoragePartition* storage_partition) {
73 storage_partition_ = storage_partition;
74 }
75
hashimoto663b9f42014-08-26 04:29:2076 private:
77 Profile* profile_;
78 ChromeAutocompleteSchemeClassifier scheme_classifier_;
blundell0c5bb2532015-06-16 14:23:1479 UIThreadSearchTermsData search_terms_data_;
hashimoto663b9f42014-08-26 04:29:2080
Justin Donnellya7a6fec852017-08-01 14:59:2281 // Injectable storage partitiion, used for testing.
82 content::StoragePartition* storage_partition_;
83
Ryo Hashimoto884ad192014-08-28 05:54:3084 DISALLOW_COPY_AND_ASSIGN(ChromeAutocompleteProviderClient);
hashimoto663b9f42014-08-26 04:29:2085};
86
Ryo Hashimoto884ad192014-08-28 05:54:3087#endif // CHROME_BROWSER_AUTOCOMPLETE_CHROME_AUTOCOMPLETE_PROVIDER_CLIENT_H_