| Index: chrome/browser/history/history_service.h
|
| diff --git a/chrome/browser/history/history_service.h b/chrome/browser/history/history_service.h
|
| index b91e06503955f5d5ffa41c2e82e88cfe6f45094a..0fb0540b53fa3787955b4f9d4d8ffc5ebc0258e9 100644
|
| --- a/chrome/browser/history/history_service.h
|
| +++ b/chrome/browser/history/history_service.h
|
| @@ -64,13 +64,11 @@ class HistoryClient;
|
| class HistoryDatabase;
|
| class HistoryDBTask;
|
| class HistoryQueryTest;
|
| -class HistoryServiceObserver;
|
| class HistoryTest;
|
| class InMemoryHistoryBackend;
|
| class InMemoryURLIndex;
|
| class InMemoryURLIndexTest;
|
| class URLDatabase;
|
| -class VisitDatabaseObserver;
|
| class VisitFilter;
|
| struct DownloadRow;
|
| struct HistoryAddPageArgs;
|
| @@ -92,6 +90,27 @@ class HistoryService : public content::NotificationObserver,
|
| // Miscellaneous commonly-used types.
|
| typedef std::vector<PageUsageData*> PageUsageDataList;
|
|
|
| + class Observer {
|
| + public:
|
| + Observer() {}
|
| + virtual ~Observer() {}
|
| +
|
| + // Called when user visits an URL.
|
| + //
|
| + // The |row| ID will be set to the value that is currently in effect in the
|
| + // main history database. |redirects| is the list of redirects leading up to
|
| + // the URL. If we have a redirect chain A -> B -> C and user is visiting C,
|
| + // then |redirects[0]=B| and |redirects[1]=A|. If there are no redirects,
|
| + // |redirects| is an empty vector.
|
| + virtual void OnURLVisited(ui::PageTransition transition,
|
| + const history::URLRow& row,
|
| + const history::RedirectList& redirects,
|
| + base::Time visit_time) {}
|
| +
|
| + // Called on changes to the VisitDatabase.
|
| + virtual void OnAddVisit(const history::BriefVisitInfo& info) {}
|
| + };
|
| +
|
| // Must call Init after construction. The |history::HistoryClient| object
|
| // must be valid for the whole lifetime of |HistoryService|.
|
| explicit HistoryService(history::HistoryClient* client, Profile* profile);
|
| @@ -431,11 +450,11 @@ class HistoryService : public content::NotificationObserver,
|
| // Notification that a URL is no longer bookmarked.
|
| void URLsNoLongerBookmarked(const std::set<GURL>& urls);
|
|
|
| - // HistoryServiceObserver ----------------------------------------------------
|
| + // Observers -----------------------------------------------------------------
|
|
|
| - // Adds/Removes an HistoryServiceObserver.
|
| - void AddHistoryServiceObserver(history::HistoryServiceObserver* observer);
|
| - void RemoveHistoryServiceObserver(history::HistoryServiceObserver* observer);
|
| + // Adds/Removes an Observer.
|
| + void AddObserver(Observer* observer);
|
| + void RemoveObserver(Observer* observer);
|
|
|
| // Generic Stuff -------------------------------------------------------------
|
|
|
| @@ -444,12 +463,6 @@ class HistoryService : public content::NotificationObserver,
|
| virtual void ScheduleDBTask(scoped_ptr<history::HistoryDBTask> task,
|
| base::CancelableTaskTracker* tracker);
|
|
|
| - // Adds or removes observers for the VisitDatabase.
|
| - void AddVisitDatabaseObserver(history::VisitDatabaseObserver* observer);
|
| - void RemoveVisitDatabaseObserver(history::VisitDatabaseObserver* observer);
|
| -
|
| - void NotifyVisitDBObserversOnAddVisit(const history::BriefVisitInfo& info);
|
| -
|
| // This callback is invoked when favicon change for urls.
|
| typedef base::Callback<void(const std::set<GURL>&)> OnFaviconChangedCallback;
|
|
|
| @@ -596,9 +609,9 @@ class HistoryService : public content::NotificationObserver,
|
| // available or the URL does not exist.
|
| bool GetRowForURL(const GURL& url, history::URLRow* url_row);
|
|
|
| - // HistoryServiceObserver ----------------------------------------------------
|
| + // Observers -----------------------------------------------------------------
|
|
|
| - // Notify all HistoryServiceObservers registered that user is visiting a URL.
|
| + // Notify all Observers registered that user is visiting a URL.
|
| // The |row| ID will be set to the value that is currently in effect in the
|
| // main history database. |redirects| is the list of redirects leading up to
|
| // the URL. If we have a redirect chain A -> B -> C and user is visiting C,
|
| @@ -609,6 +622,9 @@ class HistoryService : public content::NotificationObserver,
|
| const history::RedirectList& redirects,
|
| base::Time visit_time);
|
|
|
| + // Notify all Observers registered that the VisitDatabase was changed.
|
| + void NotifyAddVisit(const history::BriefVisitInfo& info);
|
| +
|
| // Favicon -------------------------------------------------------------------
|
|
|
| // These favicon methods are exposed to the FaviconService. Instead of calling
|
| @@ -893,9 +909,7 @@ class HistoryService : public content::NotificationObserver,
|
| // See http://crbug.com/138321
|
| scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_;
|
|
|
| - ObserverList<history::HistoryServiceObserver> history_service_observers_;
|
| - ObserverList<history::VisitDatabaseObserver> visit_database_observers_;
|
| -
|
| + ObserverList<Observer> observers_;
|
| base::CallbackList<void(const std::set<GURL>&)>
|
| favicon_changed_callback_list_;
|
|
|
|
|