diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-16 23:48:50 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-16 23:48:50 +0000 |
commit | ab1c2c816b1f08b56f539a172f4c0b2e2004168d (patch) | |
tree | 1c7501688e541792cacf76a1824c5736c6f6afbb /chrome/browser/google/google_util.cc | |
parent | aca0c5c993df1bb24b03e50108c0e8574d474928 (diff) | |
download | chromium_src-ab1c2c816b1f08b56f539a172f4c0b2e2004168d.zip chromium_src-ab1c2c816b1f08b56f539a172f4c0b2e2004168d.tar.gz chromium_src-ab1c2c816b1f08b56f539a172f4c0b2e2004168d.tar.bz2 |
Revert 132479 - Transmit a X-Chrome-UMA-Enabled bit to Google domains from clients that have UMA enabled.
BUG=123609
TEST=With UMA enabled (not Chromium), visit www.google.com and ensure that the request header includes X-Chrome-UMA-Enabled with value "1". Also, ensure that unit_tests GoogleUtilTests all pass.
Review URL: http://codereview.chromium.org/10054029
TBR=stevet@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10107009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132488 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/google/google_util.cc')
-rw-r--r-- | chrome/browser/google/google_util.cc | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/chrome/browser/google/google_util.cc b/chrome/browser/google/google_util.cc index 22b17fc..d95b116 100644 --- a/chrome/browser/google/google_util.cc +++ b/chrome/browser/google/google_util.cc @@ -44,6 +44,13 @@ bool HasQueryParameter(const std::string& str) { return false; } +// True if |url| is an HTTP[S] request with host "[www.]google.<TLD>" and no +// explicit port. +bool IsGoogleDomainUrl(const GURL& url) { + return url.is_valid() && (url.SchemeIs("http") || url.SchemeIs("https")) && + url.port().empty() && google_util::IsGoogleHostname(url.host()); +} + } // anonymous namespace namespace google_util { @@ -135,32 +142,21 @@ bool GetReactivationBrand(std::string* brand) { #endif -bool IsGoogleDomainUrl(const std::string& url, SubdomainPermission permission) { - GURL original_url(url); - return original_url.is_valid() && original_url.port().empty() && - (original_url.SchemeIs("http") || original_url.SchemeIs("https")) && - google_util::IsGoogleHostname(original_url.host(), permission); -} - -bool IsGoogleHostname(const std::string& host, - SubdomainPermission permission) { +bool IsGoogleHostname(const std::string& host) { size_t tld_length = net::RegistryControlledDomainService::GetRegistryLength(host, false); if ((tld_length == 0) || (tld_length == std::string::npos)) return false; std::string host_minus_tld(host, 0, host.length() - tld_length); - if (LowerCaseEqualsASCII(host_minus_tld, "google.")) - return true; - if (permission == ALLOW_SUBDOMAIN) - return EndsWith(host_minus_tld, ".google.", false); - return LowerCaseEqualsASCII(host_minus_tld, "www.google."); + return LowerCaseEqualsASCII(host_minus_tld, "www.google.") || + LowerCaseEqualsASCII(host_minus_tld, "google."); } bool IsGoogleHomePageUrl(const std::string& url) { GURL original_url(url); // First check to see if this has a Google domain. - if (!IsGoogleDomainUrl(url, DISALLOW_SUBDOMAIN)) + if (!IsGoogleDomainUrl(original_url)) return false; // Make sure the path is a known home page path. @@ -177,7 +173,7 @@ bool IsGoogleSearchUrl(const std::string& url) { GURL original_url(url); // First check to see if this has a Google domain. - if (!IsGoogleDomainUrl(url, DISALLOW_SUBDOMAIN)) + if (!IsGoogleDomainUrl(original_url)) return false; // Make sure the path is a known search path. |