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" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 device::BluetoothAdapter* getAdapter() { | 135 device::BluetoothAdapter* getAdapter() { |
136 return adapter_.get(); | 136 return adapter_.get(); |
137 } | 137 } |
138 | 138 |
139 private: | 139 private: |
140 void OnAdapterInitialized(scoped_refptr<device::BluetoothAdapter> adapter) { | 140 void OnAdapterInitialized(scoped_refptr<device::BluetoothAdapter> adapter) { |
141 adapter_ = adapter; | 141 adapter_ = adapter; |
142 adapter_->AddObserver(this); | 142 adapter_->AddObserver(this); |
143 service_->OnBluetoothAdapterPresentChanged(); | 143 service_->OnBluetoothAdapterPresentChanged(); |
144 | 144 |
145 // TODO(tengs): At the moment, there is no way for Bluetooth discoverability | |
146 // to be turned on except through the Easy Unlock setup. If we step on any | |
147 // toes in the future then we need to revisit this guard. | |
148 if (adapter_->IsDiscoverable()) | |
149 TurnOffBluetoothDiscoverability(); | |
150 | |
151 #if !defined(OS_CHROMEOS) | 145 #if !defined(OS_CHROMEOS) |
152 // Bluetooth detection causes serious performance degradations on Mac | 146 // Bluetooth detection causes serious performance degradations on Mac |
153 // and possibly other platforms as well: http://crbug.com/467316 | 147 // and possibly other platforms as well: http://crbug.com/467316 |
154 // Since this feature is currently only offered for ChromeOS we just | 148 // Since this feature is currently only offered for ChromeOS we just |
155 // turn it off on other platforms once the inforamtion about the | 149 // turn it off on other platforms once the inforamtion about the |
156 // adapter has been gathered and reported. | 150 // adapter has been gathered and reported. |
157 // TODO(bcwhite,xiyuan): Revisit when non-chromeos platforms are supported. | 151 // TODO(bcwhite,xiyuan): Revisit when non-chromeos platforms are supported. |
158 adapter_->RemoveObserver(this); | 152 adapter_->RemoveObserver(this); |
159 adapter_ = NULL; | 153 adapter_ = NULL; |
| 154 #else |
| 155 // TODO(tengs): At the moment, there is no way for Bluetooth discoverability |
| 156 // to be turned on except through the Easy Unlock setup. If we step on any |
| 157 // toes in the future then we need to revisit this guard. |
| 158 if (adapter_->IsDiscoverable()) |
| 159 TurnOffBluetoothDiscoverability(); |
160 #endif // !defined(OS_CHROMEOS) | 160 #endif // !defined(OS_CHROMEOS) |
161 } | 161 } |
162 | 162 |
163 // apps::AppLifetimeMonitor::Observer: | 163 // apps::AppLifetimeMonitor::Observer: |
164 void OnAppDeactivated(Profile* profile, const std::string& app_id) override { | 164 void OnAppDeactivated(Profile* profile, const std::string& app_id) override { |
165 // TODO(tengs): Refactor the lifetime management to EasyUnlockAppManager. | 165 // TODO(tengs): Refactor the lifetime management to EasyUnlockAppManager. |
166 if (app_id == extension_misc::kEasyUnlockAppId) | 166 if (app_id == extension_misc::kEasyUnlockAppId) |
167 TurnOffBluetoothDiscoverability(); | 167 TurnOffBluetoothDiscoverability(); |
168 } | 168 } |
169 | 169 |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 | 857 |
858 // TODO(tbarzic): Set check_private_key only if previous sign-in attempt | 858 // TODO(tbarzic): Set check_private_key only if previous sign-in attempt |
859 // failed. | 859 // failed. |
860 EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile_) | 860 EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile_) |
861 ->PrepareTpmKey(true /* check_private_key */, | 861 ->PrepareTpmKey(true /* check_private_key */, |
862 base::Closure()); | 862 base::Closure()); |
863 #endif // defined(OS_CHROMEOS) | 863 #endif // defined(OS_CHROMEOS) |
864 | 864 |
865 tpm_key_checked_ = true; | 865 tpm_key_checked_ = true; |
866 } | 866 } |
OLD | NEW |