Chromium Code Reviews| 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..06b3cb8c534949f5e5f3e5aed34b659219c11949 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,10 @@ 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; |
| + |
| // The contents of the Details for a NOTIFICATION_GOOGLE_URL_UPDATED. |
| typedef std::pair<GURL, GURL> UpdatedDetails; |
| @@ -125,6 +130,11 @@ class GoogleURLTracker : public net::URLFetcherDelegate, |
| virtual void OnTabClosed( |
| content::NavigationController* navigation_controller); |
| + scoped_ptr<base::CallbackList<void(GURL, GURL)>::Subscription> |
| + RegisterCallback(const OnGoogleURLUpdatedCallback& cb) { |
| + return callback_list_.Add(cb); |
|
Peter Kasting
2014/05/15 21:12:52
Add() is not a cheap accessor (based on its name),
blundell
2014/05/16 09:09:55
Done.
|
| + } |
| + |
| static const char kDefaultGoogleHomepage[]; |
| static const char kSearchDomainCheckURL[]; |
| @@ -175,6 +185,12 @@ class GoogleURLTracker : public net::URLFetcherDelegate, |
| const GoogleURLTrackerMapEntry& map_entry, |
| bool must_be_listening_for_commit); |
| + void NotifyGoogleURLUpdated(GURL old_url, GURL new_url) { |
| + callback_list_.Notify(old_url, new_url); |
|
Peter Kasting
2014/05/15 21:12:52
Again, define this out-of-line.
blundell
2014/05/16 09:09:55
Done.
|
| + } |
| + |
| + base::CallbackList<void(GURL, GURL)> callback_list_; |
|
Peter Kasting
2014/05/15 21:12:52
Nit: Consider a typedef for this type and/or base:
blundell
2014/05/16 09:09:55
Done.
|
| + |
| Profile* profile_; |
| scoped_ptr<GoogleURLTrackerNavigationHelper> nav_helper_; |