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/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 if (!bluetooth_detector_->IsPresent()) | 306 if (!bluetooth_detector_->IsPresent()) |
307 return false; | 307 return false; |
308 | 308 |
309 return true; | 309 return true; |
310 #else | 310 #else |
311 // TODO(xiyuan): Revisit when non-chromeos platforms are supported. | 311 // TODO(xiyuan): Revisit when non-chromeos platforms are supported. |
312 return false; | 312 return false; |
313 #endif | 313 #endif |
314 } | 314 } |
315 | 315 |
| 316 bool EasyUnlockService::IsEnabled() const { |
| 317 // The feature is enabled iff there are any paired devices. |
| 318 const base::ListValue* devices = GetRemoteDevices(); |
| 319 return devices && !devices->empty(); |
| 320 } |
| 321 |
316 void EasyUnlockService::SetHardlockState( | 322 void EasyUnlockService::SetHardlockState( |
317 EasyUnlockScreenlockStateHandler::HardlockState state) { | 323 EasyUnlockScreenlockStateHandler::HardlockState state) { |
318 const std::string user_id = GetUserEmail(); | 324 const std::string user_id = GetUserEmail(); |
319 if (user_id.empty()) | 325 if (user_id.empty()) |
320 return; | 326 return; |
321 | 327 |
322 SetHardlockStateForUser(user_id, state); | 328 SetHardlockStateForUser(user_id, state); |
323 } | 329 } |
324 | 330 |
325 EasyUnlockScreenlockStateHandler::HardlockState | 331 EasyUnlockScreenlockStateHandler::HardlockState |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 | 762 |
757 // TODO(tbarzic): Set check_private_key only if previous sign-in attempt | 763 // TODO(tbarzic): Set check_private_key only if previous sign-in attempt |
758 // failed. | 764 // failed. |
759 EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile_) | 765 EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile_) |
760 ->PrepareTpmKey(true /* check_private_key */, | 766 ->PrepareTpmKey(true /* check_private_key */, |
761 base::Closure()); | 767 base::Closure()); |
762 #endif // defined(OS_CHROMEOS) | 768 #endif // defined(OS_CHROMEOS) |
763 | 769 |
764 tpm_key_checked_ = true; | 770 tpm_key_checked_ = true; |
765 } | 771 } |
OLD | NEW |