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.
5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_CHROME_TEMPLATE_URL_SERVICE_CLIENT_H_
6 #define CHROME_BROWSER_SEARCH_ENGINES_CHROME_TEMPLATE_URL_SERVICE_CLIENT_H_
8 #include "base/scoped_observer.h"
9 #include "components/history/core/browser/history_service_observer.h"
10 #include "components/search_engines/template_url_service_client.h"
16 // ChromeTemplateURLServiceClient provides keyword related history
17 // functionality for TemplateURLService.
18 class ChromeTemplateURLServiceClient
: public TemplateURLServiceClient
,
19 public history::HistoryServiceObserver
{
21 explicit ChromeTemplateURLServiceClient(
22 history::HistoryService
* history_service
);
23 ~ChromeTemplateURLServiceClient() override
;
25 // TemplateURLServiceClient:
26 void Shutdown() override
;
27 void SetOwner(TemplateURLService
* owner
) override
;
28 void DeleteAllSearchTermsForKeyword(history::KeywordID keyword_Id
) override
;
29 void SetKeywordSearchTermsForURL(const GURL
& url
,
31 const base::string16
& term
) override
;
32 void AddKeywordGeneratedVisit(const GURL
& url
) override
;
33 void RestoreExtensionInfoIfNecessary(TemplateURL
* template_url
) override
;
35 // history::HistoryServiceObserver:
36 void OnURLVisited(history::HistoryService
* history_service
,
37 ui::PageTransition transition
,
38 const history::URLRow
& row
,
39 const history::RedirectList
& redirects
,
40 base::Time visit_time
) override
;
43 TemplateURLService
* owner_
;
44 ScopedObserver
<history::HistoryService
, history::HistoryServiceObserver
>
45 history_service_observer_
;
46 history::HistoryService
* history_service_
;
48 DISALLOW_COPY_AND_ASSIGN(ChromeTemplateURLServiceClient
);
51 #endif // CHROME_BROWSER_SEARCH_ENGINES_CHROME_TEMPLATE_URL_SERVICE_CLIENT_H_