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

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

Issue 10067018: Add PrerenderLocalPredictor, which will eventually perform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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.h ('k') | chrome/browser/history/history_backend.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/history.cc
===================================================================
--- chrome/browser/history/history.cc (revision 133528)
+++ chrome/browser/history/history.cc (working copy)
@@ -40,6 +40,7 @@
#include "chrome/browser/history/in_memory_history_backend.h"
#include "chrome/browser/history/in_memory_url_index.h"
#include "chrome/browser/history/top_sites.h"
+#include "chrome/browser/history/visit_database.h"
#include "chrome/browser/history/visit_filter.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
@@ -127,6 +128,13 @@
history_service_.get(), backend_id));
}
+ virtual void NotifyVisitDBObserversOnAddVisit(
+ const history::BriefVisitInfo& info) OVERRIDE {
+ // Since the notification method can be run on any thread, we can
+ // call it right away.
+ history_service_->NotifyVisitDBObserversOnAddVisit(info);
+ }
+
private:
scoped_refptr<HistoryService> history_service_;
MessageLoop* message_loop_;
@@ -143,7 +151,9 @@
current_backend_id_(-1),
bookmark_service_(NULL),
no_db_(false),
- needs_top_sites_migration_(false) {
+ needs_top_sites_migration_(false),
+ visit_database_observers_(
+ new ObserverListThreadSafe<history::VisitDatabaseObserver>()) {
}
HistoryService::HistoryService(Profile* profile)
@@ -153,7 +163,9 @@
current_backend_id_(-1),
bookmark_service_(NULL),
no_db_(false),
- needs_top_sites_migration_(false) {
+ needs_top_sites_migration_(false),
+ visit_database_observers_(
+ new ObserverListThreadSafe<history::VisitDatabaseObserver>()) {
DCHECK(profile_);
registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED,
content::Source<Profile>(profile_));
@@ -892,3 +904,19 @@
ScheduleAndForget(PRIORITY_NORMAL,
&HistoryBackend::MigrateThumbnailsDatabase);
}
+
+void HistoryService::AddVisitDatabaseObserver(
+ history::VisitDatabaseObserver* observer) {
+ visit_database_observers_->AddObserver(observer);
+}
+
+void HistoryService::RemoveVisitDatabaseObserver(
+ history::VisitDatabaseObserver* observer) {
+ visit_database_observers_->RemoveObserver(observer);
+}
+
+void HistoryService::NotifyVisitDBObserversOnAddVisit(
+ const history::BriefVisitInfo& info) {
+ visit_database_observers_->Notify(
+ &history::VisitDatabaseObserver::OnAddVisit, info);
+}
« no previous file with comments | « chrome/browser/history/history.h ('k') | chrome/browser/history/history_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698