| 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 OAuth2TokenService* token_service, | 291 OAuth2TokenService* token_service, |
| 292 const std::string& source, | 292 const std::string& source, |
| 293 SigninClient* signin_client) | 293 SigninClient* signin_client) |
| 294 : token_service_(token_service), | 294 : token_service_(token_service), |
| 295 signin_client_(signin_client), | 295 signin_client_(signin_client), |
| 296 external_cc_result_fetcher_(this), | 296 external_cc_result_fetcher_(this), |
| 297 fetcher_backoff_(&kBackoffPolicy), | 297 fetcher_backoff_(&kBackoffPolicy), |
| 298 fetcher_retries_(0), | 298 fetcher_retries_(0), |
| 299 source_(source), | 299 source_(source), |
| 300 external_cc_result_fetched_(false), | 300 external_cc_result_fetched_(false), |
| 301 list_accounts_stale_(true) { | 301 list_accounts_stale_(true), |
| 302 // |GaiaCookieManagerService| is created as soon as the profle is |
| 303 // initialized so it is acceptable to use of this |
| 304 // |GaiaCookieManagerService| as the time when the profile is loaded. |
| 305 profile_load_time_(base::Time::Now()) { |
| 302 DCHECK(!source_.empty()); | 306 DCHECK(!source_.empty()); |
| 303 } | 307 } |
| 304 | 308 |
| 305 GaiaCookieManagerService::~GaiaCookieManagerService() { | 309 GaiaCookieManagerService::~GaiaCookieManagerService() { |
| 306 CancelAll(); | 310 CancelAll(); |
| 307 DCHECK(requests_.empty()); | 311 DCHECK(requests_.empty()); |
| 308 } | 312 } |
| 309 | 313 |
| 310 void GaiaCookieManagerService::Init() { | 314 void GaiaCookieManagerService::Init() { |
| 311 cookie_changed_subscription_ = signin_client_->AddCookieChangedCallback( | 315 cookie_changed_subscription_ = signin_client_->AddCookieChangedCallback( |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 this, GetSourceForRequest(requests_.front()), | 754 this, GetSourceForRequest(requests_.front()), |
| 751 signin_client_->GetURLRequestContext())); | 755 signin_client_->GetURLRequestContext())); |
| 752 gaia_auth_fetcher_->StartLogOut(); | 756 gaia_auth_fetcher_->StartLogOut(); |
| 753 } | 757 } |
| 754 | 758 |
| 755 void GaiaCookieManagerService::StartFetchingListAccounts() { | 759 void GaiaCookieManagerService::StartFetchingListAccounts() { |
| 756 VLOG(1) << "GaiaCookieManagerService::ListAccounts"; | 760 VLOG(1) << "GaiaCookieManagerService::ListAccounts"; |
| 757 gaia_auth_fetcher_.reset(signin_client_->CreateGaiaAuthFetcher( | 761 gaia_auth_fetcher_.reset(signin_client_->CreateGaiaAuthFetcher( |
| 758 this, GetSourceForRequest(requests_.front()), | 762 this, GetSourceForRequest(requests_.front()), |
| 759 signin_client_->GetURLRequestContext())); | 763 signin_client_->GetURLRequestContext())); |
| 760 gaia_auth_fetcher_->StartListAccounts(); | 764 gaia_auth_fetcher_->StartListAccounts(profile_load_time_); |
| 761 } | 765 } |
| 762 | 766 |
| 763 void GaiaCookieManagerService::HandleNextRequest() { | 767 void GaiaCookieManagerService::HandleNextRequest() { |
| 764 VLOG(1) << "GaiaCookieManagerService::HandleNextRequest"; | 768 VLOG(1) << "GaiaCookieManagerService::HandleNextRequest"; |
| 765 if (requests_.front().request_type() == | 769 if (requests_.front().request_type() == |
| 766 GaiaCookieRequestType::LIST_ACCOUNTS) { | 770 GaiaCookieRequestType::LIST_ACCOUNTS) { |
| 767 // This and any directly subsequent list accounts would return the same. | 771 // This and any directly subsequent list accounts would return the same. |
| 768 while (!requests_.empty() && requests_.front().request_type() == | 772 while (!requests_.empty() && requests_.front().request_type() == |
| 769 GaiaCookieRequestType::LIST_ACCOUNTS) { | 773 GaiaCookieRequestType::LIST_ACCOUNTS) { |
| 770 requests_.pop_front(); | 774 requests_.pop_front(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 794 break; | 798 break; |
| 795 case GaiaCookieRequestType::LIST_ACCOUNTS: | 799 case GaiaCookieRequestType::LIST_ACCOUNTS: |
| 796 uber_token_fetcher_.reset(); | 800 uber_token_fetcher_.reset(); |
| 797 signin_client_->DelayNetworkCall( | 801 signin_client_->DelayNetworkCall( |
| 798 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, | 802 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, |
| 799 base::Unretained(this))); | 803 base::Unretained(this))); |
| 800 break; | 804 break; |
| 801 } | 805 } |
| 802 } | 806 } |
| 803 } | 807 } |
| OLD | NEW |