| 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 "components/proximity_auth/proximity_auth_system.h" | 5 #include "components/proximity_auth/proximity_auth_system.h" |
| 6 | 6 |
| 7 #include "base/threading/thread_task_runner_handle.h" | 7 #include "base/threading/thread_task_runner_handle.h" |
| 8 #include "components/proximity_auth/logging/logging.h" | 8 #include "components/proximity_auth/logging/logging.h" |
| 9 #include "components/proximity_auth/proximity_auth_client.h" | 9 #include "components/proximity_auth/proximity_auth_client.h" |
| 10 #include "components/proximity_auth/remote_device_life_cycle_impl.h" | 10 #include "components/proximity_auth/remote_device_life_cycle_impl.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 110 } |
| 111 | 111 |
| 112 void ProximityAuthSystem::OnLifeCycleStateChanged( | 112 void ProximityAuthSystem::OnLifeCycleStateChanged( |
| 113 RemoteDeviceLifeCycle::State old_state, | 113 RemoteDeviceLifeCycle::State old_state, |
| 114 RemoteDeviceLifeCycle::State new_state) { | 114 RemoteDeviceLifeCycle::State new_state) { |
| 115 unlock_manager_->OnLifeCycleStateChanged(); | 115 unlock_manager_->OnLifeCycleStateChanged(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void ProximityAuthSystem::OnScreenDidLock( | 118 void ProximityAuthSystem::OnScreenDidLock( |
| 119 ScreenlockBridge::LockHandler::ScreenType screen_type) { | 119 ScreenlockBridge::LockHandler::ScreenType screen_type) { |
| 120 OnFocusedUserChanged(ScreenlockBridge::Get()->focused_account_id()); | 120 const AccountId& focused_account_id = |
| 121 ScreenlockBridge::Get()->focused_account_id(); |
| 122 if (focused_account_id.is_valid()) |
| 123 OnFocusedUserChanged(focused_account_id); |
| 121 } | 124 } |
| 122 | 125 |
| 123 void ProximityAuthSystem::OnScreenDidUnlock( | 126 void ProximityAuthSystem::OnScreenDidUnlock( |
| 124 ScreenlockBridge::LockHandler::ScreenType screen_type) { | 127 ScreenlockBridge::LockHandler::ScreenType screen_type) { |
| 125 unlock_manager_->SetRemoteDeviceLifeCycle(nullptr); | 128 unlock_manager_->SetRemoteDeviceLifeCycle(nullptr); |
| 126 remote_device_life_cycle_.reset(); | 129 remote_device_life_cycle_.reset(); |
| 127 } | 130 } |
| 128 | 131 |
| 129 void ProximityAuthSystem::OnFocusedUserChanged(const AccountId& account_id) { | 132 void ProximityAuthSystem::OnFocusedUserChanged(const AccountId& account_id) { |
| 130 // Update the current RemoteDeviceLifeCycle to the focused user. | 133 // Update the current RemoteDeviceLifeCycle to the focused user. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 155 PA_LOG(INFO) << "Creating RemoteDeviceLifeCycle for focused user: " | 158 PA_LOG(INFO) << "Creating RemoteDeviceLifeCycle for focused user: " |
| 156 << account_id.Serialize(); | 159 << account_id.Serialize(); |
| 157 remote_device_life_cycle_ = CreateRemoteDeviceLifeCycle(remote_device); | 160 remote_device_life_cycle_ = CreateRemoteDeviceLifeCycle(remote_device); |
| 158 unlock_manager_->SetRemoteDeviceLifeCycle(remote_device_life_cycle_.get()); | 161 unlock_manager_->SetRemoteDeviceLifeCycle(remote_device_life_cycle_.get()); |
| 159 remote_device_life_cycle_->AddObserver(this); | 162 remote_device_life_cycle_->AddObserver(this); |
| 160 remote_device_life_cycle_->Start(); | 163 remote_device_life_cycle_->Start(); |
| 161 } | 164 } |
| 162 } | 165 } |
| 163 | 166 |
| 164 } // proximity_auth | 167 } // proximity_auth |
| OLD | NEW |