Index: ash/wm/session_state_controller_impl2.h |
diff --git a/ash/wm/session_state_controller_impl2.h b/ash/wm/session_state_controller_impl2.h |
index d5546795db2a2a002459a3c368d5b6ff9613a713..8a59275b61a79f1082de7cd48b5ab8cb9556c36a 100644 |
--- a/ash/wm/session_state_controller_impl2.h |
+++ b/ash/wm/session_state_controller_impl2.h |
@@ -32,6 +32,28 @@ class SessionStateControllerImpl2Test; |
// Displays onscreen animations and locks or suspends the system in response to |
// the power button being pressed or released. |
+// Lock workflow: |
+// Entry points: |
+// * StartLockAnimation (bool shutdown after lock) - starts lock that can be |
Daniel Erat
2012/12/13 21:47:33
nit: delete the "(bool shutdown after lock)" part
|
+// cancelled. |
+// * StartLockAnimationAndLockImmediately - starts uninterruptable lock |
Daniel Erat
2012/12/13 21:47:33
nit: s/uninterruptable/uninterruptible/
|
+// animation. |
+// This leads to call of either StartImmediatePreLockAnimation or |
+// StartCancellablePreLockAnimation. Once they complete |
+// PreLockAnimationFinished is called, and system lock is requested. |
+// Once system locks and lock UI is created, OnLockStateChanged is called, and |
+// StartPostLockAnimation is called. In PostLockAnimationFinished two |
+// things happen : EVENT_LOCK_ANIMATION_FINISHED notification is sent (it |
+// triggers third part of animation within lock UI), and check for continuing to |
+// shutdown is made. |
+// |
+// Unlock workflow: |
+// WebUI does first part of animation, and calls OnLockScreenHide(callback) that |
+// triggers StartUnlockAnimationBeforeUIDestroyed(callback). Once callback is |
+// called at the end of the animation, lock UI is deleted, system unlocks, and |
+// OnLockStateChanged is called. It leads to |
+// StartUnlockAnimationAfterUIDestroyed. |
+ |
class ASH_EXPORT SessionStateControllerImpl2 : public SessionStateController { |
public: |
@@ -42,9 +64,6 @@ class ASH_EXPORT SessionStateControllerImpl2 : public SessionStateController { |
virtual ~TestApi(); |
- bool lock_timer_is_running() const { |
- return controller_->lock_timer_.IsRunning(); |
- } |
bool lock_fail_timer_is_running() const { |
return controller_->lock_fail_timer_.IsRunning(); |
} |
@@ -57,11 +76,13 @@ class ASH_EXPORT SessionStateControllerImpl2 : public SessionStateController { |
bool real_shutdown_timer_is_running() const { |
return controller_->real_shutdown_timer_.IsRunning(); |
} |
- |
- void trigger_lock_timeout() { |
- controller_->OnLockTimeout(); |
- controller_->lock_timer_.Stop(); |
+ bool is_animating_lock() const { |
+ return controller_->animating_lock_; |
+ } |
+ bool is_lock_cancellable() const { |
+ return controller_->can_cancel_lock_animation_; |
Daniel Erat
2012/12/13 21:47:33
nit: call CanCancelLockAnimation() instead?
|
} |
+ |
void trigger_lock_fail_timeout() { |
controller_->OnLockFailTimeout(); |
controller_->lock_fail_timer_.Stop(); |
@@ -84,6 +105,10 @@ class ASH_EXPORT SessionStateControllerImpl2 : public SessionStateController { |
DISALLOW_COPY_AND_ASSIGN(TestApi); |
}; |
+ struct UnlockedStateProperties { |
Daniel Erat
2012/12/13 21:47:33
if this isn't accessed by other classes, move it t
|
+ bool background_is_hidden; |
+ }; |
+ |
SessionStateControllerImpl2(); |
virtual ~SessionStateControllerImpl2(); |
@@ -123,12 +148,6 @@ class ASH_EXPORT SessionStateControllerImpl2 : public SessionStateController { |
private: |
void RequestShutdownImpl(); |
- // Starts lock timer. |
- void StartLockTimer(); |
- |
- // Requests that the screen be locked and starts |lock_fail_timer_|. |
- void OnLockTimeout(); |
- |
// Reverts the pre-lock animation, reports the error. |
void OnLockFailTimeout(); |
@@ -145,14 +164,59 @@ class ASH_EXPORT SessionStateControllerImpl2 : public SessionStateController { |
void OnPreShutdownAnimationTimeout(); |
// Starts timer for final shutdown animation. |
- void StartRealShutdownTimer(); |
+ // If |with_animation_time| is true, it will also include time of "fade to |
+ // white" shutdown animation. |
+ void StartRealShutdownTimer(bool with_animation_time); |
// Requests that the machine be shut down. |
void OnRealShutdownTimeout(); |
+ // Starts shutdown animation that can be cancelled and starts pre-shutdown |
+ // timer. |
+ void StartCancellableShutdownAnimation(); |
+ |
+ // Starts non-cancellable animation and starts real shutdown timer that |
+ // includes animation time. |
+ void StartShutdownAnimationImpl(); |
+ |
// Triggers late animations on the lock screen. |
void OnLockScreenAnimationFinished(); |
+ // Methods for initiating and checking different phases of |
+ // lock/unlock animations: |
+ // Lock phase one : windows lift (can be undone in some cases) |
Daniel Erat
2012/12/13 21:47:33
nit: delete these outdated comments
|
+ // Lock phase two : lock screen raises |
+ // Unlock phase one : lock screen lowers |
+ // Unlock phase two : windows drop down |
+ |
+ void StartImmediatePreLockAnimation(); |
+ void StartCancellablePreLockAnimation(); |
+ void CancelPreLockAnimation(); |
+ void StartPostLockAnimation(); |
+ // This method calls |callback| when animation completes. |
+ void StartUnlockAnimationBeforeUIDestroyed(base::Closure &callback); |
+ void StartUnlockAnimationAfterUIDestroyed(); |
+ |
+ // These methods are called when corresponding animation completes. |
+ void LockAnimationCancelled(); |
+ void PreLockAnimationFinished(); |
+ void PostLockAnimationFinished(); |
+ void UnlockAnimationAfterUIDestroyedFinished(); |
+ |
+ // Stores properties of UI that have to be temporary modified while locking. |
Daniel Erat
2012/12/13 21:47:33
nit: s/temporary/temporarily/
|
+ void StoreUnlockedProperties(); |
+ void RestoreUnlockedProperties(); |
+ |
+ // Fades in background layer with |speed| if it was hidden in unlocked state. |
+ void AnimateBackgroundAppearanceIfNecessary( |
+ ash::internal::SessionStateAnimator::AnimationSpeed speed, |
+ ui::LayerAnimationObserver* observer); |
+ |
+ // Fades out background layer with |speed| if it was hidden in unlocked state. |
+ void AnimateBackgroundHidingIfNecessary( |
+ ash::internal::SessionStateAnimator::AnimationSpeed speed, |
+ ui::LayerAnimationObserver* observer); |
+ |
// The current login status, or original login status from before we locked. |
user::LoginStatus login_status_; |
@@ -166,10 +230,13 @@ class ASH_EXPORT SessionStateControllerImpl2 : public SessionStateController { |
// locking. |
bool shutdown_after_lock_; |
- // Started when the user first presses the power button while in a |
- // logged-in-as-a-non-guest-user, unlocked state. When it fires, we lock the |
- // screen. |
- base::OneShotTimer<SessionStateControllerImpl2> lock_timer_; |
+ // Indicates that controller displays lock animation. |
+ bool animating_lock_; |
+ |
+ // Indicates that lock animation can be undone. |
+ bool can_cancel_lock_animation_; |
+ |
+ scoped_ptr<UnlockedStateProperties> unlocked_properties_; |
// Started when we request that the screen be locked. When it fires, we |
// assume that our request got dropped. |