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

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: Merge with ToT 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 void StartRealShutdownTimer();
149 146
150 // Requests that the machine be shut down. 147 // Requests that the machine be shut down.
151 void OnRealShutdownTimeout(); 148 void OnRealShutdownTimeout();
152 149
153 // Triggers late animations on the lock screen. 150 // Triggers late animations on the lock screen.
154 void OnLockScreenAnimationFinished(); 151 void OnLockScreenAnimationFinished();
155 152
153 // Methods for initiating and checking different phases of
154 // lock/unlock animations:
155 // Lock phase one : windows lift (can be undone in some cases)
156 // Lock phase two : lock screen raises
157 // Unlock phase one : lock screen lowers
158 // Unlock phase two : windows drop down
159
160 void StartImmediateLockAnimationPhaseOne();
161 void StartUndoableLockAnimationPhaseOne();
162 void UndoLockAnimationPhaseOne();
163 void StartLockAnimationPhaseTwo();
164 // This method calls |callback| when animation completes.
165 void StartUnlockAnimationPhaseOne(base::Closure &callback);
166 void StartUnlockAnimationPhaseTwo();
167
168 // These methods are called when corresponding animation completes.
169 void LockAnimationUndone();
170 void LockAnimationPhaseOneCompleted();
171 void LockAnimationPhaseTwoCompleted();
172 void UnlockAnimationPhaseTwoCompleted();
173
174 // Stores properties of UI that have to be temporary modified while locking.
175 void StoreUnlockedProperties();
176 void RestoreUnlockedProperties();
177
178 // Fades in background layer with |speed| if it was hidden in unlocked state.
179 void AnimateBackgroundAppearanceIfNecessary(
180 ash::internal::SessionStateAnimator::AnimationSpeed speed,
181 ui::LayerAnimationObserver* observer);
182
183 // Fades out background layer with |speed| if it was hidden in unlocked state.
184 void AnimateBackgroundHidingIfNecessary(
185 ash::internal::SessionStateAnimator::AnimationSpeed speed,
186 ui::LayerAnimationObserver* observer);
187
156 // The current login status, or original login status from before we locked. 188 // The current login status, or original login status from before we locked.
157 user::LoginStatus login_status_; 189 user::LoginStatus login_status_;
158 190
159 // Current lock status. 191 // Current lock status.
160 bool system_is_locked_; 192 bool system_is_locked_;
161 193
162 // Are we in the process of shutting the machine down? 194 // Are we in the process of shutting the machine down?
163 bool shutting_down_; 195 bool shutting_down_;
164 196
165 // Indicates whether controller should proceed to (cancellable) shutdown after 197 // Indicates whether controller should proceed to (cancellable) shutdown after
166 // locking. 198 // locking.
167 bool shutdown_after_lock_; 199 bool shutdown_after_lock_;
168 200
169 // Started when the user first presses the power button while in a 201 // Indicates that controller displays lock animation.
170 // logged-in-as-a-non-guest-user, unlocked state. When it fires, we lock the 202 bool animating_lock_;
171 // screen. 203
172 base::OneShotTimer<SessionStateControllerImpl2> lock_timer_; 204 // Indicates that lock animation can be undone.
205 bool undoable_lock_animation_;
206
207 scoped_ptr<UnlockedStateProperties> unlocked_properties_;
173 208
174 // Started when we request that the screen be locked. When it fires, we 209 // Started when we request that the screen be locked. When it fires, we
175 // assume that our request got dropped. 210 // assume that our request got dropped.
176 base::OneShotTimer<SessionStateControllerImpl2> lock_fail_timer_; 211 base::OneShotTimer<SessionStateControllerImpl2> lock_fail_timer_;
177 212
178 // Started when the screen is locked while the power button is held. Adds a 213 // 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 214 // delay between the appearance of the lock screen and the beginning of the
180 // pre-shutdown animation. 215 // pre-shutdown animation.
181 base::OneShotTimer<SessionStateControllerImpl2> lock_to_shutdown_timer_; 216 base::OneShotTimer<SessionStateControllerImpl2> lock_to_shutdown_timer_;
182 217
183 // Started when we begin displaying the pre-shutdown animation. When it 218 // Started when we begin displaying the pre-shutdown animation. When it
184 // fires, we start the shutdown animation and get ready to request shutdown. 219 // fires, we start the shutdown animation and get ready to request shutdown.
185 base::OneShotTimer<SessionStateControllerImpl2> pre_shutdown_timer_; 220 base::OneShotTimer<SessionStateControllerImpl2> pre_shutdown_timer_;
186 221
187 // Started when we display the shutdown animation. When it fires, we actually 222 // Started when we display the shutdown animation. When it fires, we actually
188 // request shutdown. Gives the animation time to complete before Chrome, X, 223 // request shutdown. Gives the animation time to complete before Chrome, X,
189 // etc. are shut down. 224 // etc. are shut down.
190 base::OneShotTimer<SessionStateControllerImpl2> real_shutdown_timer_; 225 base::OneShotTimer<SessionStateControllerImpl2> real_shutdown_timer_;
191 226
192 base::Closure lock_screen_displayed_callback_; 227 base::Closure lock_screen_displayed_callback_;
193 228
194 DISALLOW_COPY_AND_ASSIGN(SessionStateControllerImpl2); 229 DISALLOW_COPY_AND_ASSIGN(SessionStateControllerImpl2);
195 }; 230 };
196 231
197 } // namespace ash 232 } // namespace ash
198 233
199 #endif // ASH_WM_SESSION_STATE_CONTROLLER_IMPL2_H_ 234 #endif // ASH_WM_SESSION_STATE_CONTROLLER_IMPL2_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698