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"
14 // ChromeTemplateURLServiceClient provides keyword related history
15 // functionality for TemplateURLService.
16 class ChromeTemplateURLServiceClient
: public TemplateURLServiceClient
,
17 public history::HistoryServiceObserver
{
19 explicit ChromeTemplateURLServiceClient(HistoryService
* history_service
);
20 ~ChromeTemplateURLServiceClient() override
;
22 // TemplateURLServiceClient:
23 void Shutdown() override
;
24 void SetOwner(TemplateURLService
* owner
) override
;
25 void DeleteAllSearchTermsForKeyword(history::KeywordID keyword_Id
) override
;
26 void SetKeywordSearchTermsForURL(const GURL
& url
,
28 const base::string16
& term
) override
;
29 void AddKeywordGeneratedVisit(const GURL
& url
) override
;
30 void RestoreExtensionInfoIfNecessary(TemplateURL
* template_url
) override
;
32 // history::HistoryServiceObserver:
33 void OnURLVisited(HistoryService
* history_service
,
34 ui::PageTransition transition
,
35 const history::URLRow
& row
,
36 const history::RedirectList
& redirects
,
37 base::Time visit_time
) override
;
40 TemplateURLService
* owner_
;
41 ScopedObserver
<HistoryService
, HistoryServiceObserver
>
42 history_service_observer_
;
43 HistoryService
* history_service_
;
45 DISALLOW_COPY_AND_ASSIGN(ChromeTemplateURLServiceClient
);
48 #endif // CHROME_BROWSER_SEARCH_ENGINES_CHROME_TEMPLATE_URL_SERVICE_CLIENT_H_