OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/session/session_controller.h" | 5 #include "ash/session/session_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> |
8 | 9 |
9 #include "ash/session/session_observer.h" | 10 #include "ash/session/session_observer.h" |
10 #include "ash/shell.h" | 11 #include "ash/shell.h" |
11 #include "ash/system/power/power_event_observer.h" | 12 #include "ash/system/power/power_event_observer.h" |
12 #include "ash/wm/lock_state_controller.h" | 13 #include "ash/wm/lock_state_controller.h" |
13 #include "base/bind.h" | 14 #include "base/bind.h" |
14 #include "base/bind_helpers.h" | 15 #include "base/bind_helpers.h" |
15 #include "base/command_line.h" | 16 #include "base/command_line.h" |
16 #include "chromeos/chromeos_switches.h" | 17 #include "chromeos/chromeos_switches.h" |
17 #include "components/signin/core/account_id/account_id.h" | 18 #include "components/signin/core/account_id/account_id.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 if (user_sessions_[0]->session_id != active_session_id_) { | 233 if (user_sessions_[0]->session_id != active_session_id_) { |
233 active_session_id_ = user_sessions_[0]->session_id; | 234 active_session_id_ = user_sessions_[0]->session_id; |
234 | 235 |
235 for (auto& observer : observers_) | 236 for (auto& observer : observers_) |
236 observer.OnActiveUserSessionChanged(user_sessions_[0]->account_id); | 237 observer.OnActiveUserSessionChanged(user_sessions_[0]->account_id); |
237 | 238 |
238 UpdateLoginStatus(); | 239 UpdateLoginStatus(); |
239 } | 240 } |
240 } | 241 } |
241 | 242 |
242 void SessionController::StartLock(const StartLockCallback& callback) { | 243 void SessionController::StartLock(StartLockCallback callback) { |
243 DCHECK(start_lock_callback_.is_null()); | 244 DCHECK(start_lock_callback_.is_null()); |
244 start_lock_callback_ = callback; | 245 start_lock_callback_ = std::move(callback); |
245 | 246 |
246 LockStateController* const lock_state_controller = | 247 LockStateController* const lock_state_controller = |
247 Shell::Get()->lock_state_controller(); | 248 Shell::Get()->lock_state_controller(); |
248 | 249 |
249 lock_state_controller->SetLockScreenDisplayedCallback( | 250 lock_state_controller->SetLockScreenDisplayedCallback( |
250 base::Bind(&SessionController::OnLockAnimationFinished, | 251 base::Bind(&SessionController::OnLockAnimationFinished, |
251 weak_ptr_factory_.GetWeakPtr())); | 252 weak_ptr_factory_.GetWeakPtr())); |
252 lock_state_controller->OnStartingLock(); | 253 lock_state_controller->OnStartingLock(); |
253 } | 254 } |
254 | 255 |
255 void SessionController::NotifyChromeLockAnimationsComplete() { | 256 void SessionController::NotifyChromeLockAnimationsComplete() { |
256 Shell::Get()->power_event_observer()->OnLockAnimationsComplete(); | 257 Shell::Get()->power_event_observer()->OnLockAnimationsComplete(); |
257 } | 258 } |
258 | 259 |
259 void SessionController::RunUnlockAnimation( | 260 void SessionController::RunUnlockAnimation( |
260 const RunUnlockAnimationCallback& callback) { | 261 RunUnlockAnimationCallback callback) { |
261 is_unlocking_ = true; | 262 is_unlocking_ = true; |
262 | 263 |
263 // Shell could have no instance in tests. | 264 // Shell could have no instance in tests. |
264 if (Shell::HasInstance()) | 265 if (Shell::HasInstance()) |
265 Shell::Get()->lock_state_controller()->OnLockScreenHide(callback); | 266 Shell::Get()->lock_state_controller()->OnLockScreenHide( |
| 267 std::move(callback)); |
266 } | 268 } |
267 | 269 |
268 void SessionController::NotifyChromeTerminating() { | 270 void SessionController::NotifyChromeTerminating() { |
269 for (auto& observer : observers_) | 271 for (auto& observer : observers_) |
270 observer.OnChromeTerminating(); | 272 observer.OnChromeTerminating(); |
271 } | 273 } |
272 | 274 |
273 void SessionController::ClearUserSessionsForTest() { | 275 void SessionController::ClearUserSessionsForTest() { |
274 user_sessions_.clear(); | 276 user_sessions_.clear(); |
275 } | 277 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 for (auto& observer : observers_) | 382 for (auto& observer : observers_) |
381 observer.OnLoginStatusChanged(login_status_); | 383 observer.OnLoginStatusChanged(login_status_); |
382 } | 384 } |
383 | 385 |
384 void SessionController::OnLockAnimationFinished() { | 386 void SessionController::OnLockAnimationFinished() { |
385 if (!start_lock_callback_.is_null()) | 387 if (!start_lock_callback_.is_null()) |
386 std::move(start_lock_callback_).Run(true /* locked */); | 388 std::move(start_lock_callback_).Run(true /* locked */); |
387 } | 389 } |
388 | 390 |
389 } // namespace ash | 391 } // namespace ash |
OLD | NEW |