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

Unified Diff: components/signin/core/browser/signin_header_helper.cc

Issue 2353923003: Fix Mirror header on Drive domains. (Closed)
Patch Set: Created 4 years, 3 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 | « components/signin/core/browser/signin_header_helper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()));
}
« no previous file with comments | « components/signin/core/browser/signin_header_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698