| Index: chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.cc
|
| diff --git a/chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.cc b/chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ac7694a0adf5a4a63276651c4d3787140a472e45
|
| --- /dev/null
|
| +++ b/chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.cc
|
| @@ -0,0 +1,49 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.h"
|
| +
|
| +#include "base/thread_task_runner_handle.h"
|
| +#include "chrome/browser/chromeos/ownership/owner_settings_service.h"
|
| +#include "chrome/browser/chromeos/settings/cros_settings.h"
|
| +#include "components/user_manager/user_manager.h"
|
| +#include "content/public/browser/browser_thread.h"
|
| +
|
| +using content::BrowserThread;
|
| +
|
| +namespace chromeos {
|
| +
|
| +ChromeCryptohomeAuthenticator::ChromeCryptohomeAuthenticator(
|
| + AuthStatusConsumer* consumer)
|
| + : CryptohomeAuthenticator(base::ThreadTaskRunnerHandle::Get(), consumer) {
|
| +}
|
| +
|
| +ChromeCryptohomeAuthenticator::~ChromeCryptohomeAuthenticator() {
|
| +}
|
| +
|
| +bool ChromeCryptohomeAuthenticator::IsKnownUser(const UserContext& context) {
|
| + return user_manager::UserManager::Get()->IsKnownUser(context.GetUserID());
|
| +}
|
| +
|
| +bool ChromeCryptohomeAuthenticator::IsSafeMode() {
|
| + bool is_safe_mode = false;
|
| + CrosSettings::Get()->GetBoolean(kPolicyMissingMitigationMode, &is_safe_mode);
|
| + return is_safe_mode;
|
| +}
|
| +
|
| +void ChromeCryptohomeAuthenticator::CheckSafeModeOwnership(
|
| + const UserContext& context,
|
| + const IsOwnerCallback& callback) {
|
| + // |IsOwnerForSafeModeAsync| expects logged in state to be
|
| + // LOGGED_IN_SAFE_MODE.
|
| + if (LoginState::IsInitialized()) {
|
| + LoginState::Get()->SetLoggedInState(LoginState::LOGGED_IN_SAFE_MODE,
|
| + LoginState::LOGGED_IN_USER_NONE);
|
| + }
|
| +
|
| + OwnerSettingsService::IsOwnerForSafeModeAsync(
|
| + context.GetUserID(), context.GetUserIDHash(), callback);
|
| +}
|
| +
|
| +} // namespace chromeos
|
|
|