OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/existing_user_controller.h" | 5 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 if (!success) { | 1234 if (!success) { |
1235 LOG(ERROR) << "OAuth2 token fetch failed."; | 1235 LOG(ERROR) << "OAuth2 token fetch failed."; |
1236 OnAuthFailure(AuthFailure(AuthFailure::FAILED_TO_INITIALIZE_TOKEN)); | 1236 OnAuthFailure(AuthFailure(AuthFailure::FAILED_TO_INITIALIZE_TOKEN)); |
1237 return; | 1237 return; |
1238 } | 1238 } |
1239 if (StartupUtils::IsWebviewSigninEnabled()) { | 1239 if (StartupUtils::IsWebviewSigninEnabled()) { |
1240 if (!token_handle_util_.get()) { | 1240 if (!token_handle_util_.get()) { |
1241 token_handle_util_.reset( | 1241 token_handle_util_.reset( |
1242 new TokenHandleUtil(user_manager::UserManager::Get())); | 1242 new TokenHandleUtil(user_manager::UserManager::Get())); |
1243 } | 1243 } |
1244 if (!token_handle_util_->HasToken(user_context.GetUserID())) { | 1244 if (token_handle_util_->ShouldObtainHandle(user_context.GetUserID())) { |
1245 token_handle_util_->GetTokenHandle( | 1245 token_handle_util_->GetTokenHandle( |
1246 user_context.GetUserID(), user_context.GetAccessToken(), | 1246 user_context.GetUserID(), user_context.GetAccessToken(), |
1247 base::Bind(&ExistingUserController::OnTokenHandleObtained, | 1247 base::Bind(&ExistingUserController::OnTokenHandleObtained, |
1248 weak_factory_.GetWeakPtr())); | 1248 weak_factory_.GetWeakPtr())); |
1249 } | 1249 } |
1250 } | 1250 } |
1251 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); | 1251 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); |
1252 } | 1252 } |
1253 | 1253 |
1254 void ExistingUserController::OnTokenHandleObtained( | 1254 void ExistingUserController::OnTokenHandleObtained( |
1255 const user_manager::UserID& id, | 1255 const user_manager::UserID& id, |
1256 TokenHandleUtil::TokenHandleStatus status) { | 1256 TokenHandleUtil::TokenHandleStatus status) { |
1257 if (status != TokenHandleUtil::VALID) { | 1257 if (status != TokenHandleUtil::VALID) { |
1258 LOG(ERROR) << "OAuth2 token handle fetch failed."; | 1258 LOG(ERROR) << "OAuth2 token handle fetch failed."; |
1259 return; | 1259 return; |
1260 } | 1260 } |
1261 } | 1261 } |
1262 | 1262 |
1263 } // namespace chromeos | 1263 } // namespace chromeos |
OLD | NEW |