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

Unified Diff: chrome/browser/google/google_url_tracker.h

Issue 287103002: Introduce ability to register callback with GoogleURLTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to review Created 6 years, 7 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 | « no previous file | chrome/browser/google/google_url_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/google/google_url_tracker.h
diff --git a/chrome/browser/google/google_url_tracker.h b/chrome/browser/google/google_url_tracker.h
index ab930003369eb8a6b51b4177d195f2914145e5b8..bce07e4cfa7f7ba208a6fbbf671525cc0940943e 100644
--- a/chrome/browser/google/google_url_tracker.h
+++ b/chrome/browser/google/google_url_tracker.h
@@ -10,6 +10,7 @@
#include <utility>
#include "base/callback_forward.h"
+#include "base/callback_list.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
@@ -49,6 +50,12 @@ class GoogleURLTracker : public net::URLFetcherDelegate,
public net::NetworkChangeNotifier::IPAddressObserver,
public KeyedService {
public:
+ // Callback that is called when the Google URL is updated. The arguments are
+ // the old and new URLs.
+ typedef base::Callback<void(GURL, GURL)> OnGoogleURLUpdatedCallback;
+ typedef base::CallbackList<void(GURL, GURL)> CallbackList;
+ typedef CallbackList::Subscription Subscription;
+
// The contents of the Details for a NOTIFICATION_GOOGLE_URL_UPDATED.
typedef std::pair<GURL, GURL> UpdatedDetails;
@@ -59,6 +66,9 @@ class GoogleURLTracker : public net::URLFetcherDelegate,
UNIT_TEST_MODE,
};
+ static const char kDefaultGoogleHomepage[];
+ static const char kSearchDomainCheckURL[];
+
// Only the GoogleURLTrackerFactory and tests should call this. No code other
// than the GoogleURLTracker itself should actually use
// GoogleURLTrackerFactory::GetForProfile().
@@ -125,8 +135,8 @@ class GoogleURLTracker : public net::URLFetcherDelegate,
virtual void OnTabClosed(
content::NavigationController* navigation_controller);
- static const char kDefaultGoogleHomepage[];
- static const char kSearchDomainCheckURL[];
+ scoped_ptr<Subscription> RegisterCallback(
+ const OnGoogleURLUpdatedCallback& cb);
private:
friend class GoogleURLTrackerTest;
@@ -175,6 +185,10 @@ class GoogleURLTracker : public net::URLFetcherDelegate,
const GoogleURLTrackerMapEntry& map_entry,
bool must_be_listening_for_commit);
+ void NotifyGoogleURLUpdated(GURL old_url, GURL new_url);
+
+ CallbackList callback_list_;
+
Profile* profile_;
scoped_ptr<GoogleURLTrackerNavigationHelper> nav_helper_;
« no previous file with comments | « no previous file | chrome/browser/google/google_url_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698