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

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

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 | « chrome/browser/google/google_url_tracker.h ('k') | chrome/browser/search/instant_unittest_base.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.cc
diff --git a/chrome/browser/google/google_url_tracker.cc b/chrome/browser/google/google_url_tracker.cc
index 535cbbaa8ecac4a3a3c9bec030592abe7f3d8783..f0d81ff4a53cbe442d3de99d6375464563ef5d09 100644
--- a/chrome/browser/google/google_url_tracker.cc
+++ b/chrome/browser/google/google_url_tracker.cc
@@ -107,6 +107,10 @@ void GoogleURLTracker::AcceptGoogleURL(bool redo_searches) {
PrefService* prefs = profile_->GetPrefs();
prefs->SetString(prefs::kLastKnownGoogleURL, google_url_.spec());
prefs->SetString(prefs::kLastPromptedGoogleURL, google_url_.spec());
+ NotifyGoogleURLUpdated(urls.first, urls.second);
+
+ // TODO(blundell): Convert all clients to use the callback interface and
+ // eliminate this notification. crbug.com/373237
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_GOOGLE_URL_UPDATED,
content::Source<Profile>(profile_),
@@ -374,6 +378,11 @@ void GoogleURLTracker::OnTabClosed(
NOTREACHED();
}
+scoped_ptr<GoogleURLTracker::Subscription> GoogleURLTracker::RegisterCallback(
+ const OnGoogleURLUpdatedCallback& cb) {
+ return callback_list_.Add(cb);
+}
+
void GoogleURLTracker::CloseAllEntries(bool redo_searches) {
// Delete all entries, whether they have infobars or not.
while (!entry_map_.empty())
@@ -421,3 +430,7 @@ void GoogleURLTracker::UnregisterForEntrySpecificNotifications(
nav_helper_->SetListeningForNavigationStart(false);
}
}
+
+void GoogleURLTracker::NotifyGoogleURLUpdated(GURL old_url, GURL new_url) {
+ callback_list_.Notify(old_url, new_url);
+}
« no previous file with comments | « chrome/browser/google/google_url_tracker.h ('k') | chrome/browser/search/instant_unittest_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698