| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/wm/lock_state_controller.h" | 5 #include "ash/wm/lock_state_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 static const int kTimeoutMultiplier = 1; | 59 static const int kTimeoutMultiplier = 1; |
| 60 #endif | 60 #endif |
| 61 | 61 |
| 62 const int LockStateController::kLockFailTimeoutMs = 8000 * kTimeoutMultiplier; | 62 const int LockStateController::kLockFailTimeoutMs = 8000 * kTimeoutMultiplier; |
| 63 const int LockStateController::kLockToShutdownTimeoutMs = 150; | 63 const int LockStateController::kLockToShutdownTimeoutMs = 150; |
| 64 const int LockStateController::kShutdownRequestDelayMs = 50; | 64 const int LockStateController::kShutdownRequestDelayMs = 50; |
| 65 | 65 |
| 66 LockStateController::LockStateController( | 66 LockStateController::LockStateController( |
| 67 ShutdownController* shutdown_controller) | 67 ShutdownController* shutdown_controller) |
| 68 : animator_(new SessionStateAnimatorImpl()), | 68 : animator_(new SessionStateAnimatorImpl()), |
| 69 login_status_(LoginStatus::NOT_LOGGED_IN), | |
| 70 system_is_locked_(false), | 69 system_is_locked_(false), |
| 71 shutting_down_(false), | 70 shutting_down_(false), |
| 72 shutdown_after_lock_(false), | 71 shutdown_after_lock_(false), |
| 73 animating_lock_(false), | 72 animating_lock_(false), |
| 74 can_cancel_lock_animation_(false), | 73 can_cancel_lock_animation_(false), |
| 75 shutdown_controller_(shutdown_controller), | 74 shutdown_controller_(shutdown_controller), |
| 76 weak_ptr_factory_(this) { | 75 weak_ptr_factory_(this) { |
| 77 DCHECK(shutdown_controller_); | 76 DCHECK(shutdown_controller_); |
| 78 Shell::GetPrimaryRootWindow()->GetHost()->AddObserver(this); | 77 Shell::GetPrimaryRootWindow()->GetHost()->AddObserver(this); |
| 79 } | 78 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 void LockStateController::SetLockScreenDisplayedCallback( | 183 void LockStateController::SetLockScreenDisplayedCallback( |
| 185 const base::Closure& callback) { | 184 const base::Closure& callback) { |
| 186 lock_screen_displayed_callback_ = callback; | 185 lock_screen_displayed_callback_ = callback; |
| 187 } | 186 } |
| 188 | 187 |
| 189 void LockStateController::OnHostCloseRequested( | 188 void LockStateController::OnHostCloseRequested( |
| 190 const aura::WindowTreeHost* host) { | 189 const aura::WindowTreeHost* host) { |
| 191 Shell::Get()->shell_delegate()->Exit(); | 190 Shell::Get()->shell_delegate()->Exit(); |
| 192 } | 191 } |
| 193 | 192 |
| 194 void LockStateController::OnLoginStateChanged(LoginStatus status) { | |
| 195 if (status != LoginStatus::LOCKED) | |
| 196 login_status_ = status; | |
| 197 system_is_locked_ = (status == LoginStatus::LOCKED); | |
| 198 } | |
| 199 | |
| 200 void LockStateController::OnAppTerminating() { | 193 void LockStateController::OnAppTerminating() { |
| 201 // If we hear that Chrome is exiting but didn't request it ourselves, all we | 194 // If we hear that Chrome is exiting but didn't request it ourselves, all we |
| 202 // can really hope for is that we'll have time to clear the screen. | 195 // can really hope for is that we'll have time to clear the screen. |
| 203 // This is also the case when the user signs off. | 196 // This is also the case when the user signs off. |
| 204 if (!shutting_down_) { | 197 if (!shutting_down_) { |
| 205 shutting_down_ = true; | 198 shutting_down_ = true; |
| 206 Shell* shell = Shell::GetInstance(); | 199 Shell* shell = Shell::GetInstance(); |
| 207 if (shell->cursor_manager()) { | 200 if (shell->cursor_manager()) { |
| 208 shell->cursor_manager()->HideCursor(); | 201 shell->cursor_manager()->HideCursor(); |
| 209 shell->cursor_manager()->LockCursor(); | 202 shell->cursor_manager()->LockCursor(); |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 SessionStateAnimator::AnimationSpeed speed, | 552 SessionStateAnimator::AnimationSpeed speed, |
| 560 SessionStateAnimator::AnimationSequence* animation_sequence) { | 553 SessionStateAnimator::AnimationSequence* animation_sequence) { |
| 561 if (unlocked_properties_.get() && unlocked_properties_->wallpaper_is_hidden) { | 554 if (unlocked_properties_.get() && unlocked_properties_->wallpaper_is_hidden) { |
| 562 animation_sequence->StartAnimation(SessionStateAnimator::WALLPAPER, | 555 animation_sequence->StartAnimation(SessionStateAnimator::WALLPAPER, |
| 563 SessionStateAnimator::ANIMATION_FADE_OUT, | 556 SessionStateAnimator::ANIMATION_FADE_OUT, |
| 564 speed); | 557 speed); |
| 565 } | 558 } |
| 566 } | 559 } |
| 567 | 560 |
| 568 } // namespace ash | 561 } // namespace ash |
| OLD | NEW |