Chromium Code Reviews| Index: components/signin/core/browser/signin_header_helper.cc |
| diff --git a/components/signin/core/browser/signin_header_helper.cc b/components/signin/core/browser/signin_header_helper.cc |
| index a7576c88df96d3e7a4bbe224eff0fe6468eb82e4..1f4f5f72df406f644b43d99e339f44e5c970e6ec 100644 |
| --- a/components/signin/core/browser/signin_header_helper.cc |
| +++ b/components/signin/core/browser/signin_header_helper.cc |
| @@ -18,6 +18,7 @@ |
| #include "google_apis/gaia/gaia_auth_util.h" |
| #include "google_apis/gaia/gaia_urls.h" |
| #include "net/base/escape.h" |
| +#include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| #include "net/http/http_response_headers.h" |
| #include "net/url_request/url_request.h" |
| #include "url/gurl.h" |
| @@ -49,7 +50,7 @@ bool IsDriveOrigin(const GURL& url) { |
| bool IsUrlEligibleToIncludeGaiaId(const GURL& url, bool is_header_request) { |
| if (is_header_request) { |
| // GAIA Id is only necessary for Drive. Don't set it otherwise. |
| - return IsDriveOrigin(url); |
| + return IsDriveOrigin(url.GetOrigin()); |
| } |
| // Cookie requests don't have the granularity to only include the GAIA Id for |
| @@ -57,8 +58,9 @@ bool IsUrlEligibleToIncludeGaiaId(const GURL& url, bool is_header_request) { |
| if (!url.SchemeIsCryptographic()) |
| return false; |
| - const GURL kGoogleDotComURL("https://google.com"); |
| - return url == kGoogleDotComURL; |
| + std::string domain = net::registry_controlled_domains::GetDomainAndRegistry( |
| + url, net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
| + return domain == "google.com"; |
|
Roger Tawa OOO till Jul 10th
2016/09/20 15:07:56
Nit: instead of hardcoding the string, should we i
bzanotti
2016/09/21 13:44:44
The domain is not the same thing as the origin, I
|
| } |
| // Determines the service type that has been passed from GAIA in the header. |
| @@ -121,7 +123,7 @@ std::string BuildMirrorRequestIfPossible( |
| std::vector<std::string> parts; |
| if (IsUrlEligibleToIncludeGaiaId(url, is_header_request)) { |
| - // Only google.com requires the GAIA ID, don't send it to other domains. |
| + // Only set the GAIA Id on domains that actually requires it. |
| parts.push_back( |
| base::StringPrintf("%s=%s", kGaiaIdAttrName, account_id.c_str())); |
| } |