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

Unified Diff: chrome/browser/chromeos/login/profile_auth_data.cc

Issue 2103863003: Make CanonicalCookie::Source() private. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@source
Patch Set: Cleanup Created 4 years, 5 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
Index: chrome/browser/chromeos/login/profile_auth_data.cc
diff --git a/chrome/browser/chromeos/login/profile_auth_data.cc b/chrome/browser/chromeos/login/profile_auth_data.cc
index 41adacf67ac0ef053d7c23407235f530d427b4af..bee001ef2c0ae975aa1f91caa7b50e28a54ea677 100644
--- a/chrome/browser/chromeos/login/profile_auth_data.cc
+++ b/chrome/browser/chromeos/login/profile_auth_data.cc
@@ -44,16 +44,28 @@ void ImportCookies(const net::CookieList& cookies,
// To re-create the original cookie, a domain should only be passed in to
// SetCookieWithDetailsAsync if cookie.Domain() has a leading period, to
// re-create the original cookie.
- std::string domain;
- if (!cookie.Domain().empty() && cookie.Domain()[0] == '.')
- domain = cookie.Domain();
+ std::string effective_domain = cookie.Domain();
achuithb 2016/07/13 09:18:31 Could we add a unit test for this?
mmenke 2016/07/14 17:34:57 The no-dot path was already being tested. Added a
+ std::string host;
+ if (effective_domain.length() > 1 && effective_domain[0] == '.') {
+ host = effective_domain.substr(1);
+ } else {
+ host = effective_domain;
+ effective_domain = "";
+ }
+
+ // Assume HTTPS - since the cookies are being restored from another store,
+ // they have already gone through the strict secure check.
+ GURL url(std::string(url::kHttpsScheme) + url::kStandardSchemeSeparator +
+ host + "/");
cookie_store->SetCookieWithDetailsAsync(
- cookie.Source(), cookie.Name(), cookie.Value(), domain, cookie.Path(),
+ url, cookie.Name(), cookie.Value(), effective_domain, cookie.Path(),
cookie.CreationDate(), cookie.ExpiryDate(), cookie.LastAccessDate(),
cookie.IsSecure(), cookie.IsHttpOnly(), cookie.SameSite(),
// enforce_strict_secure should have been applied on the original
- // cookie, prior to import.
+ // cookie, prior to import. This allows URL to be treated as an HTTP
Mike West 2016/07/13 09:59:26 Nit: "... to be treated as an _HTTPS_ URL"?
mmenke 2016/07/14 17:34:57 Done
+ // URL, whether the cookie was set by an HTTP or HTTPS domain (Something
+ // that can't be determined by just looking at the CanonicalCookie).
false, cookie.Priority(), net::CookieStore::SetCookiesCallback());
}
}

Powered by Google App Engine
This is Rietveld 408576698