Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5504)

Unified Diff: chrome/browser/google/google_util.cc

Issue 10264023: Revert 134625 - Transmit a X-Chrome-UMA-Enabled bit to Google domains from clients that have UMA en… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/google/google_util.h ('k') | chrome/browser/google/google_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/google/google_util.cc
===================================================================
--- chrome/browser/google/google_util.cc (revision 134639)
+++ chrome/browser/google/google_util.cc (working copy)
@@ -44,6 +44,13 @@
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 @@
#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 @@
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.
« no previous file with comments | « chrome/browser/google/google_util.h ('k') | chrome/browser/google/google_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698