Index: chrome/browser/signin/easy_unlock_service.cc |
diff --git a/chrome/browser/signin/easy_unlock_service.cc b/chrome/browser/signin/easy_unlock_service.cc |
index 9cc7346dbf026cf75169806212b6a7f398b33776..3e049c0f324b39f07001ff6be1cbd992486d5851 100644 |
--- a/chrome/browser/signin/easy_unlock_service.cc |
+++ b/chrome/browser/signin/easy_unlock_service.cc |
@@ -31,13 +31,12 @@ |
#include "chrome/common/extensions/extension_constants.h" |
#include "chrome/common/pref_names.h" |
#include "components/pref_registry/pref_registry_syncable.h" |
+#include "components/proximity_auth/ble/proximity_auth_ble_system.h" |
#include "components/proximity_auth/cryptauth/cryptauth_client_impl.h" |
#include "components/proximity_auth/cryptauth/cryptauth_device_manager.h" |
#include "components/proximity_auth/cryptauth/cryptauth_enrollment_manager.h" |
#include "components/proximity_auth/cryptauth/secure_message_delegate.h" |
-#include "components/proximity_auth/logging/logging.h" |
#include "components/proximity_auth/proximity_auth_pref_manager.h" |
-#include "components/proximity_auth/proximity_auth_system.h" |
#include "components/proximity_auth/screenlock_bridge.h" |
#include "components/proximity_auth/switches.h" |
#include "components/signin/core/browser/profile_oauth2_token_service.h" |
@@ -285,10 +284,11 @@ |
proximity_auth::CryptAuthGCMManager::RegisterPrefs(registry); |
proximity_auth::CryptAuthDeviceManager::RegisterPrefs(registry); |
proximity_auth::CryptAuthEnrollmentManager::RegisterPrefs(registry); |
+ proximity_auth::ProximityAuthPrefManager::RegisterPrefs(registry); |
if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
proximity_auth::switches::kEnableBluetoothLowEnergyDiscovery)) |
- proximity_auth::ProximityAuthPrefManager::RegisterPrefs(registry); |
+ proximity_auth::ProximityAuthBleSystem::RegisterPrefs(registry); |
} |
// static |
@@ -527,14 +527,14 @@ |
if (!auth_attempt_->Start()) |
auth_attempt_.reset(); |
- // TODO(tengs): We notify ProximityAuthSystem whenever unlock attempts are |
+ // TODO(tengs): We notify ProximityAuthBleSystem whenever unlock attempts are |
// attempted. However, we ideally should refactor the auth attempt logic to |
// the proximity_auth component. |
if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
proximity_auth::switches::kEnableBluetoothLowEnergyDiscovery) && |
auth_attempt_type == EasyUnlockAuthAttempt::TYPE_UNLOCK && |
- proximity_auth_system_) { |
- proximity_auth_system_->OnAuthAttempted(user_id); |
+ proximity_auth_ble_system_) { |
+ proximity_auth_ble_system_->OnAuthAttempted(user_id); |
} |
} |
@@ -651,7 +651,6 @@ |
ResetScreenlockState(); |
bluetooth_detector_.reset(); |
- proximity_auth_system_.reset(); |
#if defined(OS_CHROMEOS) |
power_monitor_.reset(); |
#endif |
@@ -671,6 +670,16 @@ |
EnsureTpmKeyPresentIfNeeded(); |
app_manager_->LoadApp(); |
NotifyUserUpdated(); |
+ |
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ proximity_auth::switches::kEnableBluetoothLowEnergyDiscovery) && |
+ GetType() == EasyUnlockService::TYPE_REGULAR && |
+ !proximity_auth_ble_system_) { |
+ proximity_auth_ble_system_.reset( |
+ new proximity_auth::ProximityAuthBleSystem( |
+ proximity_auth::ScreenlockBridge::Get(), &proximity_auth_client_, |
+ profile_->GetPrefs())); |
+ } |
#if defined(OS_CHROMEOS) |
if (!power_monitor_) |
@@ -690,7 +699,7 @@ |
if (!bluetooth_waking_up) { |
app_manager_->DisableAppIfLoaded(); |
ResetScreenlockState(); |
- proximity_auth_system_.reset(); |
+ proximity_auth_ble_system_.reset(); |
#if defined(OS_CHROMEOS) |
power_monitor_.reset(); |
#endif |
@@ -832,23 +841,6 @@ |
return EASY_UNLOCK_AUTH_EVENT_COUNT; |
} |
-void EasyUnlockService::OnRemoteDeviceChanged( |
- const proximity_auth::RemoteDevice* remote_device) { |
- if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
- proximity_auth::switches::kEnableBluetoothLowEnergyDiscovery)) |
- return; |
- |
- if (remote_device) { |
- PA_LOG(INFO) << "Remote device changed, recreating ProximityAuthSystem."; |
- proximity_auth_system_.reset(new proximity_auth::ProximityAuthSystem( |
- *remote_device, proximity_auth_client())); |
- proximity_auth_system_->Start(); |
- } else { |
- PA_LOG(INFO) << "Remote device removed, destroying ProximityAuthSystem."; |
- proximity_auth_system_.reset(); |
- } |
-} |
- |
#if defined(OS_CHROMEOS) |
void EasyUnlockService::OnCryptohomeKeysFetchedForChecking( |
const std::string& user_id, |
@@ -882,13 +874,6 @@ |
app_manager_->DisableAppIfLoaded(); |
if (screenlock_state_handler_ && screenlock_state_handler_->IsActive()) |
UpdateScreenlockState(ScreenlockState::BLUETOOTH_CONNECTING); |
- if (proximity_auth_system_) |
- proximity_auth_system_->OnSuspend(); |
-} |
- |
-void EasyUnlockService::OnSuspendDone() { |
- if (proximity_auth_system_) |
- proximity_auth_system_->OnSuspendDone(); |
} |
void EasyUnlockService::EnsureTpmKeyPresentIfNeeded() { |