summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-10 02:19:37 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-10 02:19:37 +0000
commit8e399af6493c6e2586d61dc092387e4c2d0ead1f (patch)
tree21c3497c41e58f0cef7fb410f59adfec593b3e72
parent6c8238bf866ac46b8b861d6d34675126e119ab8e (diff)
downloadchromium_src-8e399af6493c6e2586d61dc092387e4c2d0ead1f.zip
chromium_src-8e399af6493c6e2586d61dc092387e4c2d0ead1f.tar.gz
chromium_src-8e399af6493c6e2586d61dc092387e4c2d0ead1f.tar.bz2
Merge 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 Review URL: https://chromiumcodereview.appspot.com/10748021 git-svn-id: svn://svn.chromium.org/chrome/branches/1180/src@145827 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/google/google_url_tracker.cc148
-rw-r--r--chrome/browser/google/google_url_tracker.h29
2 files changed, 89 insertions, 88 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
diff --git a/chrome/browser/google/google_url_tracker.h b/chrome/browser/google/google_url_tracker.h
index 50d52fb..96b192a 100644
--- a/chrome/browser/google/google_url_tracker.h
+++ b/chrome/browser/google/google_url_tracker.h
@@ -104,6 +104,21 @@ class GoogleURLTracker : public net::URLFetcherDelegate,
GoogleURLTracker* google_url_tracker,
const GURL& new_google_url);
+ // net::URLFetcherDelegate:
+ virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
+
+ // content::NotificationObserver:
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
+ // NetworkChangeNotifier::IPAddressObserver:
+ virtual void OnIPAddressChanged() OVERRIDE;
+
+ // ProfileKeyedService:
+ virtual void Shutdown() OVERRIDE;
+
+ // Callbacks from GoogleURLTrackerInfoBarDelegate:
void AcceptGoogleURL(const GURL& google_url, bool redo_searches);
void CancelGoogleURL(const GURL& google_url);
void InfoBarClosed(const InfoBarTabHelper* infobar_helper);
@@ -121,20 +136,6 @@ class GoogleURLTracker : public net::URLFetcherDelegate,
// it and can currently do so.
void StartFetchIfDesirable();
- // net::URLFetcherDelegate:
- virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
-
- // content::NotificationObserver:
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
-
- // NetworkChangeNotifier::IPAddressObserver:
- virtual void OnIPAddressChanged() OVERRIDE;
-
- // ProfileKeyedService:
- virtual void Shutdown() OVERRIDE;
-
// Called each time the user performs a search. This checks whether we need
// to prompt the user about a domain change, and if so, starts listening for
// the notifications sent when the actual load is triggered.