| 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 "components/history/core/browser/history_client.h" | 9 #include "components/history/core/browser/history_client.h" |
| 10 #include "components/history/core/browser/history_service_observer.h" | 10 #include "components/history/core/browser/history_service_observer.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 public history::HistoryServiceObserver, | 24 public history::HistoryServiceObserver, |
| 25 public history::TopSitesObserver { | 25 public history::TopSitesObserver { |
| 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/373326 |
| 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: | |
| 49 virtual void OnURLVisited(HistoryService* history_service, | |
| 50 ui::PageTransition transition, | |
| 51 const history::URLRow& row, | |
| 52 const history::RedirectList& redirects, | |
| 53 base::Time visit_time) OVERRIDE; | |
| 54 | |
| 55 // TopSitesObserver: | 48 // TopSitesObserver: |
| 56 virtual void TopSitesLoaded(history::TopSites* top_sites) override; | 49 virtual void TopSitesLoaded(history::TopSites* top_sites) override; |
| 57 virtual void TopSitesChanged(history::TopSites* top_sites) override; | 50 virtual void TopSitesChanged(history::TopSites* top_sites) override; |
| 58 | 51 |
| 59 private: | 52 private: |
| 60 // The BookmarkModel, this should outlive ChromeHistoryClient. | 53 // The BookmarkModel, this should outlive ChromeHistoryClient. |
| 61 BookmarkModel* bookmark_model_; | 54 BookmarkModel* bookmark_model_; |
| 62 Profile* profile_; | 55 Profile* profile_; |
| 63 HistoryService* history_service_; | 56 HistoryService* history_service_; |
| 64 // The TopSites object is owned by the Profile (see | 57 // The TopSites object is owned by the Profile (see |
| 65 // chrome/browser/profiles/profile_impl.h) | 58 // chrome/browser/profiles/profile_impl.h) |
| 66 // and lazily constructed by the getter. | 59 // and lazily constructed by the getter. |
| 67 // ChromeHistoryClient is a KeyedService linked to the Profile lifetime by the | 60 // ChromeHistoryClient is a KeyedService linked to the Profile lifetime by the |
| 68 // ChromeHistoryClientFactory (which is a BrowserContextKeyedServiceFactory). | 61 // ChromeHistoryClientFactory (which is a BrowserContextKeyedServiceFactory). |
| 69 // Before the Profile is destroyed, all the KeyedService Shutdown methods are | 62 // Before the Profile is destroyed, all the KeyedService Shutdown methods are |
| 70 // called, and the Profile is fully constructed before any of the KeyedService | 63 // called, and the Profile is fully constructed before any of the KeyedService |
| 71 // can be constructed. The TopSites does not use the HistoryService nor the | 64 // can be constructed. The TopSites does not use the HistoryService nor the |
| 72 // HistoryClient during construction (it uses it later, but supports getting | 65 // HistoryClient during construction (it uses it later, but supports getting |
| 73 // an NULL pointer). | 66 // an NULL pointer). |
| 74 history::TopSites* top_sites_; | 67 history::TopSites* top_sites_; |
| 75 | 68 |
| 76 DISALLOW_COPY_AND_ASSIGN(ChromeHistoryClient); | 69 DISALLOW_COPY_AND_ASSIGN(ChromeHistoryClient); |
| 77 }; | 70 }; |
| 78 | 71 |
| 79 #endif // CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ | 72 #endif // CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ |
| OLD | NEW |