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_manager.h" | 5 #include "chrome/browser/chromeos/login/oauth2_login_manager.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chromeos/login/user_manager.h" | 10 #include "chrome/browser/chromeos/login/user_manager.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 231 |
232 void OAuth2LoginManager::OnSessionMergeSuccess() { | 232 void OAuth2LoginManager::OnSessionMergeSuccess() { |
233 LOG(INFO) << "OAuth2 refresh and/or GAIA token verification succeeded."; | 233 LOG(INFO) << "OAuth2 refresh and/or GAIA token verification succeeded."; |
234 state_ = OAuthLoginManager::SESSION_RESTORE_DONE; | 234 state_ = OAuthLoginManager::SESSION_RESTORE_DONE; |
235 UserManager::Get()->SaveUserOAuthStatus( | 235 UserManager::Get()->SaveUserOAuthStatus( |
236 UserManager::Get()->GetLoggedInUser()->email(), | 236 UserManager::Get()->GetLoggedInUser()->email(), |
237 User::OAUTH2_TOKEN_STATUS_VALID); | 237 User::OAUTH2_TOKEN_STATUS_VALID); |
238 UMA_HISTOGRAM_ENUMERATION("OAuth2Login.SessionRestore", | 238 UMA_HISTOGRAM_ENUMERATION("OAuth2Login.SessionRestore", |
239 SESSION_RESTORE_SUCCESS, | 239 SESSION_RESTORE_SUCCESS, |
240 SESSION_RESTORE_COUNT); | 240 SESSION_RESTORE_COUNT); |
| 241 delegate_->OnCompletedMergeSession(); |
241 } | 242 } |
242 | 243 |
243 void OAuth2LoginManager::OnSessionMergeFailure() { | 244 void OAuth2LoginManager::OnSessionMergeFailure() { |
244 LOG(ERROR) << "OAuth2 refresh and GAIA token verification failed!"; | 245 LOG(ERROR) << "OAuth2 refresh and GAIA token verification failed!"; |
245 state_ = OAuthLoginManager::SESSION_RESTORE_DONE; | 246 state_ = OAuthLoginManager::SESSION_RESTORE_DONE; |
246 UserManager::Get()->SaveUserOAuthStatus( | 247 UserManager::Get()->SaveUserOAuthStatus( |
247 UserManager::Get()->GetLoggedInUser()->email(), | 248 UserManager::Get()->GetLoggedInUser()->email(), |
248 User::OAUTH2_TOKEN_STATUS_INVALID); | 249 User::OAUTH2_TOKEN_STATUS_INVALID); |
249 UMA_HISTOGRAM_ENUMERATION("OAuth2Login.SessionRestore", | 250 UMA_HISTOGRAM_ENUMERATION("OAuth2Login.SessionRestore", |
250 SESSION_RESTORE_MERGE_SESSION_FAILED, | 251 SESSION_RESTORE_MERGE_SESSION_FAILED, |
251 SESSION_RESTORE_COUNT); | 252 SESSION_RESTORE_COUNT); |
| 253 delegate_->OnCompletedMergeSession(); |
252 } | 254 } |
253 | 255 |
254 void OAuth2LoginManager::StartTokenService( | 256 void OAuth2LoginManager::StartTokenService( |
255 const GaiaAuthConsumer::ClientLoginResult& gaia_credentials) { | 257 const GaiaAuthConsumer::ClientLoginResult& gaia_credentials) { |
256 TokenService* token_service = SetupTokenService(); | 258 TokenService* token_service = SetupTokenService(); |
257 token_service->UpdateCredentials(gaia_credentials); | 259 token_service->UpdateCredentials(gaia_credentials); |
258 CompleteAuthentication(); | 260 CompleteAuthentication(); |
259 } | 261 } |
260 | 262 |
261 } // namespace chromeos | 263 } // namespace chromeos |
OLD | NEW |