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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 } | 130 } |
131 return base::JoinString(results, ","); | 131 return base::JoinString(results, ","); |
132 } | 132 } |
133 | 133 |
134 void GaiaCookieManagerService::ExternalCcResultFetcher::Start() { | 134 void GaiaCookieManagerService::ExternalCcResultFetcher::Start() { |
135 DCHECK(!helper_->external_cc_result_fetched_); | 135 DCHECK(!helper_->external_cc_result_fetched_); |
136 m_external_cc_result_start_time_ = base::Time::Now(); | 136 m_external_cc_result_start_time_ = base::Time::Now(); |
137 | 137 |
138 CleanupTransientState(); | 138 CleanupTransientState(); |
139 results_.clear(); | 139 results_.clear(); |
140 helper_->gaia_auth_fetcher_.reset( | 140 helper_->gaia_auth_fetcher_ = helper_->signin_client_->CreateGaiaAuthFetcher( |
141 helper_->signin_client_->CreateGaiaAuthFetcher( | 141 this, helper_->GetDefaultSourceForRequest(), helper_->request_context()); |
142 this, helper_->GetDefaultSourceForRequest(), | |
143 helper_->request_context())); | |
144 helper_->gaia_auth_fetcher_->StartGetCheckConnectionInfo(); | 142 helper_->gaia_auth_fetcher_->StartGetCheckConnectionInfo(); |
145 | 143 |
146 // Some fetches may timeout. Start a timer to decide when the result fetcher | 144 // Some fetches may timeout. Start a timer to decide when the result fetcher |
147 // has waited long enough. | 145 // has waited long enough. |
148 // TODO(rogerta): I have no idea how long to wait before timing out. | 146 // TODO(rogerta): I have no idea how long to wait before timing out. |
149 // Gaia folks say this should take no more than 2 second even in mobile. | 147 // Gaia folks say this should take no more than 2 second even in mobile. |
150 // This will need to be tweaked. | 148 // This will need to be tweaked. |
151 timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), this, | 149 timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), this, |
152 &GaiaCookieManagerService::ExternalCcResultFetcher::Timeout); | 150 &GaiaCookieManagerService::ExternalCcResultFetcher::Timeout); |
153 } | 151 } |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 if (access_token_.empty()) { | 749 if (access_token_.empty()) { |
752 uber_token_fetcher_->StartFetchingToken(requests_.front().account_id()); | 750 uber_token_fetcher_->StartFetchingToken(requests_.front().account_id()); |
753 } else { | 751 } else { |
754 uber_token_fetcher_->StartFetchingTokenWithAccessToken( | 752 uber_token_fetcher_->StartFetchingTokenWithAccessToken( |
755 requests_.front().account_id(), access_token_); | 753 requests_.front().account_id(), access_token_); |
756 } | 754 } |
757 } | 755 } |
758 | 756 |
759 void GaiaCookieManagerService::StartFetchingMergeSession() { | 757 void GaiaCookieManagerService::StartFetchingMergeSession() { |
760 DCHECK(!uber_token_.empty()); | 758 DCHECK(!uber_token_.empty()); |
761 gaia_auth_fetcher_.reset(signin_client_->CreateGaiaAuthFetcher( | 759 gaia_auth_fetcher_ = signin_client_->CreateGaiaAuthFetcher( |
762 this, GetSourceForRequest(requests_.front()), | 760 this, GetSourceForRequest(requests_.front()), |
763 signin_client_->GetURLRequestContext())); | 761 signin_client_->GetURLRequestContext()); |
764 | 762 |
765 gaia_auth_fetcher_->StartMergeSession(uber_token_, | 763 gaia_auth_fetcher_->StartMergeSession(uber_token_, |
766 external_cc_result_fetcher_.GetExternalCcResult()); | 764 external_cc_result_fetcher_.GetExternalCcResult()); |
767 } | 765 } |
768 | 766 |
769 void GaiaCookieManagerService::StartFetchingLogOut() { | 767 void GaiaCookieManagerService::StartFetchingLogOut() { |
770 DCHECK(requests_.front().request_type() == GaiaCookieRequestType::LOG_OUT); | 768 DCHECK(requests_.front().request_type() == GaiaCookieRequestType::LOG_OUT); |
771 VLOG(1) << "GaiaCookieManagerService::StartFetchingLogOut"; | 769 VLOG(1) << "GaiaCookieManagerService::StartFetchingLogOut"; |
772 gaia_auth_fetcher_.reset(signin_client_->CreateGaiaAuthFetcher( | 770 gaia_auth_fetcher_ = signin_client_->CreateGaiaAuthFetcher( |
773 this, GetSourceForRequest(requests_.front()), | 771 this, GetSourceForRequest(requests_.front()), |
774 signin_client_->GetURLRequestContext())); | 772 signin_client_->GetURLRequestContext()); |
775 gaia_auth_fetcher_->StartLogOut(); | 773 gaia_auth_fetcher_->StartLogOut(); |
776 } | 774 } |
777 | 775 |
778 void GaiaCookieManagerService::StartFetchingListAccounts() { | 776 void GaiaCookieManagerService::StartFetchingListAccounts() { |
779 VLOG(1) << "GaiaCookieManagerService::ListAccounts"; | 777 VLOG(1) << "GaiaCookieManagerService::ListAccounts"; |
780 | 778 |
781 gaia_auth_fetcher_.reset(signin_client_->CreateGaiaAuthFetcher( | 779 gaia_auth_fetcher_ = signin_client_->CreateGaiaAuthFetcher( |
782 this, GetSourceForRequest(requests_.front()), | 780 this, GetSourceForRequest(requests_.front()), |
783 signin_client_->GetURLRequestContext())); | 781 signin_client_->GetURLRequestContext()); |
784 gaia_auth_fetcher_->StartListAccounts(); | 782 gaia_auth_fetcher_->StartListAccounts(); |
785 } | 783 } |
786 | 784 |
787 void GaiaCookieManagerService::HandleNextRequest() { | 785 void GaiaCookieManagerService::HandleNextRequest() { |
788 VLOG(1) << "GaiaCookieManagerService::HandleNextRequest"; | 786 VLOG(1) << "GaiaCookieManagerService::HandleNextRequest"; |
789 if (requests_.front().request_type() == | 787 if (requests_.front().request_type() == |
790 GaiaCookieRequestType::LIST_ACCOUNTS) { | 788 GaiaCookieRequestType::LIST_ACCOUNTS) { |
791 // This and any directly subsequent list accounts would return the same. | 789 // This and any directly subsequent list accounts would return the same. |
792 while (!requests_.empty() && requests_.front().request_type() == | 790 while (!requests_.empty() && requests_.front().request_type() == |
793 GaiaCookieRequestType::LIST_ACCOUNTS) { | 791 GaiaCookieRequestType::LIST_ACCOUNTS) { |
(...skipping 24 matching lines...) Expand all Loading... |
818 break; | 816 break; |
819 case GaiaCookieRequestType::LIST_ACCOUNTS: | 817 case GaiaCookieRequestType::LIST_ACCOUNTS: |
820 uber_token_fetcher_.reset(); | 818 uber_token_fetcher_.reset(); |
821 signin_client_->DelayNetworkCall( | 819 signin_client_->DelayNetworkCall( |
822 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, | 820 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, |
823 base::Unretained(this))); | 821 base::Unretained(this))); |
824 break; | 822 break; |
825 } | 823 } |
826 } | 824 } |
827 } | 825 } |
OLD | NEW |