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/signin/easy_unlock_service.h" | 5 #include "chrome/browser/signin/easy_unlock_service.h" |
6 | 6 |
7 #include "apps/app_lifetime_monitor.h" | 7 #include "apps/app_lifetime_monitor.h" |
8 #include "apps/app_lifetime_monitor_factory.h" | 8 #include "apps/app_lifetime_monitor_factory.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/guid.h" | 11 #include "base/guid.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
14 #include "base/prefs/pref_registry_simple.h" | 14 #include "base/prefs/pref_registry_simple.h" |
15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
16 #include "base/prefs/scoped_user_pref_update.h" | 16 #include "base/prefs/scoped_user_pref_update.h" |
17 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/signin/easy_unlock_app_manager.h" | 22 #include "chrome/browser/signin/easy_unlock_app_manager.h" |
23 #include "chrome/browser/signin/easy_unlock_service_factory.h" | 23 #include "chrome/browser/signin/easy_unlock_service_factory.h" |
24 #include "chrome/browser/signin/easy_unlock_service_observer.h" | 24 #include "chrome/browser/signin/easy_unlock_service_observer.h" |
25 #include "chrome/browser/signin/screenlock_bridge.h" | 25 #include "chrome/browser/signin/easy_unlock_util.h" |
26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/extensions/extension_constants.h" | 27 #include "chrome/common/extensions/extension_constants.h" |
28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
29 #include "components/pref_registry/pref_registry_syncable.h" | 29 #include "components/pref_registry/pref_registry_syncable.h" |
30 #include "components/proximity_auth/ble/proximity_auth_ble_system.h" | 30 #include "components/proximity_auth/ble/proximity_auth_ble_system.h" |
| 31 #include "components/proximity_auth/screenlock_bridge.h" |
31 #include "components/proximity_auth/switches.h" | 32 #include "components/proximity_auth/switches.h" |
32 #include "components/user_manager/user.h" | 33 #include "components/user_manager/user.h" |
33 #include "device/bluetooth/bluetooth_adapter.h" | 34 #include "device/bluetooth/bluetooth_adapter.h" |
34 #include "device/bluetooth/bluetooth_adapter_factory.h" | 35 #include "device/bluetooth/bluetooth_adapter_factory.h" |
35 | 36 |
36 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
37 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" | 38 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" |
38 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.
h" | 39 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.
h" |
39 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager_
factory.h" | 40 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager_
factory.h" |
40 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 41 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 screenlock_state_handler_->MaybeShowHardlockUI(); | 448 screenlock_state_handler_->MaybeShowHardlockUI(); |
448 } | 449 } |
449 } | 450 } |
450 | 451 |
451 EasyUnlockScreenlockStateHandler* | 452 EasyUnlockScreenlockStateHandler* |
452 EasyUnlockService::GetScreenlockStateHandler() { | 453 EasyUnlockService::GetScreenlockStateHandler() { |
453 if (!IsAllowed()) | 454 if (!IsAllowed()) |
454 return NULL; | 455 return NULL; |
455 if (!screenlock_state_handler_) { | 456 if (!screenlock_state_handler_) { |
456 screenlock_state_handler_.reset(new EasyUnlockScreenlockStateHandler( | 457 screenlock_state_handler_.reset(new EasyUnlockScreenlockStateHandler( |
457 GetUserEmail(), | 458 GetUserEmail(), GetHardlockState(), GetScreenlockBridgeInstance())); |
458 GetHardlockState(), | |
459 ScreenlockBridge::Get())); | |
460 } | 459 } |
461 return screenlock_state_handler_.get(); | 460 return screenlock_state_handler_.get(); |
462 } | 461 } |
463 | 462 |
464 bool EasyUnlockService::UpdateScreenlockState( | 463 bool EasyUnlockService::UpdateScreenlockState( |
465 EasyUnlockScreenlockStateHandler::State state) { | 464 EasyUnlockScreenlockStateHandler::State state) { |
466 EasyUnlockScreenlockStateHandler* handler = GetScreenlockStateHandler(); | 465 EasyUnlockScreenlockStateHandler* handler = GetScreenlockStateHandler(); |
467 if (!handler) | 466 if (!handler) |
468 return false; | 467 return false; |
469 | 468 |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 | 867 |
869 // TODO(tbarzic): Set check_private_key only if previous sign-in attempt | 868 // TODO(tbarzic): Set check_private_key only if previous sign-in attempt |
870 // failed. | 869 // failed. |
871 EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile_) | 870 EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile_) |
872 ->PrepareTpmKey(true /* check_private_key */, | 871 ->PrepareTpmKey(true /* check_private_key */, |
873 base::Closure()); | 872 base::Closure()); |
874 #endif // defined(OS_CHROMEOS) | 873 #endif // defined(OS_CHROMEOS) |
875 | 874 |
876 tpm_key_checked_ = true; | 875 tpm_key_checked_ = true; |
877 } | 876 } |
OLD | NEW |