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

Unified Diff: chrome/browser/history/visit_database.h

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
Index: chrome/browser/history/visit_database.h
===================================================================
--- chrome/browser/history/visit_database.h (revision 131579)
+++ chrome/browser/history/visit_database.h (working copy)
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_HISTORY_VISIT_DATABASE_H_
#pragma once
+#include "base/observer_list_threadsafe.h"
#include "chrome/browser/history/history_types.h"
namespace sql {
@@ -17,6 +18,20 @@
class VisitFilter;
+// Abbreviated information about a visit.
+struct BriefVisitInfo {
+ URLID url_id;
+ base::Time time;
+ content::PageTransition transition;
+};
+
+// An observer of VisitDatabase.
+class VisitDatabaseObserver {
+ public:
+ virtual ~VisitDatabaseObserver() {}
+ virtual void OnAddVisit(BriefVisitInfo info) = 0;
+};
+
// A visit database is one which stores visits for URLs, that is, times and
// linking information. A visit database must also be a URLDatabase, as this
// modifies tables used by URLs directly and could be thought of as inheriting
@@ -172,6 +187,17 @@
void GetVisitsSource(const VisitVector& visits,
VisitSourceMap* sources);
+ // Adds or removes observers for the VisitDatabase. Should be run on
+ // the thread in which the observer would like to be notified.
+ void AddVisitDatabaseObserver(VisitDatabaseObserver* observer);
+ void RemoveVisitDatabaseObserver(VisitDatabaseObserver* observer);
+
+ // Obtains BriefVisitInfo for the specified number of most recent visits
+ // from the visit database.
+ void GetBriefVisitInfoOfMostRecentVisits(
+ int max_visits,
+ std::vector<BriefVisitInfo>* result_vector);
+
protected:
// Returns the database for the functions in this interface.
virtual sql::Connection& GetDB() = 0;
@@ -193,6 +219,7 @@
bool MigrateVisitsWithoutDuration();
private:
+ scoped_refptr<ObserverListThreadSafe<VisitDatabaseObserver> > observers_;
DISALLOW_COPY_AND_ASSIGN(VisitDatabase);
};

Powered by Google App Engine
This is Rietveld 408576698