Commit 94486086 authored by tfarina's avatar tfarina Committed by Commit bot

components/signin: convert GaiaCookieManagerService to use CanonicalCookie's Create() method.

This patch converts the usage of CanonicalCookie's constructor in
GaiaCookieManagerService::ForceOnCookieChangedProcessing() to use
CanonicalCookie::Create() method.

We are doing this because the Create() method validates the parameters
and we thus we can test the return value to see if it has passed or not.
Whereas we can not do this when using the constructor.

BUG=57061
TEST=components_unittests
R=mmenke@chromium.org,rogerta@chromium.org

Review-Url: https://codereview.chromium.org/2113863002
Cr-Commit-Position: refs/heads/master@{#406097}
parent d9a8b381
...@@ -378,11 +378,11 @@ void GaiaCookieManagerService::TriggerListAccounts() { ...@@ -378,11 +378,11 @@ void GaiaCookieManagerService::TriggerListAccounts() {
void GaiaCookieManagerService::ForceOnCookieChangedProcessing() { void GaiaCookieManagerService::ForceOnCookieChangedProcessing() {
GURL google_url = GaiaUrls::GetInstance()->google_url(); GURL google_url = GaiaUrls::GetInstance()->google_url();
net::CanonicalCookie cookie( std::unique_ptr<net::CanonicalCookie> cookie(net::CanonicalCookie::Create(
google_url, kGaiaCookieName, "", google_url.host(), "", base::Time(), google_url, kGaiaCookieName, std::string(), "." + google_url.host(),
base::Time(), base::Time(), false, false, std::string(), base::Time(), base::Time(), false, false,
net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT); net::CookieSameSite::DEFAULT_MODE, false, net::COOKIE_PRIORITY_DEFAULT));
OnCookieChanged(cookie, true); OnCookieChanged(*cookie, true);
} }
void GaiaCookieManagerService::LogOutAllAccounts() { void GaiaCookieManagerService::LogOutAllAccounts() {
...@@ -454,7 +454,7 @@ void GaiaCookieManagerService::OnCookieChanged( ...@@ -454,7 +454,7 @@ void GaiaCookieManagerService::OnCookieChanged(
const net::CanonicalCookie& cookie, const net::CanonicalCookie& cookie,
bool removed) { bool removed) {
DCHECK_EQ(kGaiaCookieName, cookie.Name()); DCHECK_EQ(kGaiaCookieName, cookie.Name());
DCHECK_EQ(GaiaUrls::GetInstance()->google_url().host(), cookie.Domain()); DCHECK(cookie.IsDomainMatch(GaiaUrls::GetInstance()->google_url().host()));
list_accounts_stale_ = true; list_accounts_stale_ = true;
// Ignore changes to the cookie while requests are pending. These changes // Ignore changes to the cookie while requests are pending. These changes
// are caused by the service itself as it adds accounts. A side effects is // are caused by the service itself as it adds accounts. A side effects is
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
namespace { namespace {
// Gaia service constants // Gaia service constants
const char kDefaultGoogleUrl[] = "http://.google.com"; const char kDefaultGoogleUrl[] = "http://google.com";
const char kDefaultGaiaUrl[] = "https://accounts.google.com"; const char kDefaultGaiaUrl[] = "https://accounts.google.com";
const char kDefaultGoogleApisBaseUrl[] = "https://www.googleapis.com"; const char kDefaultGoogleApisBaseUrl[] = "https://www.googleapis.com";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment