Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4052)

Unified Diff: chrome/browser/history/history_service.cc

Issue 573553004: Eliminate NOTIFICATION_HISTORY_LOADED notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/history_service.cc
diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc
index b5a971b0adc6a7535326920c7ab55f9e8acdc8bb..9ef201b54f0eb14b94e2b6dfa091eb39b9d09baa 100644
--- a/chrome/browser/history/history_service.cc
+++ b/chrome/browser/history/history_service.cc
@@ -1199,10 +1199,7 @@ void HistoryService::BroadcastNotificationsHelper(
void HistoryService::OnDBLoaded() {
DCHECK(thread_checker_.CalledOnValidThread());
backend_loaded_ = true;
- content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_HISTORY_LOADED,
- content::Source<Profile>(profile_),
- content::Details<HistoryService>(this));
+ NotifyHistoryServiceLoaded();
}
bool HistoryService::GetRowForURL(const GURL& url, history::URLRow* url_row) {
@@ -1229,3 +1226,21 @@ void HistoryService::NotifyVisitDBObserversOnAddVisit(
FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_,
OnAddVisit(info));
}
+
+void HistoryService::AddHistoryServiceObserver(
sdefresne 2014/10/20 13:15:41 Note: those two methods have been added already. I
nshaik 2014/10/29 08:43:39 Done.
+ history::HistoryServiceObserver* observer) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ history_service_observers_.AddObserver(observer);
+}
+
+void HistoryService::RemoveHistoryServiceObserver(
+ history::HistoryServiceObserver* observer) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ history_service_observers_.RemoveObserver(observer);
+}
+
+void HistoryService::NotifyHistoryServiceLoaded() {
+ FOR_EACH_OBSERVER(history::HistoryServiceObserver,
+ history_service_observers_,
+ HistoryServiceLoaded(this));
+}

Powered by Google App Engine
This is Rietveld 408576698