OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/google/google_url_tracker.h" | 5 #include "chrome/browser/google/google_url_tracker.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 if (tracker) | 100 if (tracker) |
101 tracker->SearchCommitted(); | 101 tracker->SearchCommitted(); |
102 } | 102 } |
103 | 103 |
104 void GoogleURLTracker::AcceptGoogleURL(bool redo_searches) { | 104 void GoogleURLTracker::AcceptGoogleURL(bool redo_searches) { |
105 UpdatedDetails urls(google_url_, fetched_google_url_); | 105 UpdatedDetails urls(google_url_, fetched_google_url_); |
106 google_url_ = fetched_google_url_; | 106 google_url_ = fetched_google_url_; |
107 PrefService* prefs = profile_->GetPrefs(); | 107 PrefService* prefs = profile_->GetPrefs(); |
108 prefs->SetString(prefs::kLastKnownGoogleURL, google_url_.spec()); | 108 prefs->SetString(prefs::kLastKnownGoogleURL, google_url_.spec()); |
109 prefs->SetString(prefs::kLastPromptedGoogleURL, google_url_.spec()); | 109 prefs->SetString(prefs::kLastPromptedGoogleURL, google_url_.spec()); |
| 110 NotifyGoogleURLUpdated(urls.first, urls.second); |
| 111 |
| 112 // TODO(blundell): Convert all clients to use the callback interface and |
| 113 // eliminate this notification. crbug.com/373237 |
110 content::NotificationService::current()->Notify( | 114 content::NotificationService::current()->Notify( |
111 chrome::NOTIFICATION_GOOGLE_URL_UPDATED, | 115 chrome::NOTIFICATION_GOOGLE_URL_UPDATED, |
112 content::Source<Profile>(profile_), | 116 content::Source<Profile>(profile_), |
113 content::Details<UpdatedDetails>(&urls)); | 117 content::Details<UpdatedDetails>(&urls)); |
114 need_to_prompt_ = false; | 118 need_to_prompt_ = false; |
115 CloseAllEntries(redo_searches); | 119 CloseAllEntries(redo_searches); |
116 } | 120 } |
117 | 121 |
118 void GoogleURLTracker::CancelGoogleURL() { | 122 void GoogleURLTracker::CancelGoogleURL() { |
119 profile_->GetPrefs()->SetString(prefs::kLastPromptedGoogleURL, | 123 profile_->GetPrefs()->SetString(prefs::kLastPromptedGoogleURL, |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 i->second->navigation_controller())) { | 418 i->second->navigation_controller())) { |
415 DCHECK(nav_helper_->IsListeningForNavigationStart()); | 419 DCHECK(nav_helper_->IsListeningForNavigationStart()); |
416 return; | 420 return; |
417 } | 421 } |
418 } | 422 } |
419 if (nav_helper_->IsListeningForNavigationStart()) { | 423 if (nav_helper_->IsListeningForNavigationStart()) { |
420 DCHECK(!search_committed_); | 424 DCHECK(!search_committed_); |
421 nav_helper_->SetListeningForNavigationStart(false); | 425 nav_helper_->SetListeningForNavigationStart(false); |
422 } | 426 } |
423 } | 427 } |
OLD | NEW |