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

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

Issue 631253002: Refactor sending NOTIFICATION_HISTORY_URL_VISITED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests on Android 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_service_factory.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 04ca1c408744bd842f3e306dabfa58c1bd575724..114ac8ea83e1701fd6774ce152401cd3a2a6c6b6 100644
--- a/chrome/browser/history/history_service.cc
+++ b/chrome/browser/history/history_service.cc
@@ -173,6 +173,19 @@ class HistoryService::BackendDelegate : public HistoryBackend::Delegate {
&HistoryService::NotifyFaviconChanged, history_service_, urls));
}
+ virtual void NotifyURLVisited(ui::PageTransition transition,
+ const history::URLRow& row,
+ const history::RedirectList& redirects,
+ base::Time visit_time) OVERRIDE {
+ service_task_runner_->PostTask(FROM_HERE,
+ base::Bind(&HistoryService::NotifyURLVisited,
+ history_service_,
+ transition,
+ row,
+ redirects,
+ visit_time));
+ }
+
virtual void BroadcastNotifications(
int type,
scoped_ptr<history::HistoryDetails> details) override {
@@ -982,7 +995,7 @@ bool HistoryService::Init(const base::FilePath& history_dir, bool no_db) {
std::string languages =
profile_->GetPrefs()->GetString(prefs::kAcceptLanguages);
in_memory_url_index_.reset(new history::InMemoryURLIndex(
- profile_, history_dir_, languages, history_client_));
+ profile_, this, history_dir_, languages, history_client_));
in_memory_url_index_->Init();
}
@@ -1105,7 +1118,7 @@ void HistoryService::SetInMemoryBackend(
in_memory_backend_.reset(mem_backend.release());
// The database requires additional initialization once we own it.
- in_memory_backend_->AttachToHistoryService(profile_);
+ in_memory_backend_->AttachToHistoryService(profile_, this);
}
void HistoryService::NotifyProfileError(sql::InitStatus init_status) {
@@ -1236,6 +1249,16 @@ void HistoryService::NotifyAddVisit(const history::BriefVisitInfo& info) {
history::HistoryServiceObserver, observers_, OnAddVisit(this, info));
}
+void HistoryService::NotifyURLVisited(ui::PageTransition transition,
+ const history::URLRow& row,
+ const history::RedirectList& redirects,
+ base::Time visit_time) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ FOR_EACH_OBSERVER(history::HistoryServiceObserver,
+ observers_,
+ OnURLVisited(this, transition, row, redirects, visit_time));
+}
+
scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription>
HistoryService::AddFaviconChangedCallback(
const HistoryService::OnFaviconChangedCallback& callback) {
« no previous file with comments | « chrome/browser/history/history_service.h ('k') | chrome/browser/history/history_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698