| Index: chrome/browser/google/google_util.cc
|
| diff --git a/chrome/browser/google/google_util.cc b/chrome/browser/google/google_util.cc
|
| index 4f7b0301e5a8ae992c9aa649e332510188387f90..cfaa7799393a92dddf28b0062e48d0584e43a345 100644
|
| --- a/chrome/browser/google/google_util.cc
|
| +++ b/chrome/browser/google/google_util.cc
|
| @@ -198,15 +198,18 @@ string16 GetSearchTermsFromGoogleSearchURL(const std::string& url) {
|
| return string16();
|
| }
|
|
|
| -bool IsGoogleDomainUrl(const std::string& url, SubdomainPermission permission) {
|
| +bool IsGoogleDomainUrl(const std::string& url,
|
| + SubdomainPermission subdomain_permission,
|
| + PortPermission port_permission) {
|
| GURL original_url(url);
|
| - return original_url.is_valid() && original_url.port().empty() &&
|
| + return original_url.is_valid() &&
|
| + (original_url.port().empty() || port_permission == ALLOW_ALL_PORTS) &&
|
| (original_url.SchemeIs("http") || original_url.SchemeIs("https")) &&
|
| - google_util::IsGoogleHostname(original_url.host(), permission);
|
| + google_util::IsGoogleHostname(original_url.host(), subdomain_permission);
|
| }
|
|
|
| bool IsGoogleHostname(const std::string& host,
|
| - SubdomainPermission permission) {
|
| + SubdomainPermission subdomain_permission) {
|
| size_t tld_length =
|
| net::RegistryControlledDomainService::GetRegistryLength(host, false);
|
| if ((tld_length == 0) || (tld_length == std::string::npos))
|
| @@ -214,7 +217,7 @@ bool IsGoogleHostname(const std::string& host,
|
| std::string host_minus_tld(host, 0, host.length() - tld_length);
|
| if (LowerCaseEqualsASCII(host_minus_tld, "google."))
|
| return true;
|
| - if (permission == ALLOW_SUBDOMAIN)
|
| + if (subdomain_permission == ALLOW_SUBDOMAIN)
|
| return EndsWith(host_minus_tld, ".google.", false);
|
| return LowerCaseEqualsASCII(host_minus_tld, "www.google.");
|
| }
|
| @@ -223,7 +226,7 @@ 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(url, DISALLOW_SUBDOMAIN, ALLOW_STANDARD_PORTS))
|
| return false;
|
|
|
| // Make sure the path is a known home page path.
|
| @@ -240,7 +243,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(url, DISALLOW_SUBDOMAIN, ALLOW_STANDARD_PORTS))
|
| return false;
|
|
|
| // Make sure the path is a known search path.
|
|
|