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

Side by Side Diff: ash/wm/session_state_controller_impl2.cc

Issue 11230050: ash : introduce second SessionStateController implementation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 months 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 #include "ash/wm/session_state_controller.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/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_delegate.h" 9 #include "ash/shell_delegate.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
11 #include "ash/wm/session_state_animator.h" 11 #include "ash/wm/session_state_animator.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "ui/aura/root_window.h" 13 #include "ui/aura/root_window.h"
14 #include "ui/aura/shared/compound_event_filter.h" 14 #include "ui/aura/shared/compound_event_filter.h"
15 15
16 #if defined(OS_CHROMEOS) 16 #if defined(OS_CHROMEOS)
17 #include "base/chromeos/chromeos_version.h" 17 #include "base/chromeos/chromeos_version.h"
18 #endif 18 #endif
19 19
20 namespace ash { 20 namespace ash {
21 21
22 const int SessionStateController::kLockTimeoutMs = 400; 22 SessionStateControllerImpl2::TestApi::TestApi(
23 const int SessionStateController::kShutdownTimeoutMs = 400; 23 SessionStateControllerImpl2* controller)
24 const int SessionStateController::kLockFailTimeoutMs = 4000;
25 const int SessionStateController::kLockToShutdownTimeoutMs = 150;
26 const int SessionStateController::kSlowCloseAnimMs = 400;
27 const int SessionStateController::kUndoSlowCloseAnimMs = 100;
28 const int SessionStateController::kFastCloseAnimMs = 150;
29 const int SessionStateController::kShutdownRequestDelayMs = 50;
30
31 SessionStateController::TestApi::TestApi(SessionStateController* controller)
32 : controller_(controller) { 24 : controller_(controller) {
33 } 25 }
34 26
35 SessionStateController::TestApi::~TestApi() { 27 SessionStateControllerImpl2::TestApi::~TestApi() {
36 } 28 }
37 29
38 SessionStateController::SessionStateController() 30 SessionStateControllerImpl2::SessionStateControllerImpl2()
39 : login_status_(user::LOGGED_IN_NONE), 31 : login_status_(user::LOGGED_IN_NONE),
40 unlocked_login_status_(user::LOGGED_IN_NONE), 32 system_is_locked_(false),
41 shutting_down_(false), 33 shutting_down_(false),
42 shutdown_after_lock_(false), 34 shutdown_after_lock_(false) {
43 animator_(new internal::SessionStateAnimator()) {
44 Shell::GetPrimaryRootWindow()->AddRootWindowObserver(this); 35 Shell::GetPrimaryRootWindow()->AddRootWindowObserver(this);
45 } 36 }
46 37
47 SessionStateController::~SessionStateController() { 38 SessionStateControllerImpl2::~SessionStateControllerImpl2() {
48 Shell::GetPrimaryRootWindow()->RemoveRootWindowObserver(this); 39 Shell::GetPrimaryRootWindow()->RemoveRootWindowObserver(this);
49 } 40 }
50 41
51 void SessionStateController::SetDelegate( 42 void SessionStateControllerImpl2::OnLoginStateChanged(
52 SessionStateControllerDelegate* delegate) { 43 user::LoginStatus status) {
53 delegate_.reset(delegate); 44 if (status != user::LOGGED_IN_LOCKED)
45 login_status_ = status;
46 system_is_locked_ = (status == user::LOGGED_IN_LOCKED);
54 } 47 }
55 48
56 void SessionStateController::OnLoginStateChanged(user::LoginStatus status) { 49 void SessionStateControllerImpl2::OnAppTerminating() {
57 login_status_ = status;
58 unlocked_login_status_ = user::LOGGED_IN_NONE;
59 }
60
61 void SessionStateController::OnAppTerminating() {
62 // If we hear that Chrome is exiting but didn't request it ourselves, all we 50 // If we hear that Chrome is exiting but didn't request it ourselves, all we
63 // can really hope for is that we'll have time to clear the screen. 51 // can really hope for is that we'll have time to clear the screen.
64 if (!shutting_down_) { 52 if (!shutting_down_) {
65 shutting_down_ = true; 53 shutting_down_ = true;
66 Shell* shell = ash::Shell::GetInstance(); 54 Shell* shell = ash::Shell::GetInstance();
67 shell->env_filter()->set_cursor_hidden_by_filter(false); 55 shell->env_filter()->set_cursor_hidden_by_filter(false);
68 shell->cursor_manager()->ShowCursor(false); 56 shell->cursor_manager()->ShowCursor(false);
69 animator_->ShowBlackLayer(); 57 animator_->ShowBlackLayer();
70 animator_->StartAnimation( 58 animator_->StartAnimation(
71 internal::SessionStateAnimator::kAllContainersMask, 59 internal::SessionStateAnimator::kAllContainersMask,
72 internal::SessionStateAnimator::ANIMATION_HIDE); 60 internal::SessionStateAnimator::ANIMATION_HIDE);
73 } 61 }
74 } 62 }
75 63
76 void SessionStateController::OnLockStateChanged(bool locked) { 64 void SessionStateControllerImpl2::OnLockStateChanged(bool locked) {
77 if (shutting_down_ || (IsLocked()) == locked) 65 if (shutting_down_ || (IsLocked()) == locked)
78 return; 66 return;
79 67
80 if (!locked && login_status_ == user::LOGGED_IN_LOCKED) { 68 system_is_locked_ = locked;
81 login_status_ = unlocked_login_status_;
82 unlocked_login_status_ = user::LOGGED_IN_NONE;
83 } else {
84 unlocked_login_status_ = login_status_;
85 login_status_ = user::LOGGED_IN_LOCKED;
86 }
87 69
88 if (locked) { 70 if (locked) {
89 animator_->StartAnimation( 71 animator_->StartAnimation(
90 internal::SessionStateAnimator::LOCK_SCREEN_CONTAINERS, 72 internal::SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
91 internal::SessionStateAnimator::ANIMATION_FADE_IN); 73 internal::SessionStateAnimator::ANIMATION_FADE_IN);
92 lock_timer_.Stop(); 74 lock_timer_.Stop();
93 lock_fail_timer_.Stop(); 75 lock_fail_timer_.Stop();
94 76
95 if (shutdown_after_lock_) { 77 if (shutdown_after_lock_) {
96 shutdown_after_lock_ = false; 78 shutdown_after_lock_ = false;
97 StartLockToShutdownTimer(); 79 StartLockToShutdownTimer();
98 } 80 }
99 } else { 81 } else {
100 animator_->StartAnimation( 82 animator_->StartAnimation(
101 internal::SessionStateAnimator::DESKTOP_BACKGROUND | 83 internal::SessionStateAnimator::DESKTOP_BACKGROUND |
102 internal::SessionStateAnimator::LAUNCHER | 84 internal::SessionStateAnimator::LAUNCHER |
103 internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, 85 internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
104 internal::SessionStateAnimator::ANIMATION_RESTORE); 86 internal::SessionStateAnimator::ANIMATION_RESTORE);
105 animator_->DropBlackLayer(); 87 animator_->DropBlackLayer();
106 } 88 }
107 } 89 }
108 90
109 void SessionStateController::OnStartingLock() { 91 void SessionStateControllerImpl2::OnStartingLock() {
110 if (shutting_down_ || login_status_ == user::LOGGED_IN_LOCKED) 92 if (shutting_down_ || system_is_locked_)
111 return; 93 return;
112 94
113 // Ensure that the black layer is visible -- if the screen was locked via 95 // Ensure that the black layer is visible -- if the screen was locked via
114 // the wrench menu, we won't have already shown the black background 96 // the wrench menu, we won't have already shown the black background
115 // as part of the slow-close animation. 97 // as part of the slow-close animation.
116 animator_->ShowBlackLayer(); 98 animator_->ShowBlackLayer();
117 99
118 animator_->StartAnimation( 100 animator_->StartAnimation(
119 internal::SessionStateAnimator::LAUNCHER, 101 internal::SessionStateAnimator::LAUNCHER,
120 internal::SessionStateAnimator::ANIMATION_HIDE); 102 internal::SessionStateAnimator::ANIMATION_HIDE);
121 103
122 animator_->StartAnimation( 104 animator_->StartAnimation(
123 internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, 105 internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
124 internal::SessionStateAnimator::ANIMATION_FAST_CLOSE); 106 internal::SessionStateAnimator::ANIMATION_FULL_CLOSE);
125 107
126 // Hide the screen locker containers so we can make them fade in later. 108 // Hide the screen locker containers so we can make them fade in later.
127 animator_->StartAnimation( 109 animator_->StartAnimation(
128 internal::SessionStateAnimator::LOCK_SCREEN_CONTAINERS, 110 internal::SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
129 internal::SessionStateAnimator::ANIMATION_HIDE); 111 internal::SessionStateAnimator::ANIMATION_HIDE);
130 } 112 }
131 113
132 void SessionStateController::StartLockAnimationAndLockImmediately() { 114 void SessionStateControllerImpl2::StartLockAnimationAndLockImmediately() {
133 animator_->ShowBlackLayer(); 115 animator_->ShowBlackLayer();
134 animator_->StartAnimation( 116 animator_->StartAnimation(
135 internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, 117 internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
136 internal::SessionStateAnimator::ANIMATION_SLOW_CLOSE); 118 internal::SessionStateAnimator::ANIMATION_PARTIAL_CLOSE);
137 OnLockTimeout(); 119 OnLockTimeout();
138 } 120 }
139 121
140 void SessionStateController::StartLockAnimation() { 122 void SessionStateControllerImpl2::StartLockAnimation(bool shutdown_after_lock) {
141 shutdown_after_lock_ = true; 123 shutdown_after_lock_ = shutdown_after_lock;
142 124
143 animator_->ShowBlackLayer(); 125 animator_->ShowBlackLayer();
144 animator_->StartAnimation( 126 animator_->StartAnimation(
145 internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, 127 internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
146 internal::SessionStateAnimator::ANIMATION_SLOW_CLOSE); 128 internal::SessionStateAnimator::ANIMATION_PARTIAL_CLOSE);
147 StartLockTimer(); 129 StartLockTimer();
148 } 130 }
149 131
150 void SessionStateController::StartShutdownAnimation() { 132 void SessionStateControllerImpl2::StartShutdownAnimation() {
151 animator_->ShowBlackLayer(); 133 animator_->ShowBlackLayer();
152 animator_->StartAnimation( 134 animator_->StartAnimation(
153 internal::SessionStateAnimator::kAllContainersMask, 135 internal::SessionStateAnimator::kAllContainersMask,
154 internal::SessionStateAnimator::ANIMATION_SLOW_CLOSE); 136 internal::SessionStateAnimator::ANIMATION_PARTIAL_CLOSE);
155 137
156 StartPreShutdownAnimationTimer(); 138 StartPreShutdownAnimationTimer();
157 } 139 }
158 140
159 bool SessionStateController::IsEligibleForLock() { 141 bool SessionStateControllerImpl2::IsEligibleForLock() {
160 return IsLoggedInAsNonGuest() && !IsLocked() && !LockRequested(); 142 return IsLoggedInAsNonGuest() && !IsLocked() && !LockRequested();
161 } 143 }
162 144
163 bool SessionStateController::IsLocked() { 145 bool SessionStateControllerImpl2::IsLocked() {
164 return login_status_ == user::LOGGED_IN_LOCKED; 146 return system_is_locked_;
165 } 147 }
166 148
167 bool SessionStateController::LockRequested() { 149 bool SessionStateControllerImpl2::LockRequested() {
168 return lock_fail_timer_.IsRunning(); 150 return lock_fail_timer_.IsRunning();
169 } 151 }
170 152
171 bool SessionStateController::ShutdownRequested() { 153 bool SessionStateControllerImpl2::ShutdownRequested() {
172 return shutting_down_; 154 return shutting_down_;
173 } 155 }
174 156
175 bool SessionStateController::CanCancelLockAnimation() { 157 bool SessionStateControllerImpl2::CanCancelLockAnimation() {
176 return lock_timer_.IsRunning(); 158 return lock_timer_.IsRunning();
177 } 159 }
178 160
179 void SessionStateController::CancelLockAnimation() { 161 void SessionStateControllerImpl2::CancelLockAnimation() {
180 if (!CanCancelLockAnimation())
181 return;
182 shutdown_after_lock_ = false;
183 animator_->StartAnimation(
184 internal::SessionStateAnimator::kAllContainersMask,
185 internal::SessionStateAnimator::ANIMATION_UNDO_SLOW_CLOSE);
186 animator_->ScheduleDropBlackLayer();
187 lock_timer_.Stop();
188 }
189
190 void SessionStateController::CancelLockWithOtherAnimation() {
191 if (!CanCancelLockAnimation()) 162 if (!CanCancelLockAnimation())
192 return; 163 return;
193 shutdown_after_lock_ = false; 164 shutdown_after_lock_ = false;
194 animator_->StartAnimation( 165 animator_->StartAnimation(
195 internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, 166 internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
196 internal::SessionStateAnimator::ANIMATION_UNDO_SLOW_CLOSE); 167 internal::SessionStateAnimator::ANIMATION_UNDO_PARTIAL_CLOSE);
197 animator_->ScheduleDropBlackLayer(); 168 animator_->ScheduleDropBlackLayer();
198 lock_timer_.Stop(); 169 lock_timer_.Stop();
199 } 170 }
200 171
201 bool SessionStateController::CanCancelShutdownAnimation() { 172 bool SessionStateControllerImpl2::CanCancelShutdownAnimation() {
202 return pre_shutdown_timer_.IsRunning() || 173 return pre_shutdown_timer_.IsRunning() ||
203 shutdown_after_lock_ || 174 shutdown_after_lock_ ||
204 lock_to_shutdown_timer_.IsRunning(); 175 lock_to_shutdown_timer_.IsRunning();
205 } 176 }
206 177
207 void SessionStateController::CancelShutdownAnimation() { 178 void SessionStateControllerImpl2::CancelShutdownAnimation() {
208 if (!CanCancelShutdownAnimation()) 179 if (!CanCancelShutdownAnimation())
209 return; 180 return;
210 if (lock_to_shutdown_timer_.IsRunning()) { 181 if (lock_to_shutdown_timer_.IsRunning()) {
211 lock_to_shutdown_timer_.Stop(); 182 lock_to_shutdown_timer_.Stop();
212 return; 183 return;
213 } 184 }
214 if (shutdown_after_lock_) { 185 if (shutdown_after_lock_) {
215 shutdown_after_lock_ = false; 186 shutdown_after_lock_ = false;
216 return; 187 return;
217 } 188 }
218 189
219 if (login_status_ == user::LOGGED_IN_LOCKED) { 190 if (system_is_locked_) {
220 // If we've already started shutdown transition at lock screen 191 // If we've already started shutdown transition at lock screen
221 // desktop background needs to be restored immediately. 192 // desktop background needs to be restored immediately.
222 animator_->StartAnimation( 193 animator_->StartAnimation(
223 internal::SessionStateAnimator::DESKTOP_BACKGROUND, 194 internal::SessionStateAnimator::DESKTOP_BACKGROUND,
224 internal::SessionStateAnimator::ANIMATION_RESTORE); 195 internal::SessionStateAnimator::ANIMATION_RESTORE);
225 animator_->StartAnimation( 196 animator_->StartAnimation(
226 internal::SessionStateAnimator::kAllLockScreenContainersMask, 197 internal::SessionStateAnimator::kAllLockScreenContainersMask,
227 internal::SessionStateAnimator::ANIMATION_UNDO_SLOW_CLOSE); 198 internal::SessionStateAnimator::ANIMATION_UNDO_PARTIAL_CLOSE);
228 animator_->ScheduleDropBlackLayer(); 199 animator_->ScheduleDropBlackLayer();
229 } else { 200 } else {
230 animator_->StartAnimation( 201 animator_->StartAnimation(
231 internal::SessionStateAnimator::kAllContainersMask, 202 internal::SessionStateAnimator::kAllContainersMask,
232 internal::SessionStateAnimator::ANIMATION_UNDO_SLOW_CLOSE); 203 internal::SessionStateAnimator::ANIMATION_UNDO_PARTIAL_CLOSE);
233 animator_->ScheduleDropBlackLayer(); 204 animator_->ScheduleDropBlackLayer();
234 } 205 }
235 pre_shutdown_timer_.Stop(); 206 pre_shutdown_timer_.Stop();
236 } 207 }
237 208
238 void SessionStateController::RequestShutdown() { 209 void SessionStateControllerImpl2::RequestShutdown() {
239 if (!shutting_down_) 210 if (!shutting_down_)
240 animator_->ShowBlackLayer(); 211 animator_->ShowBlackLayer();
241 RequestShutdownImpl(); 212 RequestShutdownImpl();
242 } 213 }
243 214
244 void SessionStateController::RequestShutdownImpl() { 215 void SessionStateControllerImpl2::RequestShutdownImpl() {
245 DCHECK(!shutting_down_); 216 DCHECK(!shutting_down_);
246 shutting_down_ = true; 217 shutting_down_ = true;
247 218
248 Shell* shell = ash::Shell::GetInstance(); 219 Shell* shell = ash::Shell::GetInstance();
249 shell->env_filter()->set_cursor_hidden_by_filter(false); 220 shell->env_filter()->set_cursor_hidden_by_filter(false);
250 shell->cursor_manager()->ShowCursor(false); 221 shell->cursor_manager()->ShowCursor(false);
251 222
252 animator_->ShowBlackLayer(); 223 animator_->ShowBlackLayer();
253 if (login_status_ != user::LOGGED_IN_NONE) { 224 if (login_status_ != user::LOGGED_IN_NONE) {
254 // Hide the other containers before starting the animation. 225 // Hide the other containers before starting the animation.
255 // ANIMATION_FAST_CLOSE will make the screen locker windows partially 226 // ANIMATION_FULL_CLOSE will make the screen locker windows partially
256 // transparent, and we don't want the other windows to show through. 227 // transparent, and we don't want the other windows to show through.
257 animator_->StartAnimation( 228 animator_->StartAnimation(
258 internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS | 229 internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS |
259 internal::SessionStateAnimator::LAUNCHER, 230 internal::SessionStateAnimator::LAUNCHER,
260 internal::SessionStateAnimator::ANIMATION_HIDE); 231 internal::SessionStateAnimator::ANIMATION_HIDE);
261 animator_->StartAnimation( 232 animator_->StartAnimation(
262 internal::SessionStateAnimator::kAllLockScreenContainersMask, 233 internal::SessionStateAnimator::kAllLockScreenContainersMask,
263 internal::SessionStateAnimator::ANIMATION_FAST_CLOSE); 234 internal::SessionStateAnimator::ANIMATION_FULL_CLOSE);
264 } else { 235 } else {
265 animator_->StartAnimation( 236 animator_->StartAnimation(
266 internal::SessionStateAnimator::kAllContainersMask, 237 internal::SessionStateAnimator::kAllContainersMask,
267 internal::SessionStateAnimator::ANIMATION_FAST_CLOSE); 238 internal::SessionStateAnimator::ANIMATION_FULL_CLOSE);
268 } 239 }
269 StartRealShutdownTimer(); 240 StartRealShutdownTimer();
270 } 241 }
271 242
272 void SessionStateController::OnRootWindowHostCloseRequested( 243 void SessionStateControllerImpl2::OnRootWindowHostCloseRequested(
273 const aura::RootWindow*) { 244 const aura::RootWindow*) {
274 if(Shell::GetInstance() && Shell::GetInstance()->delegate()) 245 if(Shell::GetInstance() && Shell::GetInstance()->delegate())
275 Shell::GetInstance()->delegate()->Exit(); 246 Shell::GetInstance()->delegate()->Exit();
276 } 247 }
277 248
278 bool SessionStateController::IsLoggedInAsNonGuest() const { 249 bool SessionStateControllerImpl2::IsLoggedInAsNonGuest() const {
279 // TODO(mukai): think about kiosk mode. 250 // TODO(mukai): think about kiosk mode.
280 return (login_status_ != user::LOGGED_IN_NONE) && 251 return (login_status_ != user::LOGGED_IN_NONE) &&
281 (login_status_ != user::LOGGED_IN_GUEST); 252 (login_status_ != user::LOGGED_IN_GUEST);
282 } 253 }
283 254
284 void SessionStateController::StartLockTimer() { 255 void SessionStateControllerImpl2::StartLockTimer() {
285 lock_timer_.Stop(); 256 lock_timer_.Stop();
286 lock_timer_.Start(FROM_HERE, 257 lock_timer_.Start(FROM_HERE,
287 base::TimeDelta::FromMilliseconds(kSlowCloseAnimMs), 258 base::TimeDelta::FromMilliseconds(kSlowCloseAnimMs),
288 this, &SessionStateController::OnLockTimeout); 259 this, &SessionStateControllerImpl2::OnLockTimeout);
289 } 260 }
290 261
291 void SessionStateController::OnLockTimeout() { 262 void SessionStateControllerImpl2::OnLockTimeout() {
292 delegate_->RequestLockScreen(); 263 delegate_->RequestLockScreen();
293 lock_fail_timer_.Start( 264 lock_fail_timer_.Start(
294 FROM_HERE, 265 FROM_HERE,
295 base::TimeDelta::FromMilliseconds(kLockFailTimeoutMs), 266 base::TimeDelta::FromMilliseconds(kLockFailTimeoutMs),
296 this, &SessionStateController::OnLockFailTimeout); 267 this, &SessionStateControllerImpl2::OnLockFailTimeout);
297 } 268 }
298 269
299 void SessionStateController::OnLockFailTimeout() { 270 void SessionStateControllerImpl2::OnLockFailTimeout() {
300 DCHECK_NE(login_status_, user::LOGGED_IN_LOCKED); 271 DCHECK(!system_is_locked_);
301 // Undo lock animation. 272 // Undo lock animation.
302 animator_->StartAnimation( 273 animator_->StartAnimation(
303 internal::SessionStateAnimator::LAUNCHER | 274 internal::SessionStateAnimator::LAUNCHER |
304 internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, 275 internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
305 internal::SessionStateAnimator::ANIMATION_RESTORE); 276 internal::SessionStateAnimator::ANIMATION_RESTORE);
306 animator_->DropBlackLayer(); 277 animator_->DropBlackLayer();
307 } 278 }
308 279
309 void SessionStateController::StartLockToShutdownTimer() { 280 void SessionStateControllerImpl2::StartLockToShutdownTimer() {
310 shutdown_after_lock_ = false; 281 shutdown_after_lock_ = false;
311 lock_to_shutdown_timer_.Stop(); 282 lock_to_shutdown_timer_.Stop();
312 lock_to_shutdown_timer_.Start( 283 lock_to_shutdown_timer_.Start(
313 FROM_HERE, 284 FROM_HERE,
314 base::TimeDelta::FromMilliseconds(kLockToShutdownTimeoutMs), 285 base::TimeDelta::FromMilliseconds(kLockToShutdownTimeoutMs),
315 this, &SessionStateController::OnLockToShutdownTimeout); 286 this, &SessionStateControllerImpl2::OnLockToShutdownTimeout);
316 } 287 }
317 288
318 289
319 void SessionStateController::OnLockToShutdownTimeout() { 290 void SessionStateControllerImpl2::OnLockToShutdownTimeout() {
320 DCHECK_EQ(login_status_, user::LOGGED_IN_LOCKED); 291 DCHECK(system_is_locked_);
321 StartShutdownAnimation(); 292 StartShutdownAnimation();
322 } 293 }
323 294
324 void SessionStateController::StartPreShutdownAnimationTimer() { 295 void SessionStateControllerImpl2::StartPreShutdownAnimationTimer() {
325 pre_shutdown_timer_.Stop(); 296 pre_shutdown_timer_.Stop();
326 pre_shutdown_timer_.Start( 297 pre_shutdown_timer_.Start(
327 FROM_HERE, 298 FROM_HERE,
328 base::TimeDelta::FromMilliseconds(kShutdownTimeoutMs), 299 base::TimeDelta::FromMilliseconds(kShutdownTimeoutMs),
329 this, &SessionStateController::OnPreShutdownAnimationTimeout); 300 this, &SessionStateControllerImpl2::OnPreShutdownAnimationTimeout);
330 } 301 }
331 302
332 void SessionStateController::OnPreShutdownAnimationTimeout() { 303 void SessionStateControllerImpl2::OnPreShutdownAnimationTimeout() {
333 if (!shutting_down_) 304 if (!shutting_down_)
334 RequestShutdownImpl(); 305 RequestShutdownImpl();
335 } 306 }
336 307
337 void SessionStateController::StartRealShutdownTimer() { 308 void SessionStateControllerImpl2::StartRealShutdownTimer() {
338 real_shutdown_timer_.Start( 309 real_shutdown_timer_.Start(
339 FROM_HERE, 310 FROM_HERE,
340 base::TimeDelta::FromMilliseconds(kFastCloseAnimMs + 311 base::TimeDelta::FromMilliseconds(kFastCloseAnimMs +
341 kShutdownRequestDelayMs), 312 kShutdownRequestDelayMs),
342 this, &SessionStateController::OnRealShutdownTimeout); 313 this, &SessionStateControllerImpl2::OnRealShutdownTimeout);
343 } 314 }
344 315
345 void SessionStateController::OnRealShutdownTimeout() { 316 void SessionStateControllerImpl2::OnRealShutdownTimeout() {
346 DCHECK(shutting_down_); 317 DCHECK(shutting_down_);
347 #if defined(OS_CHROMEOS) 318 #if defined(OS_CHROMEOS)
348 if (!base::chromeos::IsRunningOnChromeOS()) { 319 if (!base::chromeos::IsRunningOnChromeOS()) {
349 ShellDelegate* delegate = Shell::GetInstance()->delegate(); 320 ShellDelegate* delegate = Shell::GetInstance()->delegate();
350 if (delegate) { 321 if (delegate) {
351 delegate->Exit(); 322 delegate->Exit();
352 return; 323 return;
353 } 324 }
354 } 325 }
355 #endif 326 #endif
356 delegate_->RequestShutdown(); 327 delegate_->RequestShutdown();
357 } 328 }
358 329
359 } // namespace ash 330 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698