summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaren@chromium.org <karen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-10 00:31:37 +0000
committerkaren@chromium.org <karen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-10 00:31:37 +0000
commit813d9e38ca0aa81f067709ce6d471e6df98ef893 (patch)
tree6ff04b03f5c6fa639a23f3dcf7c8edac0b2ea7f3
parent5bfd2b9da50ef216cf207a8c19042884ca6a4783 (diff)
downloadchromium_src-813d9e38ca0aa81f067709ce6d471e6df98ef893.zip
chromium_src-813d9e38ca0aa81f067709ce6d471e6df98ef893.tar.gz
chromium_src-813d9e38ca0aa81f067709ce6d471e6df98ef893.tar.bz2
Revert 145759 - 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 TBR=pkasting@chromium.org Review URL: https://chromiumcodereview.appspot.com/10759014 git-svn-id: svn://svn.chromium.org/chrome/branches/1180/src@145809 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, 88 insertions, 89 deletions
diff --git a/chrome/browser/google/google_url_tracker.cc b/chrome/browser/google/google_url_tracker.cc
index 5124f15..c32e4f4 100644
--- a/chrome/browser/google/google_url_tracker.cc
+++ b/chrome/browser/google/google_url_tracker.cc
@@ -225,6 +225,80 @@ 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());
@@ -370,80 +444,6 @@ 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 96b192a..50d52fb 100644
--- a/chrome/browser/google/google_url_tracker.h
+++ b/chrome/browser/google/google_url_tracker.h
@@ -104,21 +104,6 @@ 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);
@@ -136,6 +121,20 @@ 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.