| 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" |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 if (user_id.empty()) | 376 if (user_id.empty()) |
| 377 return; | 377 return; |
| 378 | 378 |
| 379 const base::ListValue* device_list = GetRemoteDevices(); | 379 const base::ListValue* device_list = GetRemoteDevices(); |
| 380 std::set<std::string> paired_devices; | 380 std::set<std::string> paired_devices; |
| 381 if (device_list) { | 381 if (device_list) { |
| 382 chromeos::EasyUnlockDeviceKeyDataList parsed_paired; | 382 chromeos::EasyUnlockDeviceKeyDataList parsed_paired; |
| 383 chromeos::EasyUnlockKeyManager::RemoteDeviceListToDeviceDataList( | 383 chromeos::EasyUnlockKeyManager::RemoteDeviceListToDeviceDataList( |
| 384 *device_list, &parsed_paired); | 384 *device_list, &parsed_paired); |
| 385 for (const auto& device_key_data : parsed_paired) | 385 for (const auto& device_key_data : parsed_paired) |
| 386 paired_devices.insert(device_key_data.public_key); | 386 paired_devices.insert(device_key_data.psk); |
| 387 } | 387 } |
| 388 if (paired_devices.empty()) { | 388 if (paired_devices.empty()) { |
| 389 SetHardlockState(EasyUnlockScreenlockStateHandler::NO_PAIRING); | 389 SetHardlockState(EasyUnlockScreenlockStateHandler::NO_PAIRING); |
| 390 return; | 390 return; |
| 391 } | 391 } |
| 392 | 392 |
| 393 // No need to compare if a change is already recorded. | 393 // No need to compare if a change is already recorded. |
| 394 if (GetHardlockState() == EasyUnlockScreenlockStateHandler::PAIRING_CHANGED) | 394 if (GetHardlockState() == EasyUnlockScreenlockStateHandler::PAIRING_CHANGED) |
| 395 return; | 395 return; |
| 396 | 396 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 DCHECK(!user_id.empty() && !paired_devices.empty()); | 611 DCHECK(!user_id.empty() && !paired_devices.empty()); |
| 612 | 612 |
| 613 if (!success) { | 613 if (!success) { |
| 614 SetHardlockStateForUser(user_id, | 614 SetHardlockStateForUser(user_id, |
| 615 EasyUnlockScreenlockStateHandler::NO_PAIRING); | 615 EasyUnlockScreenlockStateHandler::NO_PAIRING); |
| 616 return; | 616 return; |
| 617 } | 617 } |
| 618 | 618 |
| 619 std::set<std::string> devices_in_cryptohome; | 619 std::set<std::string> devices_in_cryptohome; |
| 620 for (const auto& device_key_data : key_data_list) | 620 for (const auto& device_key_data : key_data_list) |
| 621 devices_in_cryptohome.insert(device_key_data.public_key); | 621 devices_in_cryptohome.insert(device_key_data.psk); |
| 622 | 622 |
| 623 if (paired_devices != devices_in_cryptohome || | 623 if (paired_devices != devices_in_cryptohome || |
| 624 GetHardlockState() == EasyUnlockScreenlockStateHandler::NO_PAIRING) { | 624 GetHardlockState() == EasyUnlockScreenlockStateHandler::NO_PAIRING) { |
| 625 SetHardlockStateForUser(user_id, | 625 SetHardlockStateForUser(user_id, |
| 626 EasyUnlockScreenlockStateHandler::PAIRING_CHANGED); | 626 EasyUnlockScreenlockStateHandler::PAIRING_CHANGED); |
| 627 } | 627 } |
| 628 } | 628 } |
| 629 #endif | 629 #endif |
| 630 | 630 |
| 631 void EasyUnlockService::PrepareForSuspend() { | 631 void EasyUnlockService::PrepareForSuspend() { |
| 632 DisableAppIfLoaded(); | 632 DisableAppIfLoaded(); |
| 633 if (screenlock_state_handler_ && screenlock_state_handler_->IsActive()) { | 633 if (screenlock_state_handler_ && screenlock_state_handler_->IsActive()) { |
| 634 UpdateScreenlockState( | 634 UpdateScreenlockState( |
| 635 EasyUnlockScreenlockStateHandler::STATE_BLUETOOTH_CONNECTING); | 635 EasyUnlockScreenlockStateHandler::STATE_BLUETOOTH_CONNECTING); |
| 636 } | 636 } |
| 637 } | 637 } |
| 638 | 638 |
| OLD | NEW |