| 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/session/user_session_manager.h" | 5 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 enable_layouts, | 500 enable_layouts, |
| 501 false /* login_layouts_only */, | 501 false /* login_layouts_only */, |
| 502 callback.Pass()); | 502 callback.Pass()); |
| 503 | 503 |
| 504 return true; | 504 return true; |
| 505 } | 505 } |
| 506 | 506 |
| 507 bool UserSessionManager::NeedsToUpdateEasyUnlockKeys() const { | 507 bool UserSessionManager::NeedsToUpdateEasyUnlockKeys() const { |
| 508 return EasyUnlockService::IsSignInEnabled() && | 508 return EasyUnlockService::IsSignInEnabled() && |
| 509 !user_context_.GetUserID().empty() && | 509 !user_context_.GetUserID().empty() && |
| 510 user_context_.GetUserType() == user_manager::USER_TYPE_REGULAR && | 510 user_manager::User::TypeIsRegular(user_context_.GetUserType()) && |
| 511 user_context_.GetKey() && !user_context_.GetKey()->GetSecret().empty(); | 511 user_context_.GetKey() && !user_context_.GetKey()->GetSecret().empty(); |
| 512 } | 512 } |
| 513 | 513 |
| 514 bool UserSessionManager::CheckEasyUnlockKeyOps(const base::Closure& callback) { | 514 bool UserSessionManager::CheckEasyUnlockKeyOps(const base::Closure& callback) { |
| 515 if (!running_easy_unlock_key_ops_) | 515 if (!running_easy_unlock_key_ops_) |
| 516 return false; | 516 return false; |
| 517 | 517 |
| 518 // Assumes only one deferred callback is needed. | 518 // Assumes only one deferred callback is needed. |
| 519 DCHECK(easy_unlock_key_ops_finished_callback_.is_null()); | 519 DCHECK(easy_unlock_key_ops_finished_callback_.is_null()); |
| 520 | 520 |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 // timeout. | 1200 // timeout. |
| 1201 // TODO(xiyuan): Revisit this when adding tests. | 1201 // TODO(xiyuan): Revisit this when adding tests. |
| 1202 if (!base::SysInfo::IsRunningOnChromeOS()) | 1202 if (!base::SysInfo::IsRunningOnChromeOS()) |
| 1203 return; | 1203 return; |
| 1204 | 1204 |
| 1205 // Only update Easy unlock keys for regular user. | 1205 // Only update Easy unlock keys for regular user. |
| 1206 // TODO(xiyuan): Fix inconsistency user type of |user_context| introduced in | 1206 // TODO(xiyuan): Fix inconsistency user type of |user_context| introduced in |
| 1207 // authenticator. | 1207 // authenticator. |
| 1208 const user_manager::User* user = | 1208 const user_manager::User* user = |
| 1209 user_manager::UserManager::Get()->FindUser(user_context.GetUserID()); | 1209 user_manager::UserManager::Get()->FindUser(user_context.GetUserID()); |
| 1210 if (!user || user->GetType() != user_manager::USER_TYPE_REGULAR) | 1210 if (!user || !user->IsRegular()) |
| 1211 return; | 1211 return; |
| 1212 | 1212 |
| 1213 // Bail if |user_context| does not have secret. | 1213 // Bail if |user_context| does not have secret. |
| 1214 if (user_context.GetKey()->GetSecret().empty()) | 1214 if (user_context.GetKey()->GetSecret().empty()) |
| 1215 return; | 1215 return; |
| 1216 | 1216 |
| 1217 const base::ListValue* device_list = NULL; | 1217 const base::ListValue* device_list = NULL; |
| 1218 EasyUnlockService* easy_unlock_service = EasyUnlockService::GetForUser(*user); | 1218 EasyUnlockService* easy_unlock_service = EasyUnlockService::GetForUser(*user); |
| 1219 if (easy_unlock_service) { | 1219 if (easy_unlock_service) { |
| 1220 device_list = easy_unlock_service->GetRemoteDevices(); | 1220 device_list = easy_unlock_service->GetRemoteDevices(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 } | 1281 } |
| 1282 | 1282 |
| 1283 EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() { | 1283 EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() { |
| 1284 if (!easy_unlock_key_manager_) | 1284 if (!easy_unlock_key_manager_) |
| 1285 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); | 1285 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); |
| 1286 | 1286 |
| 1287 return easy_unlock_key_manager_.get(); | 1287 return easy_unlock_key_manager_.get(); |
| 1288 } | 1288 } |
| 1289 | 1289 |
| 1290 } // namespace chromeos | 1290 } // namespace chromeos |
| OLD | NEW |