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

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

Issue 631253002: Refactor sending NOTIFICATION_HISTORY_URL_VISITED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: chrome/browser/history/history_service.h
diff --git a/chrome/browser/history/history_service.h b/chrome/browser/history/history_service.h
index a7de0cb9e8161813294399e7521585837c7b147d..3dfff77e6eb271b3ed01054f4c813ddbabc79e7d 100644
--- a/chrome/browser/history/history_service.h
+++ b/chrome/browser/history/history_service.h
@@ -64,6 +64,7 @@ class HistoryClient;
class HistoryDatabase;
class HistoryDBTask;
class HistoryQueryTest;
+class HistoryServiceObserver;
class HistoryTest;
class InMemoryHistoryBackend;
class InMemoryURLIndex;
@@ -430,6 +431,12 @@ class HistoryService : public content::NotificationObserver,
// Notification that a URL is no longer bookmarked.
void URLsNoLongerBookmarked(const std::set<GURL>& urls);
+ // HistoryServiceObserver ----------------------------------------------------
+
+ // Adds/Removes an HistoryServiceObserver.
+ void AddHistoryServiceObserver(history::HistoryServiceObserver* observer);
+ void RemoveHistoryServiceObserver(history::HistoryServiceObserver* observer);
+
// Generic Stuff -------------------------------------------------------------
// Schedules a HistoryDBTask for running on the history backend thread. See
@@ -589,6 +596,19 @@ class HistoryService : public content::NotificationObserver,
// available or the URL does not exist.
bool GetRowForURL(const GURL& url, history::URLRow* url_row);
+ // HistoryServiceObserver ----------------------------------------------------
+
+ // Notify all HistoryServiceObservers 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,
+ // then |redirects[0]=B| and |redirects[1]=A|. If there are no redirects,
+ // |redirects| is an empty vector.
+ void NotifyURLVisited(ui::PageTransition transition,
+ const history::URLRow& row,
+ const history::RedirectList& redirects,
+ const base::Time& visit_time);
+
// Favicon -------------------------------------------------------------------
// These favicon methods are exposed to the FaviconService. Instead of calling
@@ -873,6 +893,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_;
base::CallbackList<void(const std::set<GURL>&)>

Powered by Google App Engine
This is Rietveld 408576698