| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/session_state_controller_impl2.h" | 5 #include "ash/wm/session_state_controller_impl2.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/cancel_mode.h" | 8 #include "ash/cancel_mode.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_delegate.h" | 10 #include "ash/shell_delegate.h" |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 DCHECK(shutting_down_); | 363 DCHECK(shutting_down_); |
| 364 #if defined(OS_CHROMEOS) | 364 #if defined(OS_CHROMEOS) |
| 365 if (!base::chromeos::IsRunningOnChromeOS()) { | 365 if (!base::chromeos::IsRunningOnChromeOS()) { |
| 366 ShellDelegate* delegate = Shell::GetInstance()->delegate(); | 366 ShellDelegate* delegate = Shell::GetInstance()->delegate(); |
| 367 if (delegate) { | 367 if (delegate) { |
| 368 delegate->Exit(); | 368 delegate->Exit(); |
| 369 return; | 369 return; |
| 370 } | 370 } |
| 371 } | 371 } |
| 372 #endif | 372 #endif |
| 373 Shell::GetInstance()->delegate()->RecordUserMetricsAction( |
| 374 UMA_ACCEL_SHUT_DOWN_POWER_BUTTON); |
| 373 delegate_->RequestShutdown(); | 375 delegate_->RequestShutdown(); |
| 374 } | 376 } |
| 375 | 377 |
| 376 void SessionStateControllerImpl2::OnLockScreenHide( | 378 void SessionStateControllerImpl2::OnLockScreenHide( |
| 377 base::Callback<void(void)>& callback) { | 379 base::Callback<void(void)>& callback) { |
| 378 StartUnlockAnimationBeforeUIDestroyed(callback); | 380 StartUnlockAnimationBeforeUIDestroyed(callback); |
| 379 } | 381 } |
| 380 | 382 |
| 381 void SessionStateControllerImpl2::LockAnimationCancelled() { | 383 void SessionStateControllerImpl2::LockAnimationCancelled() { |
| 382 can_cancel_lock_animation_ = false; | 384 can_cancel_lock_animation_ = false; |
| 383 RestoreUnlockedProperties(); | 385 RestoreUnlockedProperties(); |
| 384 } | 386 } |
| 385 | 387 |
| 386 void SessionStateControllerImpl2::PreLockAnimationFinished(bool request_lock) { | 388 void SessionStateControllerImpl2::PreLockAnimationFinished(bool request_lock) { |
| 387 can_cancel_lock_animation_ = false; | 389 can_cancel_lock_animation_ = false; |
| 388 | 390 |
| 389 if (request_lock) | 391 if (request_lock) { |
| 392 Shell::GetInstance()->delegate()->RecordUserMetricsAction( |
| 393 shutdown_after_lock_ ? |
| 394 UMA_ACCEL_LOCK_SCREEN_POWER_BUTTON : |
| 395 UMA_ACCEL_LOCK_SCREEN_LOCK_BUTTON); |
| 390 delegate_->RequestLockScreen(); | 396 delegate_->RequestLockScreen(); |
| 397 } |
| 391 | 398 |
| 392 lock_fail_timer_.Start( | 399 lock_fail_timer_.Start( |
| 393 FROM_HERE, | 400 FROM_HERE, |
| 394 base::TimeDelta::FromMilliseconds(kLockFailTimeoutMs), | 401 base::TimeDelta::FromMilliseconds(kLockFailTimeoutMs), |
| 395 this, | 402 this, |
| 396 &SessionStateControllerImpl2::OnLockFailTimeout); | 403 &SessionStateControllerImpl2::OnLockFailTimeout); |
| 397 } | 404 } |
| 398 | 405 |
| 399 void SessionStateControllerImpl2::PostLockAnimationFinished() { | 406 void SessionStateControllerImpl2::PostLockAnimationFinished() { |
| 400 animating_lock_ = false; | 407 animating_lock_ = false; |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 unlocked_properties_->background_is_hidden) { | 629 unlocked_properties_->background_is_hidden) { |
| 623 animator_->StartAnimationWithObserver( | 630 animator_->StartAnimationWithObserver( |
| 624 internal::SessionStateAnimator::DESKTOP_BACKGROUND, | 631 internal::SessionStateAnimator::DESKTOP_BACKGROUND, |
| 625 internal::SessionStateAnimator::ANIMATION_FADE_OUT, | 632 internal::SessionStateAnimator::ANIMATION_FADE_OUT, |
| 626 speed, | 633 speed, |
| 627 observer); | 634 observer); |
| 628 } | 635 } |
| 629 } | 636 } |
| 630 | 637 |
| 631 } // namespace ash | 638 } // namespace ash |
| OLD | NEW |