| 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/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 device::BluetoothAdapterFactory::GetAdapter( | 95 device::BluetoothAdapterFactory::GetAdapter( |
| 96 base::Bind(&BluetoothDetector::OnAdapterInitialized, | 96 base::Bind(&BluetoothDetector::OnAdapterInitialized, |
| 97 weak_ptr_factory_.GetWeakPtr())); | 97 weak_ptr_factory_.GetWeakPtr())); |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool IsPresent() const { return adapter_.get() && adapter_->IsPresent(); } | 100 bool IsPresent() const { return adapter_.get() && adapter_->IsPresent(); } |
| 101 | 101 |
| 102 // device::BluetoothAdapter::Observer: | 102 // device::BluetoothAdapter::Observer: |
| 103 virtual void AdapterPresentChanged(device::BluetoothAdapter* adapter, | 103 virtual void AdapterPresentChanged(device::BluetoothAdapter* adapter, |
| 104 bool present) OVERRIDE { | 104 bool present) override { |
| 105 service_->OnBluetoothAdapterPresentChanged(); | 105 service_->OnBluetoothAdapterPresentChanged(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 void OnAdapterInitialized(scoped_refptr<device::BluetoothAdapter> adapter) { | 109 void OnAdapterInitialized(scoped_refptr<device::BluetoothAdapter> adapter) { |
| 110 adapter_ = adapter; | 110 adapter_ = adapter; |
| 111 adapter_->AddObserver(this); | 111 adapter_->AddObserver(this); |
| 112 service_->OnBluetoothAdapterPresentChanged(); | 112 service_->OnBluetoothAdapterPresentChanged(); |
| 113 } | 113 } |
| 114 | 114 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 129 AddObserver(this); | 129 AddObserver(this); |
| 130 } | 130 } |
| 131 | 131 |
| 132 virtual ~PowerMonitor() { | 132 virtual ~PowerMonitor() { |
| 133 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 133 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
| 134 RemoveObserver(this); | 134 RemoveObserver(this); |
| 135 } | 135 } |
| 136 | 136 |
| 137 private: | 137 private: |
| 138 // chromeos::PowerManagerClient::Observer: | 138 // chromeos::PowerManagerClient::Observer: |
| 139 virtual void SuspendImminent() OVERRIDE { | 139 virtual void SuspendImminent() override { |
| 140 service_->DisableAppIfLoaded(); | 140 service_->DisableAppIfLoaded(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 virtual void SuspendDone(const base::TimeDelta& sleep_duration) OVERRIDE { | 143 virtual void SuspendDone(const base::TimeDelta& sleep_duration) override { |
| 144 service_->LoadApp(); | 144 service_->LoadApp(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 EasyUnlockService* service_; | 147 EasyUnlockService* service_; |
| 148 | 148 |
| 149 DISALLOW_COPY_AND_ASSIGN(PowerMonitor); | 149 DISALLOW_COPY_AND_ASSIGN(PowerMonitor); |
| 150 }; | 150 }; |
| 151 #endif | 151 #endif |
| 152 | 152 |
| 153 EasyUnlockService::EasyUnlockService(Profile* profile) | 153 EasyUnlockService::EasyUnlockService(Profile* profile) |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 for (const auto& device_key_data : key_data_list) | 539 for (const auto& device_key_data : key_data_list) |
| 540 devices_in_cryptohome.insert(device_key_data.public_key); | 540 devices_in_cryptohome.insert(device_key_data.public_key); |
| 541 | 541 |
| 542 if (paired_devices != devices_in_cryptohome) { | 542 if (paired_devices != devices_in_cryptohome) { |
| 543 SetHardlockStateForUser(user_id, | 543 SetHardlockStateForUser(user_id, |
| 544 EasyUnlockScreenlockStateHandler::PAIRING_CHANGED); | 544 EasyUnlockScreenlockStateHandler::PAIRING_CHANGED); |
| 545 } | 545 } |
| 546 } | 546 } |
| 547 #endif | 547 #endif |
| 548 | 548 |
| OLD | NEW |