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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "apps/app_lifetime_monitor.h" | 9 #include "apps/app_lifetime_monitor.h" |
10 #include "apps/app_lifetime_monitor_factory.h" | 10 #include "apps/app_lifetime_monitor_factory.h" |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 #endif | 487 #endif |
488 } else if (auth_attempt_.get()) { | 488 } else if (auth_attempt_.get()) { |
489 // Clean up existing auth attempt if we can no longer authenticate the | 489 // Clean up existing auth attempt if we can no longer authenticate the |
490 // remote device. | 490 // remote device. |
491 auth_attempt_.reset(); | 491 auth_attempt_.reset(); |
492 | 492 |
493 if (!handler->InStateValidOnRemoteAuthFailure()) | 493 if (!handler->InStateValidOnRemoteAuthFailure()) |
494 HandleAuthFailure(GetAccountId()); | 494 HandleAuthFailure(GetAccountId()); |
495 } | 495 } |
496 | 496 |
497 FOR_EACH_OBSERVER( | 497 for (EasyUnlockServiceObserver& observer : observers_) |
498 EasyUnlockServiceObserver, observers_, OnScreenlockStateChanged(state)); | 498 observer.OnScreenlockStateChanged(state); |
499 return true; | 499 return true; |
500 } | 500 } |
501 | 501 |
502 ScreenlockState EasyUnlockService::GetScreenlockState() { | 502 ScreenlockState EasyUnlockService::GetScreenlockState() { |
503 EasyUnlockScreenlockStateHandler* handler = GetScreenlockStateHandler(); | 503 EasyUnlockScreenlockStateHandler* handler = GetScreenlockStateHandler(); |
504 if (!handler) | 504 if (!handler) |
505 return ScreenlockState::INACTIVE; | 505 return ScreenlockState::INACTIVE; |
506 | 506 |
507 return handler->state(); | 507 return handler->state(); |
508 } | 508 } |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 return; | 716 return; |
717 | 717 |
718 // Notify the easy unlock app that the user info changed. | 718 // Notify the easy unlock app that the user info changed. |
719 bool logged_in = GetType() == TYPE_REGULAR; | 719 bool logged_in = GetType() == TYPE_REGULAR; |
720 bool data_ready = logged_in || GetRemoteDevices() != NULL; | 720 bool data_ready = logged_in || GetRemoteDevices() != NULL; |
721 app_manager_->SendUserUpdatedEvent(account_id.GetUserEmail(), logged_in, | 721 app_manager_->SendUserUpdatedEvent(account_id.GetUserEmail(), logged_in, |
722 data_ready); | 722 data_ready); |
723 } | 723 } |
724 | 724 |
725 void EasyUnlockService::NotifyTurnOffOperationStatusChanged() { | 725 void EasyUnlockService::NotifyTurnOffOperationStatusChanged() { |
726 FOR_EACH_OBSERVER( | 726 for (EasyUnlockServiceObserver& observer : observers_) |
727 EasyUnlockServiceObserver, observers_, OnTurnOffOperationStatusChanged()); | 727 observer.OnTurnOffOperationStatusChanged(); |
728 } | 728 } |
729 | 729 |
730 void EasyUnlockService::ResetScreenlockState() { | 730 void EasyUnlockService::ResetScreenlockState() { |
731 screenlock_state_handler_.reset(); | 731 screenlock_state_handler_.reset(); |
732 auth_attempt_.reset(); | 732 auth_attempt_.reset(); |
733 } | 733 } |
734 | 734 |
735 void EasyUnlockService::SetScreenlockHardlockedState( | 735 void EasyUnlockService::SetScreenlockHardlockedState( |
736 EasyUnlockScreenlockStateHandler::HardlockState state) { | 736 EasyUnlockScreenlockStateHandler::HardlockState state) { |
737 if (screenlock_state_handler_) | 737 if (screenlock_state_handler_) |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 | 919 |
920 // TODO(tbarzic): Set check_private_key only if previous sign-in attempt | 920 // TODO(tbarzic): Set check_private_key only if previous sign-in attempt |
921 // failed. | 921 // failed. |
922 EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile_) | 922 EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile_) |
923 ->PrepareTpmKey(true /* check_private_key */, | 923 ->PrepareTpmKey(true /* check_private_key */, |
924 base::Closure()); | 924 base::Closure()); |
925 #endif // defined(OS_CHROMEOS) | 925 #endif // defined(OS_CHROMEOS) |
926 | 926 |
927 tpm_key_checked_ = true; | 927 tpm_key_checked_ = true; |
928 } | 928 } |
OLD | NEW |