| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/extensions/component_loader.h" | 13 #include "chrome/browser/extensions/component_loader.h" |
| 14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/signin/easy_unlock_auth_attempt.h" | 16 #include "chrome/browser/signin/easy_unlock_auth_attempt.h" |
| 17 #include "chrome/browser/signin/easy_unlock_service_factory.h" | 17 #include "chrome/browser/signin/easy_unlock_service_factory.h" |
| 18 #include "chrome/browser/signin/easy_unlock_service_observer.h" | 18 #include "chrome/browser/signin/easy_unlock_service_observer.h" |
| 19 #include "chrome/browser/signin/screenlock_bridge.h" | 19 #include "chrome/browser/signin/signin_screen_bridge.h" |
| 20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 21 #include "chrome/common/extensions/api/easy_unlock_private.h" | 21 #include "chrome/common/extensions/api/easy_unlock_private.h" |
| 22 #include "chrome/common/extensions/extension_constants.h" | 22 #include "chrome/common/extensions/extension_constants.h" |
| 23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 24 #include "components/pref_registry/pref_registry_syncable.h" | 24 #include "components/pref_registry/pref_registry_syncable.h" |
| 25 #include "device/bluetooth/bluetooth_adapter.h" | 25 #include "device/bluetooth/bluetooth_adapter.h" |
| 26 #include "device/bluetooth/bluetooth_adapter_factory.h" | 26 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 27 #include "extensions/browser/event_router.h" | 27 #include "extensions/browser/event_router.h" |
| 28 #include "extensions/browser/extension_registry.h" | 28 #include "extensions/browser/extension_registry.h" |
| 29 #include "extensions/browser/extension_system.h" | 29 #include "extensions/browser/extension_system.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 } | 191 } |
| 192 | 192 |
| 193 EasyUnlockScreenlockStateHandler* | 193 EasyUnlockScreenlockStateHandler* |
| 194 EasyUnlockService::GetScreenlockStateHandler() { | 194 EasyUnlockService::GetScreenlockStateHandler() { |
| 195 if (!IsAllowed()) | 195 if (!IsAllowed()) |
| 196 return NULL; | 196 return NULL; |
| 197 if (!screenlock_state_handler_) { | 197 if (!screenlock_state_handler_) { |
| 198 screenlock_state_handler_.reset(new EasyUnlockScreenlockStateHandler( | 198 screenlock_state_handler_.reset(new EasyUnlockScreenlockStateHandler( |
| 199 GetUserEmail(), | 199 GetUserEmail(), |
| 200 GetType() == TYPE_REGULAR ? profile_->GetPrefs() : NULL, | 200 GetType() == TYPE_REGULAR ? profile_->GetPrefs() : NULL, |
| 201 ScreenlockBridge::Get())); | 201 SigninScreenBridge::Get())); |
| 202 } | 202 } |
| 203 return screenlock_state_handler_.get(); | 203 return screenlock_state_handler_.get(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 bool EasyUnlockService::UpdateScreenlockState( | 206 bool EasyUnlockService::UpdateScreenlockState( |
| 207 EasyUnlockScreenlockStateHandler::State state) { | 207 EasyUnlockScreenlockStateHandler::State state) { |
| 208 EasyUnlockScreenlockStateHandler* handler = GetScreenlockStateHandler(); | 208 EasyUnlockScreenlockStateHandler* handler = GetScreenlockStateHandler(); |
| 209 if (!handler) | 209 if (!handler) |
| 210 return false; | 210 return false; |
| 211 | 211 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 // additional platforms. | 387 // additional platforms. |
| 388 // TODO(xiyuan): Revisit when non-chromeos platforms are supported. | 388 // TODO(xiyuan): Revisit when non-chromeos platforms are supported. |
| 389 bluetooth_detector_->Initialize(); | 389 bluetooth_detector_->Initialize(); |
| 390 #endif // defined(OS_CHROMEOS) | 390 #endif // defined(OS_CHROMEOS) |
| 391 } | 391 } |
| 392 | 392 |
| 393 void EasyUnlockService::OnBluetoothAdapterPresentChanged() { | 393 void EasyUnlockService::OnBluetoothAdapterPresentChanged() { |
| 394 UpdateAppState(); | 394 UpdateAppState(); |
| 395 } | 395 } |
| 396 | 396 |
| OLD | NEW |