Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2854)

Unified Diff: ash/wm/session_state_controller_impl2.h

Issue 11453012: Fix black background when locking with fullscreen window: (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove stuff for testing and disable some tests" Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/session_state_animator.cc ('k') | ash/wm/session_state_controller_impl2.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4c072087caa375af80ab6544671d319ec5f41299 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
+// cancelled.
+// * StartLockAnimationAndLockImmediately - starts uninterruptible lock
+// 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_->CanCancelLockAnimation();
}
+
void trigger_lock_fail_timeout() {
controller_->OnLockFailTimeout();
controller_->lock_fail_timer_.Stop();
@@ -121,13 +142,11 @@ class ASH_EXPORT SessionStateControllerImpl2 : public SessionStateController {
friend class test::SessionStateControllerImpl2Test;
private:
- void RequestShutdownImpl();
-
- // Starts lock timer.
- void StartLockTimer();
+ struct UnlockedStateProperties {
+ bool background_is_hidden;
+ };
- // Requests that the screen be locked and starts |lock_fail_timer_|.
- void OnLockTimeout();
+ void RequestShutdownImpl();
// Reverts the pre-lock animation, reports the error.
void OnLockFailTimeout();
@@ -145,14 +164,52 @@ 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();
+ 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 temporarily modified while locking.
+ 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 +223,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.
« no previous file with comments | « ash/wm/session_state_animator.cc ('k') | ash/wm/session_state_controller_impl2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698