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/proximity_auth_facade.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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 screenlock_state_handler_->MaybeShowHardlockUI(); | 440 screenlock_state_handler_->MaybeShowHardlockUI(); |
440 } | 441 } |
441 } | 442 } |
442 | 443 |
443 EasyUnlockScreenlockStateHandler* | 444 EasyUnlockScreenlockStateHandler* |
444 EasyUnlockService::GetScreenlockStateHandler() { | 445 EasyUnlockService::GetScreenlockStateHandler() { |
445 if (!IsAllowed()) | 446 if (!IsAllowed()) |
446 return NULL; | 447 return NULL; |
447 if (!screenlock_state_handler_) { | 448 if (!screenlock_state_handler_) { |
448 screenlock_state_handler_.reset(new EasyUnlockScreenlockStateHandler( | 449 screenlock_state_handler_.reset(new EasyUnlockScreenlockStateHandler( |
449 GetUserEmail(), | 450 GetUserEmail(), GetHardlockState(), GetScreenlockBridgeInstance())); |
450 GetHardlockState(), | |
451 ScreenlockBridge::Get())); | |
452 } | 451 } |
453 return screenlock_state_handler_.get(); | 452 return screenlock_state_handler_.get(); |
454 } | 453 } |
455 | 454 |
456 bool EasyUnlockService::UpdateScreenlockState( | 455 bool EasyUnlockService::UpdateScreenlockState( |
457 EasyUnlockScreenlockStateHandler::State state) { | 456 EasyUnlockScreenlockStateHandler::State state) { |
458 EasyUnlockScreenlockStateHandler* handler = GetScreenlockStateHandler(); | 457 EasyUnlockScreenlockStateHandler* handler = GetScreenlockStateHandler(); |
459 if (!handler) | 458 if (!handler) |
460 return false; | 459 return false; |
461 | 460 |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 | 859 |
861 // TODO(tbarzic): Set check_private_key only if previous sign-in attempt | 860 // TODO(tbarzic): Set check_private_key only if previous sign-in attempt |
862 // failed. | 861 // failed. |
863 EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile_) | 862 EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile_) |
864 ->PrepareTpmKey(true /* check_private_key */, | 863 ->PrepareTpmKey(true /* check_private_key */, |
865 base::Closure()); | 864 base::Closure()); |
866 #endif // defined(OS_CHROMEOS) | 865 #endif // defined(OS_CHROMEOS) |
867 | 866 |
868 tpm_key_checked_ = true; | 867 tpm_key_checked_ = true; |
869 } | 868 } |
OLD | NEW |