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

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

Issue 642623004: Rename VisitDatabaseObserver to HistoryServiceObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@373326
Patch Set: Address comments & rebase Created 6 years, 2 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
« no previous file with comments | « chrome/browser/history/history_service.h ('k') | chrome/browser/history/history_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/history_service.cc
diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc
index 3f32cce34e7ec0379d3ca39f43f8b2330224d55c..04ca1c408744bd842f3e306dabfa58c1bd575724 100644
--- a/chrome/browser/history/history_service.cc
+++ b/chrome/browser/history/history_service.cc
@@ -50,6 +50,7 @@
#include "chrome/common/url_constants.h"
#include "components/dom_distiller/core/url_constants.h"
#include "components/history/core/browser/history_client.h"
+#include "components/history/core/browser/history_service_observer.h"
#include "components/history/core/browser/history_types.h"
#include "components/history/core/browser/in_memory_database.h"
#include "components/history/core/browser/keyword_search_term.h"
@@ -158,6 +159,12 @@ class HistoryService::BackendDelegate : public HistoryBackend::Delegate {
base::Passed(&backend)));
}
+ virtual void NotifyAddVisit(const history::BriefVisitInfo& info) override {
+ service_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&HistoryService::NotifyAddVisit, history_service_, info));
+ }
+
virtual void NotifyFaviconChanged(const std::set<GURL>& urls) override {
// Send the notification to the history service on the main thread.
service_task_runner_->PostTask(
@@ -188,14 +195,6 @@ class HistoryService::BackendDelegate : public HistoryBackend::Delegate {
base::Bind(&HistoryService::OnDBLoaded, history_service_));
}
- virtual void NotifyVisitDBObserversOnAddVisit(
- const history::BriefVisitInfo& info) override {
- service_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&HistoryService::NotifyVisitDBObserversOnAddVisit,
- history_service_, info));
- }
-
private:
const base::WeakPtr<HistoryService> history_service_;
const scoped_refptr<base::SequencedTaskRunner> service_task_runner_;
@@ -334,6 +333,16 @@ void HistoryService::URLsNoLongerBookmarked(const std::set<GURL>& urls) {
urls);
}
+void HistoryService::AddObserver(history::HistoryServiceObserver* observer) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ observers_.AddObserver(observer);
+}
+
+void HistoryService::RemoveObserver(history::HistoryServiceObserver* observer) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ observers_.RemoveObserver(observer);
+}
+
void HistoryService::ScheduleDBTask(scoped_ptr<history::HistoryDBTask> task,
base::CancelableTaskTracker* tracker) {
DCHECK(thread_) << "History service being called after cleanup";
@@ -1221,23 +1230,10 @@ bool HistoryService::GetRowForURL(const GURL& url, history::URLRow* url_row) {
return db && (db->GetRowForURL(url, url_row) != 0);
}
-void HistoryService::AddVisitDatabaseObserver(
- history::VisitDatabaseObserver* observer) {
- DCHECK(thread_checker_.CalledOnValidThread());
- visit_database_observers_.AddObserver(observer);
-}
-
-void HistoryService::RemoveVisitDatabaseObserver(
- history::VisitDatabaseObserver* observer) {
- DCHECK(thread_checker_.CalledOnValidThread());
- visit_database_observers_.RemoveObserver(observer);
-}
-
-void HistoryService::NotifyVisitDBObserversOnAddVisit(
- const history::BriefVisitInfo& info) {
+void HistoryService::NotifyAddVisit(const history::BriefVisitInfo& info) {
DCHECK(thread_checker_.CalledOnValidThread());
- FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_,
- OnAddVisit(info));
+ FOR_EACH_OBSERVER(
+ history::HistoryServiceObserver, observers_, OnAddVisit(this, info));
}
scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription>
« no previous file with comments | « chrome/browser/history/history_service.h ('k') | chrome/browser/history/history_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698