Index: chrome/browser/history/chrome_history_client.cc |
diff --git a/chrome/browser/history/chrome_history_client.cc b/chrome/browser/history/chrome_history_client.cc |
index ea979be370bd4b1b531ab34ba7b888559f0cacec..210d147eb1894e606736a25354bc02e88490d6cd 100644 |
--- a/chrome/browser/history/chrome_history_client.cc |
+++ b/chrome/browser/history/chrome_history_client.cc |
@@ -7,6 +7,7 @@ |
#include "base/logging.h" |
#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/history/history_notifications.h" |
+#include "chrome/browser/history/history_service.h" |
#include "chrome/browser/history/top_sites.h" |
#include "chrome/browser/ui/profile_error_dialog.h" |
#include "chrome/common/chrome_version_info.h" |
@@ -20,6 +21,7 @@ ChromeHistoryClient::ChromeHistoryClient(BookmarkModel* bookmark_model, |
history::TopSites* top_sites) |
: bookmark_model_(bookmark_model), |
profile_(profile), |
+ history_service_(nullptr), |
top_sites_(top_sites) { |
DCHECK(bookmark_model_); |
if (top_sites_) |
@@ -31,6 +33,12 @@ ChromeHistoryClient::~ChromeHistoryClient() { |
top_sites_->RemoveObserver(this); |
} |
+void ChromeHistoryClient::SetHistoryService(HistoryService* history_service) { |
+ DCHECK(history_service); |
+ history_service_ = history_service; |
+ history_service_->AddHistoryServiceObserver(this); |
+} |
+ |
void ChromeHistoryClient::BlockUntilBookmarksLoaded() { |
bookmark_model_->BlockTillLoaded(); |
} |
@@ -79,6 +87,24 @@ void ChromeHistoryClient::Shutdown() { |
// shutdown (HistoryService::Cleanup to complete). In such a scenario history |
// sees an incorrect view of bookmarks, but it's better than a deadlock. |
bookmark_model_->Shutdown(); |
+ if (history_service_) |
+ history_service_->RemoveHistoryServiceObserver(this); |
+} |
+ |
+void ChromeHistoryClient::OnURLVisited(ui::PageTransition transition, |
+ const history::URLRow& row, |
+ const history::RedirectList& redirects, |
+ const base::Time& visit_time) { |
+ scoped_ptr<history::URLVisitedDetails> details( |
blundell
2014/10/08 09:59:13
This should have a TODO and bug reference about re
sdefresne
2014/10/09 09:38:15
Done.
|
+ new history::URLVisitedDetails); |
+ details->transition = transition; |
+ details->row = row; |
+ details->redirects = redirects; |
+ details->visit_time = visit_time; |
+ content::NotificationService::current()->Notify( |
+ chrome::NOTIFICATION_HISTORY_URL_VISITED, |
+ content::Source<Profile>(profile_), |
+ content::Details<history::HistoryDetails>(details.get())); |
} |
void ChromeHistoryClient::TopSitesLoaded(history::TopSites* top_sites) { |