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