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

Side by Side 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: Add fix for shutdown cut-off timing 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 unified diff | Download patch
OLDNEW
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 #ifndef ASH_WM_SESSION_STATE_CONTROLLER_IMPL2_H_ 5 #ifndef ASH_WM_SESSION_STATE_CONTROLLER_IMPL2_H_
6 #define ASH_WM_SESSION_STATE_CONTROLLER_IMPL2_H_ 6 #define ASH_WM_SESSION_STATE_CONTROLLER_IMPL2_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/shell_observer.h" 9 #include "ash/shell_observer.h"
10 #include "ash/wm/session_state_animator.h" 10 #include "ash/wm/session_state_animator.h"
(...skipping 24 matching lines...) Expand all
35 class ASH_EXPORT SessionStateControllerImpl2 : public SessionStateController { 35 class ASH_EXPORT SessionStateControllerImpl2 : public SessionStateController {
36 public: 36 public:
37 37
38 // Helper class used by tests to access internal state. 38 // Helper class used by tests to access internal state.
39 class ASH_EXPORT TestApi { 39 class ASH_EXPORT TestApi {
40 public: 40 public:
41 explicit TestApi(SessionStateControllerImpl2* controller); 41 explicit TestApi(SessionStateControllerImpl2* controller);
42 42
43 virtual ~TestApi(); 43 virtual ~TestApi();
44 44
45 bool lock_timer_is_running() const {
46 return controller_->lock_timer_.IsRunning();
47 }
48 bool lock_fail_timer_is_running() const { 45 bool lock_fail_timer_is_running() const {
49 return controller_->lock_fail_timer_.IsRunning(); 46 return controller_->lock_fail_timer_.IsRunning();
50 } 47 }
51 bool lock_to_shutdown_timer_is_running() const { 48 bool lock_to_shutdown_timer_is_running() const {
52 return controller_->lock_to_shutdown_timer_.IsRunning(); 49 return controller_->lock_to_shutdown_timer_.IsRunning();
53 } 50 }
54 bool shutdown_timer_is_running() const { 51 bool shutdown_timer_is_running() const {
55 return controller_->pre_shutdown_timer_.IsRunning(); 52 return controller_->pre_shutdown_timer_.IsRunning();
56 } 53 }
57 bool real_shutdown_timer_is_running() const { 54 bool real_shutdown_timer_is_running() const {
58 return controller_->real_shutdown_timer_.IsRunning(); 55 return controller_->real_shutdown_timer_.IsRunning();
59 } 56 }
57 bool is_animating_lock() const {
58 return controller_->animating_lock_;
59 }
60 bool is_lock_undoable() const {
61 return controller_->undoable_lock_animation_;
62 }
60 63
61 void trigger_lock_timeout() {
62 controller_->OnLockTimeout();
63 controller_->lock_timer_.Stop();
64 }
65 void trigger_lock_fail_timeout() { 64 void trigger_lock_fail_timeout() {
66 controller_->OnLockFailTimeout(); 65 controller_->OnLockFailTimeout();
67 controller_->lock_fail_timer_.Stop(); 66 controller_->lock_fail_timer_.Stop();
68 } 67 }
69 void trigger_lock_to_shutdown_timeout() { 68 void trigger_lock_to_shutdown_timeout() {
70 controller_->OnLockToShutdownTimeout(); 69 controller_->OnLockToShutdownTimeout();
71 controller_->lock_to_shutdown_timer_.Stop(); 70 controller_->lock_to_shutdown_timer_.Stop();
72 } 71 }
73 void trigger_shutdown_timeout() { 72 void trigger_shutdown_timeout() {
74 controller_->OnPreShutdownAnimationTimeout(); 73 controller_->OnPreShutdownAnimationTimeout();
75 controller_->pre_shutdown_timer_.Stop(); 74 controller_->pre_shutdown_timer_.Stop();
76 } 75 }
77 void trigger_real_shutdown_timeout() { 76 void trigger_real_shutdown_timeout() {
78 controller_->OnRealShutdownTimeout(); 77 controller_->OnRealShutdownTimeout();
79 controller_->real_shutdown_timer_.Stop(); 78 controller_->real_shutdown_timer_.Stop();
80 } 79 }
81 private: 80 private:
82 SessionStateControllerImpl2* controller_; // not owned 81 SessionStateControllerImpl2* controller_; // not owned
83 82
84 DISALLOW_COPY_AND_ASSIGN(TestApi); 83 DISALLOW_COPY_AND_ASSIGN(TestApi);
85 }; 84 };
86 85
86 struct UnlockedStateProperties {
87 bool background_is_hidden;
88 };
89
87 SessionStateControllerImpl2(); 90 SessionStateControllerImpl2();
88 virtual ~SessionStateControllerImpl2(); 91 virtual ~SessionStateControllerImpl2();
89 92
90 // RootWindowObserver override: 93 // RootWindowObserver override:
91 virtual void OnRootWindowHostCloseRequested( 94 virtual void OnRootWindowHostCloseRequested(
92 const aura::RootWindow* root) OVERRIDE; 95 const aura::RootWindow* root) OVERRIDE;
93 96
94 // ShellObserver overrides: 97 // ShellObserver overrides:
95 virtual void OnLoginStateChanged(user::LoginStatus status) OVERRIDE; 98 virtual void OnLoginStateChanged(user::LoginStatus status) OVERRIDE;
96 virtual void OnAppTerminating() OVERRIDE; 99 virtual void OnAppTerminating() OVERRIDE;
(...skipping 19 matching lines...) Expand all
116 119
117 virtual void OnLockScreenHide(base::Closure& callback) OVERRIDE; 120 virtual void OnLockScreenHide(base::Closure& callback) OVERRIDE;
118 virtual void SetLockScreenDisplayedCallback(base::Closure& callback) OVERRIDE; 121 virtual void SetLockScreenDisplayedCallback(base::Closure& callback) OVERRIDE;
119 122
120 protected: 123 protected:
121 friend class test::SessionStateControllerImpl2Test; 124 friend class test::SessionStateControllerImpl2Test;
122 125
123 private: 126 private:
124 void RequestShutdownImpl(); 127 void RequestShutdownImpl();
125 128
126 // Starts lock timer.
127 void StartLockTimer();
128
129 // Requests that the screen be locked and starts |lock_fail_timer_|.
130 void OnLockTimeout();
131
132 // Reverts the pre-lock animation, reports the error. 129 // Reverts the pre-lock animation, reports the error.
133 void OnLockFailTimeout(); 130 void OnLockFailTimeout();
134 131
135 // Starts timer for gap between lock and shutdown. 132 // Starts timer for gap between lock and shutdown.
136 void StartLockToShutdownTimer(); 133 void StartLockToShutdownTimer();
137 134
138 // Calls StartShutdownAnimation(). 135 // Calls StartShutdownAnimation().
139 void OnLockToShutdownTimeout(); 136 void OnLockToShutdownTimeout();
140 137
141 // Starts timer for undoable shutdown animation. 138 // Starts timer for undoable shutdown animation.
142 void StartPreShutdownAnimationTimer(); 139 void StartPreShutdownAnimationTimer();
143 140
144 // Calls RequestShutdownImpl(); 141 // Calls RequestShutdownImpl();
145 void OnPreShutdownAnimationTimeout(); 142 void OnPreShutdownAnimationTimeout();
146 143
147 // Starts timer for final shutdown animation. 144 // Starts timer for final shutdown animation.
148 void StartRealShutdownTimer(); 145 // If |with_animation_time| is true, it will also include time of "fade to
146 // white" shutdown animation.
147 void StartRealShutdownTimer(bool with_animation_time);
149 148
150 // Requests that the machine be shut down. 149 // Requests that the machine be shut down.
151 void OnRealShutdownTimeout(); 150 void OnRealShutdownTimeout();
152 151
152 // Starts shutdown animation that can be cancelled and starts pre-shutdown
153 // timer.
154 void StartCancellableShutdownAnimation();
155
156 // Starts non-cancellable animation and starts real shutdown timer that
157 // includes animation time.
158 void StartShutdownAnimationImpl();
159
153 // Triggers late animations on the lock screen. 160 // Triggers late animations on the lock screen.
154 void OnLockScreenAnimationFinished(); 161 void OnLockScreenAnimationFinished();
155 162
163 // Methods for initiating and checking different phases of
164 // lock/unlock animations:
165 // Lock phase one : windows lift (can be undone in some cases)
166 // Lock phase two : lock screen raises
167 // Unlock phase one : lock screen lowers
168 // Unlock phase two : windows drop down
169
170 void StartImmediateLockAnimationPhaseOne();
171 void StartUndoableLockAnimationPhaseOne();
172 void UndoLockAnimationPhaseOne();
173 void StartLockAnimationPhaseTwo();
174 // This method calls |callback| when animation completes.
175 void StartUnlockAnimationPhaseOne(base::Closure &callback);
176 void StartUnlockAnimationPhaseTwo();
177
178 // These methods are called when corresponding animation completes.
179 void LockAnimationUndone();
180 void LockAnimationPhaseOneCompleted();
181 void LockAnimationPhaseTwoCompleted();
182 void UnlockAnimationPhaseTwoCompleted();
183
184 // Stores properties of UI that have to be temporary modified while locking.
185 void StoreUnlockedProperties();
186 void RestoreUnlockedProperties();
187
188 // Fades in background layer with |speed| if it was hidden in unlocked state.
189 void AnimateBackgroundAppearanceIfNecessary(
190 ash::internal::SessionStateAnimator::AnimationSpeed speed,
191 ui::LayerAnimationObserver* observer);
192
193 // Fades out background layer with |speed| if it was hidden in unlocked state.
194 void AnimateBackgroundHidingIfNecessary(
195 ash::internal::SessionStateAnimator::AnimationSpeed speed,
196 ui::LayerAnimationObserver* observer);
197
156 // The current login status, or original login status from before we locked. 198 // The current login status, or original login status from before we locked.
157 user::LoginStatus login_status_; 199 user::LoginStatus login_status_;
158 200
159 // Current lock status. 201 // Current lock status.
160 bool system_is_locked_; 202 bool system_is_locked_;
161 203
162 // Are we in the process of shutting the machine down? 204 // Are we in the process of shutting the machine down?
163 bool shutting_down_; 205 bool shutting_down_;
164 206
165 // Indicates whether controller should proceed to (cancellable) shutdown after 207 // Indicates whether controller should proceed to (cancellable) shutdown after
166 // locking. 208 // locking.
167 bool shutdown_after_lock_; 209 bool shutdown_after_lock_;
168 210
169 // Started when the user first presses the power button while in a 211 // Indicates that controller displays lock animation.
170 // logged-in-as-a-non-guest-user, unlocked state. When it fires, we lock the 212 bool animating_lock_;
171 // screen. 213
172 base::OneShotTimer<SessionStateControllerImpl2> lock_timer_; 214 // Indicates that lock animation can be undone.
215 bool undoable_lock_animation_;
216
217 scoped_ptr<UnlockedStateProperties> unlocked_properties_;
173 218
174 // Started when we request that the screen be locked. When it fires, we 219 // Started when we request that the screen be locked. When it fires, we
175 // assume that our request got dropped. 220 // assume that our request got dropped.
176 base::OneShotTimer<SessionStateControllerImpl2> lock_fail_timer_; 221 base::OneShotTimer<SessionStateControllerImpl2> lock_fail_timer_;
177 222
178 // Started when the screen is locked while the power button is held. Adds a 223 // Started when the screen is locked while the power button is held. Adds a
179 // delay between the appearance of the lock screen and the beginning of the 224 // delay between the appearance of the lock screen and the beginning of the
180 // pre-shutdown animation. 225 // pre-shutdown animation.
181 base::OneShotTimer<SessionStateControllerImpl2> lock_to_shutdown_timer_; 226 base::OneShotTimer<SessionStateControllerImpl2> lock_to_shutdown_timer_;
182 227
183 // Started when we begin displaying the pre-shutdown animation. When it 228 // Started when we begin displaying the pre-shutdown animation. When it
184 // fires, we start the shutdown animation and get ready to request shutdown. 229 // fires, we start the shutdown animation and get ready to request shutdown.
185 base::OneShotTimer<SessionStateControllerImpl2> pre_shutdown_timer_; 230 base::OneShotTimer<SessionStateControllerImpl2> pre_shutdown_timer_;
186 231
187 // Started when we display the shutdown animation. When it fires, we actually 232 // Started when we display the shutdown animation. When it fires, we actually
188 // request shutdown. Gives the animation time to complete before Chrome, X, 233 // request shutdown. Gives the animation time to complete before Chrome, X,
189 // etc. are shut down. 234 // etc. are shut down.
190 base::OneShotTimer<SessionStateControllerImpl2> real_shutdown_timer_; 235 base::OneShotTimer<SessionStateControllerImpl2> real_shutdown_timer_;
191 236
192 base::Closure lock_screen_displayed_callback_; 237 base::Closure lock_screen_displayed_callback_;
193 238
194 DISALLOW_COPY_AND_ASSIGN(SessionStateControllerImpl2); 239 DISALLOW_COPY_AND_ASSIGN(SessionStateControllerImpl2);
195 }; 240 };
196 241
197 } // namespace ash 242 } // namespace ash
198 243
199 #endif // ASH_WM_SESSION_STATE_CONTROLLER_IMPL2_H_ 244 #endif // ASH_WM_SESSION_STATE_CONTROLLER_IMPL2_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698