diff options
| author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-09 22:19:53 +0000 |
|---|---|---|
| committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-09 22:19:53 +0000 |
| commit | 5ee3d70fc4586a36b1d56037d806ec7846690f39 (patch) | |
| tree | ae784994992e5718a69ef1bd9c09d171da2d7a64 /chrome/browser/google/google_url_tracker.cc | |
| parent | 75259de307628787d89e40e057d1836257c5b1fb (diff) | |
| download | chromium_src-5ee3d70fc4586a36b1d56037d806ec7846690f39.zip chromium_src-5ee3d70fc4586a36b1d56037d806ec7846690f39.tar.gz chromium_src-5ee3d70fc4586a36b1d56037d806ec7846690f39.tar.bz2 | |
yMerge 143533 - Reorder virtual function overrides in private section to the top of the section instead of randomly in the middle.
TBRing this because it's mechanical and it will reduce the diff on the real change I also have out for review.
BUG=none
TEST=none
TBR=isherman
Review URL: https://chromiumcodereview.appspot.com/10639013
TBR=pkasting@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/branches/1180/src@145759 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/google/google_url_tracker.cc')
| -rw-r--r-- | chrome/browser/google/google_url_tracker.cc | 148 |
1 files changed, 74 insertions, 74 deletions
diff --git a/chrome/browser/google/google_url_tracker.cc b/chrome/browser/google/google_url_tracker.cc index c32e4f4..5124f15 100644 --- a/chrome/browser/google/google_url_tracker.cc +++ b/chrome/browser/google/google_url_tracker.cc @@ -225,80 +225,6 @@ void GoogleURLTracker::GoogleURLSearchCommitted(Profile* profile) { tracker->SearchCommitted(); } -void GoogleURLTracker::AcceptGoogleURL(const GURL& new_google_url, - bool redo_searches) { - UpdatedDetails urls(google_url_, new_google_url); - google_url_ = new_google_url; - PrefService* prefs = profile_->GetPrefs(); - prefs->SetString(prefs::kLastKnownGoogleURL, google_url_.spec()); - prefs->SetString(prefs::kLastPromptedGoogleURL, google_url_.spec()); - content::NotificationService::current()->Notify( - chrome::NOTIFICATION_GOOGLE_URL_UPDATED, - content::Source<Profile>(profile_), - content::Details<UpdatedDetails>(&urls)); - need_to_prompt_ = false; - CloseAllInfoBars(redo_searches); -} - -void GoogleURLTracker::CancelGoogleURL(const GURL& new_google_url) { - profile_->GetPrefs()->SetString(prefs::kLastPromptedGoogleURL, - new_google_url.spec()); - need_to_prompt_ = false; - CloseAllInfoBars(false); -} - -void GoogleURLTracker::InfoBarClosed(const InfoBarTabHelper* infobar_helper) { - InfoBarMap::iterator i(infobar_map_.find(infobar_helper)); - DCHECK(i != infobar_map_.end()); - infobar_map_.erase(i); -} - -void GoogleURLTracker::SetNeedToFetch() { - need_to_fetch_ = true; - StartFetchIfDesirable(); -} - -void GoogleURLTracker::FinishSleep() { - in_startup_sleep_ = false; - StartFetchIfDesirable(); -} - -void GoogleURLTracker::StartFetchIfDesirable() { - // Bail if a fetch isn't appropriate right now. This function will be called - // again each time one of the preconditions changes, so we'll fetch - // immediately once all of them are met. - // - // See comments in header on the class, on RequestServerCheck(), and on the - // various members here for more detail on exactly what the conditions are. - if (in_startup_sleep_ || already_fetched_ || !need_to_fetch_) - return; - - if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kDisableBackgroundNetworking)) - return; - - std::string fetch_url = CommandLine::ForCurrentProcess()-> - GetSwitchValueASCII(switches::kGoogleSearchDomainCheckURL); - if (fetch_url.empty()) - fetch_url = kSearchDomainCheckURL; - - already_fetched_ = true; - fetcher_.reset(content::URLFetcher::Create(fetcher_id_, GURL(fetch_url), - net::URLFetcher::GET, this)); - ++fetcher_id_; - // We don't want this fetch to set new entries in the cache or cookies, lest - // we alarm the user. - fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE | - net::LOAD_DO_NOT_SAVE_COOKIES); - fetcher_->SetRequestContext(profile_->GetRequestContext()); - - // Configure to max_retries at most kMaxRetries times for 5xx errors. - static const int kMaxRetries = 5; - fetcher_->SetMaxRetries(kMaxRetries); - - fetcher_->Start(); -} - void GoogleURLTracker::OnURLFetchComplete(const net::URLFetcher* source) { // Delete the fetcher on this function's exit. scoped_ptr<net::URLFetcher> clean_up_fetcher(fetcher_.release()); @@ -444,6 +370,80 @@ void GoogleURLTracker::Shutdown() { net::NetworkChangeNotifier::RemoveIPAddressObserver(this); } +void GoogleURLTracker::AcceptGoogleURL(const GURL& new_google_url, + bool redo_searches) { + UpdatedDetails urls(google_url_, new_google_url); + google_url_ = new_google_url; + PrefService* prefs = profile_->GetPrefs(); + prefs->SetString(prefs::kLastKnownGoogleURL, google_url_.spec()); + prefs->SetString(prefs::kLastPromptedGoogleURL, google_url_.spec()); + content::NotificationService::current()->Notify( + chrome::NOTIFICATION_GOOGLE_URL_UPDATED, + content::Source<Profile>(profile_), + content::Details<UpdatedDetails>(&urls)); + need_to_prompt_ = false; + CloseAllInfoBars(redo_searches); +} + +void GoogleURLTracker::CancelGoogleURL(const GURL& new_google_url) { + profile_->GetPrefs()->SetString(prefs::kLastPromptedGoogleURL, + new_google_url.spec()); + need_to_prompt_ = false; + CloseAllInfoBars(false); +} + +void GoogleURLTracker::InfoBarClosed(const InfoBarTabHelper* infobar_helper) { + InfoBarMap::iterator i(infobar_map_.find(infobar_helper)); + DCHECK(i != infobar_map_.end()); + infobar_map_.erase(i); +} + +void GoogleURLTracker::SetNeedToFetch() { + need_to_fetch_ = true; + StartFetchIfDesirable(); +} + +void GoogleURLTracker::FinishSleep() { + in_startup_sleep_ = false; + StartFetchIfDesirable(); +} + +void GoogleURLTracker::StartFetchIfDesirable() { + // Bail if a fetch isn't appropriate right now. This function will be called + // again each time one of the preconditions changes, so we'll fetch + // immediately once all of them are met. + // + // See comments in header on the class, on RequestServerCheck(), and on the + // various members here for more detail on exactly what the conditions are. + if (in_startup_sleep_ || already_fetched_ || !need_to_fetch_) + return; + + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDisableBackgroundNetworking)) + return; + + std::string fetch_url = CommandLine::ForCurrentProcess()-> + GetSwitchValueASCII(switches::kGoogleSearchDomainCheckURL); + if (fetch_url.empty()) + fetch_url = kSearchDomainCheckURL; + + already_fetched_ = true; + fetcher_.reset(content::URLFetcher::Create(fetcher_id_, GURL(fetch_url), + net::URLFetcher::GET, this)); + ++fetcher_id_; + // We don't want this fetch to set new entries in the cache or cookies, lest + // we alarm the user. + fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE | + net::LOAD_DO_NOT_SAVE_COOKIES); + fetcher_->SetRequestContext(profile_->GetRequestContext()); + + // Configure to max_retries at most kMaxRetries times for 5xx errors. + static const int kMaxRetries = 5; + fetcher_->SetMaxRetries(kMaxRetries); + + fetcher_->Start(); +} + void GoogleURLTracker::SearchCommitted() { if (need_to_prompt_) { // This notification will fire a bit later in the same call chain we're |
