OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/signin/core/browser/gaia_cookie_manager_service.h" | 5 #include "components/signin/core/browser/gaia_cookie_manager_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <queue> | 9 #include <queue> |
10 | 10 |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 requests_.push_back(GaiaCookieRequest::CreateListAccountsRequest(source)); | 386 requests_.push_back(GaiaCookieRequest::CreateListAccountsRequest(source)); |
387 } | 387 } |
388 } | 388 } |
389 | 389 |
390 void GaiaCookieManagerService::ForceOnCookieChangedProcessing() { | 390 void GaiaCookieManagerService::ForceOnCookieChangedProcessing() { |
391 GURL google_url = GaiaUrls::GetInstance()->google_url(); | 391 GURL google_url = GaiaUrls::GetInstance()->google_url(); |
392 std::unique_ptr<net::CanonicalCookie> cookie(net::CanonicalCookie::Create( | 392 std::unique_ptr<net::CanonicalCookie> cookie(net::CanonicalCookie::Create( |
393 google_url, kGaiaCookieName, std::string(), "." + google_url.host(), | 393 google_url, kGaiaCookieName, std::string(), "." + google_url.host(), |
394 std::string(), base::Time(), base::Time(), false, false, | 394 std::string(), base::Time(), base::Time(), false, false, |
395 net::CookieSameSite::DEFAULT_MODE, false, net::COOKIE_PRIORITY_DEFAULT)); | 395 net::CookieSameSite::DEFAULT_MODE, false, net::COOKIE_PRIORITY_DEFAULT)); |
396 OnCookieChanged(*cookie, true); | 396 OnCookieChanged(*cookie, net::CookieStore::ChangeCause::UNKNOWN_DELETION); |
397 } | 397 } |
398 | 398 |
399 void GaiaCookieManagerService::LogOutAllAccounts(const std::string& source) { | 399 void GaiaCookieManagerService::LogOutAllAccounts(const std::string& source) { |
400 VLOG(1) << "GaiaCookieManagerService::LogOutAllAccounts"; | 400 VLOG(1) << "GaiaCookieManagerService::LogOutAllAccounts"; |
401 | 401 |
402 bool log_out_queued = false; | 402 bool log_out_queued = false; |
403 if (!requests_.empty()) { | 403 if (!requests_.empty()) { |
404 // Track requests to keep; all other unstarted requests will be removed. | 404 // Track requests to keep; all other unstarted requests will be removed. |
405 std::vector<GaiaCookieRequest> requests_to_keep; | 405 std::vector<GaiaCookieRequest> requests_to_keep; |
406 | 406 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 } | 462 } |
463 | 463 |
464 std::string GaiaCookieManagerService::GetSourceForRequest( | 464 std::string GaiaCookieManagerService::GetSourceForRequest( |
465 const GaiaCookieManagerService::GaiaCookieRequest& request, | 465 const GaiaCookieManagerService::GaiaCookieRequest& request, |
466 const std::string& source_default) { | 466 const std::string& source_default) { |
467 return request.source().empty() ? source_default : request.source(); | 467 return request.source().empty() ? source_default : request.source(); |
468 } | 468 } |
469 | 469 |
470 void GaiaCookieManagerService::OnCookieChanged( | 470 void GaiaCookieManagerService::OnCookieChanged( |
471 const net::CanonicalCookie& cookie, | 471 const net::CanonicalCookie& cookie, |
472 bool removed) { | 472 net::CookieStore::ChangeCause cause) { |
473 DCHECK_EQ(kGaiaCookieName, cookie.Name()); | 473 DCHECK_EQ(kGaiaCookieName, cookie.Name()); |
474 DCHECK(cookie.IsDomainMatch(GaiaUrls::GetInstance()->google_url().host())); | 474 DCHECK(cookie.IsDomainMatch(GaiaUrls::GetInstance()->google_url().host())); |
475 list_accounts_stale_ = true; | 475 list_accounts_stale_ = true; |
476 // Ignore changes to the cookie while requests are pending. These changes | 476 // Ignore changes to the cookie while requests are pending. These changes |
477 // are caused by the service itself as it adds accounts. A side effects is | 477 // are caused by the service itself as it adds accounts. A side effects is |
478 // that any changes to the gaia cookie outside of this class, while requests | 478 // that any changes to the gaia cookie outside of this class, while requests |
479 // are pending, will be lost. However, trying to process these changes could | 479 // are pending, will be lost. However, trying to process these changes could |
480 // cause an endless loop (see crbug.com/516070). | 480 // cause an endless loop (see crbug.com/516070). |
481 if (requests_.empty()) { | 481 if (requests_.empty()) { |
482 requests_.push_back(GaiaCookieRequest::CreateListAccountsRequest(source_)); | 482 requests_.push_back(GaiaCookieRequest::CreateListAccountsRequest(source_)); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 break; | 735 break; |
736 case GaiaCookieRequestType::LIST_ACCOUNTS: | 736 case GaiaCookieRequestType::LIST_ACCOUNTS: |
737 uber_token_fetcher_.reset(); | 737 uber_token_fetcher_.reset(); |
738 signin_client_->DelayNetworkCall( | 738 signin_client_->DelayNetworkCall( |
739 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, | 739 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, |
740 base::Unretained(this))); | 740 base::Unretained(this))); |
741 break; | 741 break; |
742 } | 742 } |
743 } | 743 } |
744 } | 744 } |
OLD | NEW |