OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/oauth2_login_verifier.h" | 5 #include "chrome/browser/chromeos/login/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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 const NetworkState* default_network = | 71 const NetworkState* default_network = |
72 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); | 72 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); |
73 NetworkPortalDetector* detector = NetworkPortalDetector::Get(); | 73 NetworkPortalDetector* detector = NetworkPortalDetector::Get(); |
74 if (!default_network || | 74 if (!default_network || |
75 default_network->connection_state() == shill::kStatePortal || | 75 default_network->connection_state() == shill::kStatePortal || |
76 (detector && detector->GetCaptivePortalState(default_network).status != | 76 (detector && detector->GetCaptivePortalState(default_network).status != |
77 NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE)) { | 77 NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE)) { |
78 // If network is offline, defer the token fetching until online. | 78 // If network is offline, defer the token fetching until online. |
79 VLOG(1) << "Network is offline. Deferring OAuth2 access token fetch."; | 79 LOG(WARNING) << "Network is offline. Deferring OAuth2 access token fetch."; |
80 BrowserThread::PostDelayedTask( | 80 BrowserThread::PostDelayedTask( |
81 BrowserThread::UI, | 81 BrowserThread::UI, |
82 FROM_HERE, | 82 FROM_HERE, |
83 base::Bind( | 83 base::Bind( |
84 &OAuth2LoginVerifier::VerifyProfileTokens, AsWeakPtr(), profile), | 84 &OAuth2LoginVerifier::VerifyProfileTokens, AsWeakPtr(), profile), |
85 base::TimeDelta::FromMilliseconds(kRequestRestartDelay)); | 85 base::TimeDelta::FromMilliseconds(kRequestRestartDelay)); |
86 return; | 86 return; |
87 } | 87 } |
88 | 88 |
89 access_token_.clear(); | 89 access_token_.clear(); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 << operation_id; | 253 << operation_id; |
254 UMA_HISTOGRAM_ENUMERATION( | 254 UMA_HISTOGRAM_ENUMERATION( |
255 base::StringPrintf("OAuth2Login.%sFailure", operation_id), | 255 base::StringPrintf("OAuth2Login.%sFailure", operation_id), |
256 error.state(), | 256 error.state(), |
257 GoogleServiceAuthError::NUM_STATES); | 257 GoogleServiceAuthError::NUM_STATES); |
258 | 258 |
259 error_handler.Run(IsConnectionOrServiceError(error)); | 259 error_handler.Run(IsConnectionOrServiceError(error)); |
260 } | 260 } |
261 | 261 |
262 } // namespace chromeos | 262 } // namespace chromeos |
OLD | NEW |