Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_CHROME_TEMPLATE_URL_SERVICE_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_CHROME_TEMPLATE_URL_SERVICE_CLIENT_H_ |
| 6 #define CHROME_BROWSER_SEARCH_ENGINES_CHROME_TEMPLATE_URL_SERVICE_CLIENT_H_ | 6 #define CHROME_BROWSER_SEARCH_ENGINES_CHROME_TEMPLATE_URL_SERVICE_CLIENT_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/scoped_observer.h" | 9 #include "base/scoped_observer.h" |
| 10 #include "components/history/core/browser/history_service_observer.h" | 10 #include "components/history/core/browser/history_service_observer.h" |
| 11 #include "components/search_engines/template_url_service_client.h" | 11 #include "components/search_engines/template_url_service_client.h" |
| 12 | 12 |
| 13 namespace base { | |
| 14 class Value; | |
| 15 } | |
| 16 | |
| 17 namespace extensions { | |
| 18 class PreferenceAPI; | |
| 19 } | |
| 20 | |
| 13 namespace history { | 21 namespace history { |
| 14 class HistoryService; | 22 class HistoryService; |
| 15 } | 23 } |
| 16 | 24 |
| 17 // ChromeTemplateURLServiceClient provides keyword related history | 25 // ChromeTemplateURLServiceClient provides keyword related history |
| 18 // functionality for TemplateURLService. | 26 // functionality for TemplateURLService. |
| 19 class ChromeTemplateURLServiceClient : public TemplateURLServiceClient, | 27 class ChromeTemplateURLServiceClient : public TemplateURLServiceClient, |
| 20 public history::HistoryServiceObserver { | 28 public history::HistoryServiceObserver { |
| 21 public: | 29 public: |
| 22 explicit ChromeTemplateURLServiceClient( | 30 explicit ChromeTemplateURLServiceClient( |
|
vasilii
2016/11/07 15:00:05
no explicit.
| |
| 23 history::HistoryService* history_service); | 31 history::HistoryService* history_service, |
| 32 extensions::PreferenceAPI* pref_api); | |
| 24 ~ChromeTemplateURLServiceClient() override; | 33 ~ChromeTemplateURLServiceClient() override; |
| 25 | 34 |
| 26 // TemplateURLServiceClient: | 35 // TemplateURLServiceClient: |
| 27 void Shutdown() override; | 36 void Shutdown() override; |
| 28 void SetOwner(TemplateURLService* owner) override; | 37 void SetOwner(TemplateURLService* owner) override; |
| 29 void DeleteAllSearchTermsForKeyword(history::KeywordID keyword_Id) override; | 38 void DeleteAllSearchTermsForKeyword(history::KeywordID keyword_Id) override; |
| 30 void SetKeywordSearchTermsForURL(const GURL& url, | 39 void SetKeywordSearchTermsForURL(const GURL& url, |
| 31 TemplateURLID id, | 40 TemplateURLID id, |
| 32 const base::string16& term) override; | 41 const base::string16& term) override; |
| 33 void AddKeywordGeneratedVisit(const GURL& url) override; | 42 void AddKeywordGeneratedVisit(const GURL& url) override; |
| 34 bool IsOmniboxExtensionURL(const std::string& url) override; | 43 bool IsOmniboxExtensionURL(const std::string& url) override; |
| 35 | 44 |
| 36 // history::HistoryServiceObserver: | 45 // history::HistoryServiceObserver: |
| 37 void OnURLVisited(history::HistoryService* history_service, | 46 void OnURLVisited(history::HistoryService* history_service, |
| 38 ui::PageTransition transition, | 47 ui::PageTransition transition, |
| 39 const history::URLRow& row, | 48 const history::URLRow& row, |
| 40 const history::RedirectList& redirects, | 49 const history::RedirectList& redirects, |
| 41 base::Time visit_time) override; | 50 base::Time visit_time) override; |
| 42 | 51 |
| 52 void SetExtensionControlledPref( | |
| 53 const std::string extension_id, const std::string pref_name, | |
|
vasilii
2016/11/07 15:00:05
const std::string&
| |
| 54 std::unique_ptr<base::Value> pref_value) override; | |
| 55 | |
| 43 private: | 56 private: |
| 44 TemplateURLService* owner_; | 57 TemplateURLService* owner_; |
| 45 ScopedObserver<history::HistoryService, history::HistoryServiceObserver> | 58 ScopedObserver<history::HistoryService, history::HistoryServiceObserver> |
| 46 history_service_observer_; | 59 history_service_observer_; |
| 47 history::HistoryService* history_service_; | 60 history::HistoryService* history_service_; |
| 61 extensions::PreferenceAPI* pref_api_; | |
| 48 | 62 |
| 49 DISALLOW_COPY_AND_ASSIGN(ChromeTemplateURLServiceClient); | 63 DISALLOW_COPY_AND_ASSIGN(ChromeTemplateURLServiceClient); |
| 50 }; | 64 }; |
| 51 | 65 |
| 52 #endif // CHROME_BROWSER_SEARCH_ENGINES_CHROME_TEMPLATE_URL_SERVICE_CLIENT_H_ | 66 #endif // CHROME_BROWSER_SEARCH_ENGINES_CHROME_TEMPLATE_URL_SERVICE_CLIENT_H_ |
| OLD | NEW |