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

Side by Side Diff: chrome/browser/google/google_url_tracker.cc

Issue 10458077: When the Google base URL changes and causes keyword updates, save those to the database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 // static 221 // static
222 void GoogleURLTracker::GoogleURLSearchCommitted(Profile* profile) { 222 void GoogleURLTracker::GoogleURLSearchCommitted(Profile* profile) {
223 GoogleURLTracker* tracker = GoogleURLTrackerFactory::GetForProfile(profile); 223 GoogleURLTracker* tracker = GoogleURLTrackerFactory::GetForProfile(profile);
224 if (tracker) 224 if (tracker)
225 tracker->SearchCommitted(); 225 tracker->SearchCommitted();
226 } 226 }
227 227
228 void GoogleURLTracker::AcceptGoogleURL(const GURL& new_google_url, 228 void GoogleURLTracker::AcceptGoogleURL(const GURL& new_google_url,
229 bool redo_searches) { 229 bool redo_searches) {
230 UpdatedDetails urls(google_url_, new_google_url);
230 google_url_ = new_google_url; 231 google_url_ = new_google_url;
231 PrefService* prefs = profile_->GetPrefs(); 232 PrefService* prefs = profile_->GetPrefs();
232 prefs->SetString(prefs::kLastKnownGoogleURL, google_url_.spec()); 233 prefs->SetString(prefs::kLastKnownGoogleURL, google_url_.spec());
233 prefs->SetString(prefs::kLastPromptedGoogleURL, google_url_.spec()); 234 prefs->SetString(prefs::kLastPromptedGoogleURL, google_url_.spec());
234 content::NotificationService::current()->Notify( 235 content::NotificationService::current()->Notify(
235 chrome::NOTIFICATION_GOOGLE_URL_UPDATED, 236 chrome::NOTIFICATION_GOOGLE_URL_UPDATED,
236 content::Source<Profile>(profile_), 237 content::Source<Profile>(profile_),
237 content::Details<const GURL>(&new_google_url)); 238 content::Details<UpdatedDetails>(&urls));
238 need_to_prompt_ = false; 239 need_to_prompt_ = false;
239 CloseAllInfoBars(redo_searches); 240 CloseAllInfoBars(redo_searches);
240 } 241 }
241 242
242 void GoogleURLTracker::CancelGoogleURL(const GURL& new_google_url) { 243 void GoogleURLTracker::CancelGoogleURL(const GURL& new_google_url) {
243 profile_->GetPrefs()->SetString(prefs::kLastPromptedGoogleURL, 244 profile_->GetPrefs()->SetString(prefs::kLastPromptedGoogleURL,
244 new_google_url.spec()); 245 new_google_url.spec());
245 need_to_prompt_ = false; 246 need_to_prompt_ = false;
246 CloseAllInfoBars(false); 247 CloseAllInfoBars(false);
247 } 248 }
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 513
513 void GoogleURLTracker::CloseAllInfoBars(bool redo_searches) { 514 void GoogleURLTracker::CloseAllInfoBars(bool redo_searches) {
514 // Close all infobars, whether they've been added to tabs or not. 515 // Close all infobars, whether they've been added to tabs or not.
515 while (!infobar_map_.empty()) 516 while (!infobar_map_.empty())
516 infobar_map_.begin()->second->Close(redo_searches); 517 infobar_map_.begin()->second->Close(redo_searches);
517 518
518 // Any registered listeners for NAV_ENTRY_COMMITTED and TAB_CLOSED are now 519 // Any registered listeners for NAV_ENTRY_COMMITTED and TAB_CLOSED are now
519 // irrelevant as the associated infobars are gone. 520 // irrelevant as the associated infobars are gone.
520 registrar_.RemoveAll(); 521 registrar_.RemoveAll();
521 } 522 }
OLDNEW
« no previous file with comments | « chrome/browser/google/google_url_tracker.h ('k') | chrome/browser/search_engines/search_host_to_urls_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698