| Index: chrome/browser/history/history_service.cc
|
| diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc
|
| index 81e10d3157d7e5616189298743baff6e27b73446..a4f4fd670f77aee13a2597905a9b183717a1b1e6 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"
|
| @@ -166,6 +167,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,
|
| + const 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 {
|
| @@ -334,6 +348,16 @@ void HistoryService::URLsNoLongerBookmarked(const std::set<GURL>& urls) {
|
| urls);
|
| }
|
|
|
| +void HistoryService::AddHistoryServiceObserver(
|
| + history::HistoryServiceObserver* observer) {
|
| + history_service_observers_.AddObserver(observer);
|
| +}
|
| +
|
| +void HistoryService::RemoveHistoryServiceObserver(
|
| + history::HistoryServiceObserver* observer) {
|
| + history_service_observers_.RemoveObserver(observer);
|
| +}
|
| +
|
| void HistoryService::ScheduleDBTask(scoped_ptr<history::HistoryDBTask> task,
|
| base::CancelableTaskTracker* tracker) {
|
| DCHECK(thread_) << "History service being called after cleanup";
|
| @@ -973,7 +997,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();
|
| }
|
|
|
| @@ -1096,7 +1120,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) {
|
| @@ -1221,6 +1245,16 @@ bool HistoryService::GetRowForURL(const GURL& url, history::URLRow* url_row) {
|
| return db && (db->GetRowForURL(url, url_row) != 0);
|
| }
|
|
|
| +void HistoryService::NotifyURLVisited(ui::PageTransition transition,
|
| + const history::URLRow& row,
|
| + const history::RedirectList& redirects,
|
| + const base::Time& visit_time) {
|
| + DCHECK(thread_checker_.CalledOnValidThread());
|
| + FOR_EACH_OBSERVER(history::HistoryServiceObserver,
|
| + history_service_observers_,
|
| + OnURLVisited(transition, row, redirects, visit_time));
|
| +}
|
| +
|
| void HistoryService::AddVisitDatabaseObserver(
|
| history::VisitDatabaseObserver* observer) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|