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 "chrome/browser/chromeos/login/signin/oauth2_login_verifier.h" | 5 #include "chrome/browser/chromeos/login/signin/oauth2_login_verifier.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 OAuth2LoginVerifier::~OAuth2LoginVerifier() { | 63 OAuth2LoginVerifier::~OAuth2LoginVerifier() { |
64 } | 64 } |
65 | 65 |
66 void OAuth2LoginVerifier::VerifyUserCookies(Profile* profile) { | 66 void OAuth2LoginVerifier::VerifyUserCookies(Profile* profile) { |
67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
68 | 68 |
69 // Delay the verification if the network is not connected or on a captive | 69 // Delay the verification if the network is not connected or on a captive |
70 // portal. | 70 // portal. |
71 DelayNetworkCall( | 71 DelayNetworkCall( |
| 72 base::TimeDelta::FromMilliseconds(kRequestRestartDelay), |
72 base::Bind(&OAuth2LoginVerifier::StartAuthCookiesVerification, | 73 base::Bind(&OAuth2LoginVerifier::StartAuthCookiesVerification, |
73 AsWeakPtr()), | 74 AsWeakPtr())); |
74 base::TimeDelta::FromMilliseconds(kRequestRestartDelay)); | |
75 } | 75 } |
76 | 76 |
77 void OAuth2LoginVerifier::VerifyProfileTokens(Profile* profile) { | 77 void OAuth2LoginVerifier::VerifyProfileTokens(Profile* profile) { |
78 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 78 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
79 | 79 |
80 // Delay the verification if the network is not connected or on a captive | 80 // Delay the verification if the network is not connected or on a captive |
81 // portal. | 81 // portal. |
82 DelayNetworkCall( | 82 DelayNetworkCall(base::TimeDelta::FromMilliseconds(kRequestRestartDelay), |
83 base::Bind( | 83 base::Bind(&OAuth2LoginVerifier::VerifyProfileTokensImpl, |
84 &OAuth2LoginVerifier::VerifyProfileTokensImpl, AsWeakPtr(), profile), | 84 AsWeakPtr(), profile)); |
85 base::TimeDelta::FromMilliseconds(kRequestRestartDelay)); | |
86 } | 85 } |
87 | 86 |
88 void OAuth2LoginVerifier::VerifyProfileTokensImpl(Profile* profile) { | 87 void OAuth2LoginVerifier::VerifyProfileTokensImpl(Profile* profile) { |
89 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 88 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
90 | 89 |
91 gaia_token_.clear(); | 90 gaia_token_.clear(); |
92 if (access_token_.empty()) { | 91 if (access_token_.empty()) { |
93 // Fetch /OAuthLogin scoped access token. | 92 // Fetch /OAuthLogin scoped access token. |
94 StartFetchingOAuthLoginAccessToken(profile); | 93 StartFetchingOAuthLoginAccessToken(profile); |
95 } else { | 94 } else { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 << operation_id; | 262 << operation_id; |
264 UMA_HISTOGRAM_ENUMERATION( | 263 UMA_HISTOGRAM_ENUMERATION( |
265 base::StringPrintf("OAuth2Login.%sFailure", operation_id), | 264 base::StringPrintf("OAuth2Login.%sFailure", operation_id), |
266 error.state(), | 265 error.state(), |
267 GoogleServiceAuthError::NUM_STATES); | 266 GoogleServiceAuthError::NUM_STATES); |
268 | 267 |
269 error_handler.Run(IsConnectionOrServiceError(error)); | 268 error_handler.Run(IsConnectionOrServiceError(error)); |
270 } | 269 } |
271 | 270 |
272 } // namespace chromeos | 271 } // namespace chromeos |
OLD | NEW |