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_HISTORY_CHROME_HISTORY_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ |
6 #define CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ | 6 #define CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/history/history_service.h" |
9 #include "components/history/core/browser/history_client.h" | 10 #include "components/history/core/browser/history_client.h" |
10 #include "components/history/core/browser/history_service_observer.h" | |
11 #include "components/history/core/browser/top_sites_observer.h" | 11 #include "components/history/core/browser/top_sites_observer.h" |
12 | 12 |
13 class BookmarkModel; | 13 class BookmarkModel; |
14 class HistoryService; | 14 class HistoryService; |
15 class Profile; | 15 class Profile; |
16 | 16 |
17 namespace history { | 17 namespace history { |
18 class TopSites; | 18 class TopSites; |
19 } | 19 } |
20 | 20 |
21 // This class implements history::HistoryClient to abstract operations that | 21 // This class implements history::HistoryClient to abstract operations that |
22 // depend on Chrome environment. | 22 // depend on Chrome environment. |
23 class ChromeHistoryClient : public history::HistoryClient, | 23 class ChromeHistoryClient : public history::HistoryClient, |
24 public history::HistoryServiceObserver, | 24 public history::TopSitesObserver, |
25 public history::TopSitesObserver { | 25 public HistoryService::Observer { |
26 public: | 26 public: |
27 explicit ChromeHistoryClient(BookmarkModel* bookmark_model, | 27 explicit ChromeHistoryClient(BookmarkModel* bookmark_model, |
28 Profile* profile, | 28 Profile* profile, |
29 history::TopSites* top_sites); | 29 history::TopSites* top_sites); |
30 virtual ~ChromeHistoryClient(); | 30 virtual ~ChromeHistoryClient(); |
31 | 31 |
32 // TODO(sdefresne): once NOTIFICATION_HISTORY_URL* notifications are no | 32 // TODO(sdefresne): once NOTIFICATION_HISTORY_URL* notifications are no |
33 // longer used, remove this reference to the HistoryService from the | 33 // longer used, remove this reference to the HistoryService from the |
34 // ChromeHistoryClient, http://crbug.com/42178 | 34 // ChromeHistoryClient, http://crbug.com/42178 |
35 void SetHistoryService(HistoryService* history_service); | 35 void SetHistoryService(HistoryService* history_service); |
36 | 36 |
37 // history::HistoryClient: | 37 // history::HistoryClient: |
38 virtual void BlockUntilBookmarksLoaded() OVERRIDE; | 38 virtual void BlockUntilBookmarksLoaded() OVERRIDE; |
39 virtual bool IsBookmarked(const GURL& url) OVERRIDE; | 39 virtual bool IsBookmarked(const GURL& url) OVERRIDE; |
40 virtual void GetBookmarks( | 40 virtual void GetBookmarks( |
41 std::vector<history::URLAndTitle>* bookmarks) OVERRIDE; | 41 std::vector<history::URLAndTitle>* bookmarks) OVERRIDE; |
42 virtual void NotifyProfileError(sql::InitStatus init_status) OVERRIDE; | 42 virtual void NotifyProfileError(sql::InitStatus init_status) OVERRIDE; |
43 virtual bool ShouldReportDatabaseError() OVERRIDE; | 43 virtual bool ShouldReportDatabaseError() OVERRIDE; |
44 | 44 |
45 // KeyedService: | 45 // KeyedService: |
46 virtual void Shutdown() OVERRIDE; | 46 virtual void Shutdown() OVERRIDE; |
47 | 47 |
48 // HistoryServiceObserver: | 48 // HistoryService::Observer: |
49 virtual void OnURLVisited(ui::PageTransition transition, | 49 virtual void OnURLVisited(ui::PageTransition transition, |
50 const history::URLRow& row, | 50 const history::URLRow& row, |
51 const history::RedirectList& redirects, | 51 const history::RedirectList& redirects, |
52 base::Time visit_time) OVERRIDE; | 52 base::Time visit_time) OVERRIDE; |
53 | 53 |
54 // TopSitesObserver: | 54 // TopSitesObserver: |
55 virtual void TopSitesLoaded(history::TopSites* top_sites) OVERRIDE; | 55 virtual void TopSitesLoaded(history::TopSites* top_sites) OVERRIDE; |
56 virtual void TopSitesChanged(history::TopSites* top_sites) OVERRIDE; | 56 virtual void TopSitesChanged(history::TopSites* top_sites) OVERRIDE; |
57 | 57 |
58 private: | 58 private: |
(...skipping 10 matching lines...) Expand all Loading... |
69 // called, and the Profile is fully constructed before any of the KeyedService | 69 // called, and the Profile is fully constructed before any of the KeyedService |
70 // can be constructed. The TopSites does not use the HistoryService nor the | 70 // can be constructed. The TopSites does not use the HistoryService nor the |
71 // HistoryClient during construction (it uses it later, but supports getting | 71 // HistoryClient during construction (it uses it later, but supports getting |
72 // an NULL pointer). | 72 // an NULL pointer). |
73 history::TopSites* top_sites_; | 73 history::TopSites* top_sites_; |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(ChromeHistoryClient); | 75 DISALLOW_COPY_AND_ASSIGN(ChromeHistoryClient); |
76 }; | 76 }; |
77 | 77 |
78 #endif // CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ | 78 #endif // CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ |
OLD | NEW |