OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.h" |
| 6 |
| 7 #include "base/thread_task_runner_handle.h" |
| 8 #include "chrome/browser/chromeos/ownership/owner_settings_service.h" |
| 9 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 10 #include "components/user_manager/user_manager.h" |
| 11 #include "content/public/browser/browser_thread.h" |
| 12 |
| 13 using content::BrowserThread; |
| 14 |
| 15 namespace chromeos { |
| 16 |
| 17 ChromeCryptohomeAuthenticator::ChromeCryptohomeAuthenticator( |
| 18 AuthStatusConsumer* consumer) |
| 19 : CryptohomeAuthenticator(base::ThreadTaskRunnerHandle::Get(), consumer) { |
| 20 } |
| 21 |
| 22 ChromeCryptohomeAuthenticator::~ChromeCryptohomeAuthenticator() { |
| 23 } |
| 24 |
| 25 bool ChromeCryptohomeAuthenticator::IsKnownUser(const UserContext& context) { |
| 26 return user_manager::UserManager::Get()->IsKnownUser(context.GetUserID()); |
| 27 } |
| 28 |
| 29 bool ChromeCryptohomeAuthenticator::IsSafeMode() { |
| 30 bool is_safe_mode = false; |
| 31 CrosSettings::Get()->GetBoolean(kPolicyMissingMitigationMode, &is_safe_mode); |
| 32 return is_safe_mode; |
| 33 } |
| 34 |
| 35 void ChromeCryptohomeAuthenticator::CheckSafeModeOwnership( |
| 36 const UserContext& context, |
| 37 const IsOwnerCallback& callback) { |
| 38 // |IsOwnerForSafeModeAsync| expects logged in state to be |
| 39 // LOGGED_IN_SAFE_MODE. |
| 40 if (LoginState::IsInitialized()) { |
| 41 LoginState::Get()->SetLoggedInState(LoginState::LOGGED_IN_SAFE_MODE, |
| 42 LoginState::LOGGED_IN_USER_NONE); |
| 43 } |
| 44 |
| 45 OwnerSettingsService::IsOwnerForSafeModeAsync( |
| 46 context.GetUserID(), context.GetUserIDHash(), callback); |
| 47 } |
| 48 |
| 49 } // namespace chromeos |
OLD | NEW |