From c78b1e1619d7e700fce78f29533eba5ee78b0c70 Mon Sep 17 00:00:00 2001 From: "ukai@chromium.org" Date: Fri, 20 Aug 2010 04:21:16 +0000 Subject: Reland r56483 - Monitor network change in GoogleURLTracker It changes to fetch https://www.google.com/searchdomaincheck?format=domain&type=chrome instead of checking http://www.google.com/ redirection. Also show infobar if google domain has been changed to new domain and ask user to switch new domain. Fix Win IO Perf regressions: - GoogleURLTracker::RequestServerCheck() is not called in headless mode (CHROME_HEADLESS=1) nor in Chrome Frame (--chrome-frame). Fix leaks in TestingProfile::CreateRequestContext(): 52562 - Add TestURLFetcher::set_request_context() do nothing, because TestURLFetcher might miss to release core_->request_context_getter_. Fix GoogleURLTracker observer removal DCHECK: 52608 - call RemoveAll(), instead of calling Remove()s BUG=48688,15141,52477,52562,52608 TEST=unit_tests passes Review URL: http://codereview.chromium.org/3171019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56811 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/net/test_url_fetcher_factory.h | 7 +++++++ chrome/common/net/url_fetcher.h | 3 ++- chrome/common/net/url_fetcher_protect.h | 7 ++++++- chrome/common/pref_names.cc | 6 ++++++ chrome/common/pref_names.h | 1 + 5 files changed, 22 insertions(+), 2 deletions(-) (limited to 'chrome/common') diff --git a/chrome/common/net/test_url_fetcher_factory.h b/chrome/common/net/test_url_fetcher_factory.h index 3d86466..e48c0e0 100644 --- a/chrome/common/net/test_url_fetcher_factory.h +++ b/chrome/common/net/test_url_fetcher_factory.h @@ -53,6 +53,13 @@ class TestURLFetcher : public URLFetcher { // Returns the data uploaded on this URLFetcher. const std::string& upload_data() const { return URLFetcher::upload_data(); } + // Overriden to do nothing. URLFetcher implementation add reference + // to request_context_getter in core_, but it might not be released + // because we wouldn't call Core::CancelURLRequest. + // Without this, we'll see leaks of URLRequestContext in test. + virtual void set_requeset_context( + URLRequestContextGetter* request_context_getter) {} + private: const GURL original_url_; diff --git a/chrome/common/net/url_fetcher.h b/chrome/common/net/url_fetcher.h index 79234ca..1a96f91 100644 --- a/chrome/common/net/url_fetcher.h +++ b/chrome/common/net/url_fetcher.h @@ -140,7 +140,8 @@ class URLFetcher { // Set the URLRequestContext on the request. Must be called before the // request is started. - void set_request_context(URLRequestContextGetter* request_context_getter); + virtual void set_request_context( + URLRequestContextGetter* request_context_getter); // If |retry| is false, 5xx responses will be propagated to the observer, // if it is true URLFetcher will automatically re-execute the request, diff --git a/chrome/common/net/url_fetcher_protect.h b/chrome/common/net/url_fetcher_protect.h index 95ecf97..980353c 100644 --- a/chrome/common/net/url_fetcher_protect.h +++ b/chrome/common/net/url_fetcher_protect.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -61,6 +61,11 @@ class URLFetcherProtectEntry { return max_retries_; } + // Sets the max retries. + void SetMaxRetries(int max_retries) { + max_retries_ = max_retries; + } + private: // When a request comes, calculate the release time for it. // Returns the backoff time before sending. diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index bb06e8a..1becd70 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -767,6 +767,12 @@ const char kShouldShowWelcomePage[] = "show-welcome-page"; // correct Google domain/country code for whatever location the user is in. const char kLastKnownGoogleURL[] = "browser.last_known_google_url"; +// String containing the last prompted Google URL to the user. +// If the user is using .x TLD for Google URL and gets prompted about .y TLD +// for Google URL, and says "no", we should leave the search engine set to .x +// but not prompt again until the domain changes away from .y. +const char kLastPromptedGoogleURL[] = "browser.last_prompted_google_url"; + // String containing the last known intranet redirect URL, if any. See // intranet_redirect_detector.h for more information. const char kLastKnownIntranetRedirectOrigin[] = ""; diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 086d63d..1697d53 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -279,6 +279,7 @@ extern const char kShouldUseMinimalFirstRunBubble[]; extern const char kShouldShowWelcomePage[]; extern const char kLastKnownGoogleURL[]; +extern const char kLastPromptedGoogleURL[]; extern const char kLastKnownIntranetRedirectOrigin[]; extern const char kCountryIDAtInstall[]; -- cgit v1.1