| 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 <queue> | 7 #include <queue> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 uber_token_fetcher_.reset(); | 441 uber_token_fetcher_.reset(); |
| 442 requests_.clear(); | 442 requests_.clear(); |
| 443 fetcher_timer_.Stop(); | 443 fetcher_timer_.Stop(); |
| 444 } | 444 } |
| 445 | 445 |
| 446 void GaiaCookieManagerService::OnCookieChanged( | 446 void GaiaCookieManagerService::OnCookieChanged( |
| 447 const net::CanonicalCookie& cookie, | 447 const net::CanonicalCookie& cookie, |
| 448 bool removed) { | 448 bool removed) { |
| 449 DCHECK_EQ(kGaiaCookieName, cookie.Name()); | 449 DCHECK_EQ(kGaiaCookieName, cookie.Name()); |
| 450 DCHECK_EQ(GaiaUrls::GetInstance()->google_url().host(), cookie.Domain()); | 450 DCHECK_EQ(GaiaUrls::GetInstance()->google_url().host(), cookie.Domain()); |
| 451 list_accounts_stale_ = true; |
| 451 // Ignore changes to the cookie while requests are pending. These changes | 452 // Ignore changes to the cookie while requests are pending. These changes |
| 452 // are caused by the service itself as it adds accounts. A side effects is | 453 // are caused by the service itself as it adds accounts. A side effects is |
| 453 // that any changes to the gaia cookie outside of this class, while requests | 454 // that any changes to the gaia cookie outside of this class, while requests |
| 454 // are pending, will be lost. However, trying to process these changes could | 455 // are pending, will be lost. However, trying to process these changes could |
| 455 // cause an endless loop (see crbug.com/516070). | 456 // cause an endless loop (see crbug.com/516070). |
| 456 if (requests_.empty()) { | 457 if (requests_.empty()) { |
| 457 requests_.push_back(GaiaCookieRequest::CreateListAccountsRequest()); | 458 requests_.push_back(GaiaCookieRequest::CreateListAccountsRequest()); |
| 458 fetcher_retries_ = 0; | 459 fetcher_retries_ = 0; |
| 459 signin_client_->DelayNetworkCall( | 460 signin_client_->DelayNetworkCall( |
| 460 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, | 461 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, |
| 461 base::Unretained(this))); | 462 base::Unretained(this))); |
| 462 } else { | |
| 463 list_accounts_stale_ = true; | |
| 464 } | 463 } |
| 465 } | 464 } |
| 466 | 465 |
| 467 void GaiaCookieManagerService::SignalComplete( | 466 void GaiaCookieManagerService::SignalComplete( |
| 468 const std::string& account_id, | 467 const std::string& account_id, |
| 469 const GoogleServiceAuthError& error) { | 468 const GoogleServiceAuthError& error) { |
| 470 // Its possible for the observer to delete |this| object. Don't access | 469 // Its possible for the observer to delete |this| object. Don't access |
| 471 // access any members after this calling the observer. This method should | 470 // access any members after this calling the observer. This method should |
| 472 // be the last call in any other method. | 471 // be the last call in any other method. |
| 473 FOR_EACH_OBSERVER(Observer, observer_list_, | 472 FOR_EACH_OBSERVER(Observer, observer_list_, |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 break; | 704 break; |
| 706 case GaiaCookieRequestType::LIST_ACCOUNTS: | 705 case GaiaCookieRequestType::LIST_ACCOUNTS: |
| 707 uber_token_fetcher_.reset(); | 706 uber_token_fetcher_.reset(); |
| 708 signin_client_->DelayNetworkCall( | 707 signin_client_->DelayNetworkCall( |
| 709 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, | 708 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, |
| 710 base::Unretained(this))); | 709 base::Unretained(this))); |
| 711 break; | 710 break; |
| 712 }; | 711 }; |
| 713 } | 712 } |
| 714 } | 713 } |
| OLD | NEW |