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

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

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « ash/wm/lock_state_controller.h ('k') | ash/wm/lock_state_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/lock_state_controller.h" 5 #include "ash/wm/lock_state_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 static const int kTimeoutMultiplier = 2; 68 static const int kTimeoutMultiplier = 2;
69 #else 69 #else
70 static const int kTimeoutMultiplier = 1; 70 static const int kTimeoutMultiplier = 1;
71 #endif 71 #endif
72 72
73 const int LockStateController::kLockFailTimeoutMs = 8000 * kTimeoutMultiplier; 73 const int LockStateController::kLockFailTimeoutMs = 8000 * kTimeoutMultiplier;
74 const int LockStateController::kLockToShutdownTimeoutMs = 150; 74 const int LockStateController::kLockToShutdownTimeoutMs = 150;
75 const int LockStateController::kShutdownRequestDelayMs = 50; 75 const int LockStateController::kShutdownRequestDelayMs = 50;
76 76
77 LockStateController::TestApi::TestApi(LockStateController* controller) 77 LockStateController::TestApi::TestApi(LockStateController* controller)
78 : controller_(controller) { 78 : controller_(controller) {}
79 }
80 79
81 LockStateController::TestApi::~TestApi() { 80 LockStateController::TestApi::~TestApi() {}
82 }
83 81
84 LockStateController::LockStateController() 82 LockStateController::LockStateController()
85 : animator_(new SessionStateAnimatorImpl()), 83 : animator_(new SessionStateAnimatorImpl()),
86 login_status_(LoginStatus::NOT_LOGGED_IN), 84 login_status_(LoginStatus::NOT_LOGGED_IN),
87 system_is_locked_(false), 85 system_is_locked_(false),
88 shutting_down_(false), 86 shutting_down_(false),
89 shutdown_after_lock_(false), 87 shutdown_after_lock_(false),
90 animating_lock_(false), 88 animating_lock_(false),
91 can_cancel_lock_animation_(false), 89 can_cancel_lock_animation_(false),
92 weak_ptr_factory_(this) { 90 weak_ptr_factory_(this) {
(...skipping 14 matching lines...) Expand all
107 } 105 }
108 106
109 void LockStateController::RemoveObserver(LockStateObserver* observer) { 107 void LockStateController::RemoveObserver(LockStateObserver* observer) {
110 observers_.RemoveObserver(observer); 108 observers_.RemoveObserver(observer);
111 } 109 }
112 110
113 bool LockStateController::HasObserver(const LockStateObserver* observer) const { 111 bool LockStateController::HasObserver(const LockStateObserver* observer) const {
114 return observers_.HasObserver(observer); 112 return observers_.HasObserver(observer);
115 } 113 }
116 114
117 void LockStateController::StartLockAnimation( 115 void LockStateController::StartLockAnimation(bool shutdown_after_lock) {
118 bool shutdown_after_lock) {
119 if (animating_lock_) 116 if (animating_lock_)
120 return; 117 return;
121 shutdown_after_lock_ = shutdown_after_lock; 118 shutdown_after_lock_ = shutdown_after_lock;
122 can_cancel_lock_animation_ = true; 119 can_cancel_lock_animation_ = true;
123 120
124 StartCancellablePreLockAnimation(); 121 StartCancellablePreLockAnimation();
125 } 122 }
126 123
127 void LockStateController::StartShutdownAnimation() { 124 void LockStateController::StartShutdownAnimation() {
128 StartCancellableShutdownAnimation(); 125 StartCancellableShutdownAnimation();
(...skipping 21 matching lines...) Expand all
150 147
151 void LockStateController::CancelLockAnimation() { 148 void LockStateController::CancelLockAnimation() {
152 if (!CanCancelLockAnimation()) 149 if (!CanCancelLockAnimation())
153 return; 150 return;
154 shutdown_after_lock_ = false; 151 shutdown_after_lock_ = false;
155 animating_lock_ = false; 152 animating_lock_ = false;
156 CancelPreLockAnimation(); 153 CancelPreLockAnimation();
157 } 154 }
158 155
159 bool LockStateController::CanCancelShutdownAnimation() { 156 bool LockStateController::CanCancelShutdownAnimation() {
160 return pre_shutdown_timer_.IsRunning() || 157 return pre_shutdown_timer_.IsRunning() || shutdown_after_lock_ ||
161 shutdown_after_lock_ ||
162 lock_to_shutdown_timer_.IsRunning(); 158 lock_to_shutdown_timer_.IsRunning();
163 } 159 }
164 160
165 void LockStateController::CancelShutdownAnimation() { 161 void LockStateController::CancelShutdownAnimation() {
166 if (!CanCancelShutdownAnimation()) 162 if (!CanCancelShutdownAnimation())
167 return; 163 return;
168 if (lock_to_shutdown_timer_.IsRunning()) { 164 if (lock_to_shutdown_timer_.IsRunning()) {
169 lock_to_shutdown_timer_.Stop(); 165 lock_to_shutdown_timer_.Stop();
170 return; 166 return;
171 } 167 }
(...skipping 28 matching lines...) Expand all
200 shell->cursor_manager()->LockCursor(); 196 shell->cursor_manager()->LockCursor();
201 197
202 animator_->StartAnimation( 198 animator_->StartAnimation(
203 SessionStateAnimator::ROOT_CONTAINER, 199 SessionStateAnimator::ROOT_CONTAINER,
204 SessionStateAnimator::ANIMATION_GRAYSCALE_BRIGHTNESS, 200 SessionStateAnimator::ANIMATION_GRAYSCALE_BRIGHTNESS,
205 SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN); 201 SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN);
206 StartRealShutdownTimer(true); 202 StartRealShutdownTimer(true);
207 } 203 }
208 204
209 void LockStateController::OnLockScreenHide( 205 void LockStateController::OnLockScreenHide(
210 base::Callback<void(void)>& callback) { 206 base::Callback<void(void)>& callback) {
211 StartUnlockAnimationBeforeUIDestroyed(callback); 207 StartUnlockAnimationBeforeUIDestroyed(callback);
212 } 208 }
213 209
214 void LockStateController::SetLockScreenDisplayedCallback( 210 void LockStateController::SetLockScreenDisplayedCallback(
215 const base::Closure& callback) { 211 const base::Closure& callback) {
216 lock_screen_displayed_callback_ = callback; 212 lock_screen_displayed_callback_ = callback;
217 } 213 }
218 214
219 void LockStateController::OnHostCloseRequested( 215 void LockStateController::OnHostCloseRequested(
220 const aura::WindowTreeHost* host) { 216 const aura::WindowTreeHost* host) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 lock_duration_timer_.reset(); 272 lock_duration_timer_.reset();
277 DCHECK(!system_is_locked_); 273 DCHECK(!system_is_locked_);
278 274
279 LOG(FATAL) << "Screen lock took too long; crashing intentionally"; 275 LOG(FATAL) << "Screen lock took too long; crashing intentionally";
280 } 276 }
281 277
282 void LockStateController::StartLockToShutdownTimer() { 278 void LockStateController::StartLockToShutdownTimer() {
283 shutdown_after_lock_ = false; 279 shutdown_after_lock_ = false;
284 lock_to_shutdown_timer_.Stop(); 280 lock_to_shutdown_timer_.Stop();
285 lock_to_shutdown_timer_.Start( 281 lock_to_shutdown_timer_.Start(
286 FROM_HERE, 282 FROM_HERE, base::TimeDelta::FromMilliseconds(kLockToShutdownTimeoutMs),
287 base::TimeDelta::FromMilliseconds(kLockToShutdownTimeoutMs),
288 this, &LockStateController::OnLockToShutdownTimeout); 283 this, &LockStateController::OnLockToShutdownTimeout);
289 } 284 }
290 285
291 void LockStateController::OnLockToShutdownTimeout() { 286 void LockStateController::OnLockToShutdownTimeout() {
292 DCHECK(system_is_locked_); 287 DCHECK(system_is_locked_);
293 StartCancellableShutdownAnimation(); 288 StartCancellableShutdownAnimation();
294 } 289 }
295 290
296 void LockStateController::StartPreShutdownAnimationTimer() { 291 void LockStateController::StartPreShutdownAnimationTimer() {
297 pre_shutdown_timer_.Stop(); 292 pre_shutdown_timer_.Stop();
298 pre_shutdown_timer_.Start( 293 pre_shutdown_timer_.Start(
299 FROM_HERE, 294 FROM_HERE,
300 animator_->GetDuration(SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN), 295 animator_->GetDuration(SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN),
301 this, 296 this, &LockStateController::OnPreShutdownAnimationTimeout);
302 &LockStateController::OnPreShutdownAnimationTimeout);
303 } 297 }
304 298
305 void LockStateController::OnPreShutdownAnimationTimeout() { 299 void LockStateController::OnPreShutdownAnimationTimeout() {
306 VLOG(1) << "OnPreShutdownAnimationTimeout"; 300 VLOG(1) << "OnPreShutdownAnimationTimeout";
307 shutting_down_ = true; 301 shutting_down_ = true;
308 302
309 Shell* shell = Shell::GetInstance(); 303 Shell* shell = Shell::GetInstance();
310 shell->cursor_manager()->HideCursor(); 304 shell->cursor_manager()->HideCursor();
311 305
312 StartRealShutdownTimer(false); 306 StartRealShutdownTimer(false);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 358 }
365 359
366 void LockStateController::StartImmediatePreLockAnimation( 360 void LockStateController::StartImmediatePreLockAnimation(
367 bool request_lock_on_completion) { 361 bool request_lock_on_completion) {
368 VLOG(1) << "StartImmediatePreLockAnimation " << request_lock_on_completion; 362 VLOG(1) << "StartImmediatePreLockAnimation " << request_lock_on_completion;
369 animating_lock_ = true; 363 animating_lock_ = true;
370 StoreUnlockedProperties(); 364 StoreUnlockedProperties();
371 365
372 base::Closure next_animation_starter = 366 base::Closure next_animation_starter =
373 base::Bind(&LockStateController::PreLockAnimationFinished, 367 base::Bind(&LockStateController::PreLockAnimationFinished,
374 weak_ptr_factory_.GetWeakPtr(), 368 weak_ptr_factory_.GetWeakPtr(), request_lock_on_completion);
375 request_lock_on_completion);
376 SessionStateAnimator::AnimationSequence* animation_sequence = 369 SessionStateAnimator::AnimationSequence* animation_sequence =
377 animator_->BeginAnimationSequence(next_animation_starter); 370 animator_->BeginAnimationSequence(next_animation_starter);
378 371
379 animation_sequence->StartAnimation( 372 animation_sequence->StartAnimation(
380 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, 373 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
381 SessionStateAnimator::ANIMATION_LIFT, 374 SessionStateAnimator::ANIMATION_LIFT,
382 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); 375 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS);
383 animation_sequence->StartAnimation( 376 animation_sequence->StartAnimation(
384 SessionStateAnimator::LAUNCHER, 377 SessionStateAnimator::LAUNCHER, SessionStateAnimator::ANIMATION_FADE_OUT,
385 SessionStateAnimator::ANIMATION_FADE_OUT,
386 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); 378 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS);
387 // Hide the screen locker containers so we can raise them later. 379 // Hide the screen locker containers so we can raise them later.
388 animator_->StartAnimation(SessionStateAnimator::LOCK_SCREEN_CONTAINERS, 380 animator_->StartAnimation(SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
389 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY, 381 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY,
390 SessionStateAnimator::ANIMATION_SPEED_IMMEDIATE); 382 SessionStateAnimator::ANIMATION_SPEED_IMMEDIATE);
391 AnimateBackgroundAppearanceIfNecessary( 383 AnimateBackgroundAppearanceIfNecessary(
392 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS, animation_sequence); 384 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS, animation_sequence);
393 385
394 animation_sequence->EndSequence(); 386 animation_sequence->EndSequence();
395 387
396 DispatchCancelMode(); 388 DispatchCancelMode();
397 FOR_EACH_OBSERVER(LockStateObserver, observers_, 389 FOR_EACH_OBSERVER(
390 LockStateObserver, observers_,
398 OnLockStateEvent(LockStateObserver::EVENT_LOCK_ANIMATION_STARTED)); 391 OnLockStateEvent(LockStateObserver::EVENT_LOCK_ANIMATION_STARTED));
399 } 392 }
400 393
401 void LockStateController::StartCancellablePreLockAnimation() { 394 void LockStateController::StartCancellablePreLockAnimation() {
402 animating_lock_ = true; 395 animating_lock_ = true;
403 StoreUnlockedProperties(); 396 StoreUnlockedProperties();
404 VLOG(1) << "StartCancellablePreLockAnimation"; 397 VLOG(1) << "StartCancellablePreLockAnimation";
405 base::Closure next_animation_starter = 398 base::Closure next_animation_starter =
406 base::Bind(&LockStateController::PreLockAnimationFinished, 399 base::Bind(&LockStateController::PreLockAnimationFinished,
407 weak_ptr_factory_.GetWeakPtr(), 400 weak_ptr_factory_.GetWeakPtr(), true /* request_lock */);
408 true /* request_lock */);
409 SessionStateAnimator::AnimationSequence* animation_sequence = 401 SessionStateAnimator::AnimationSequence* animation_sequence =
410 animator_->BeginAnimationSequence(next_animation_starter); 402 animator_->BeginAnimationSequence(next_animation_starter);
411 403
412 animation_sequence->StartAnimation( 404 animation_sequence->StartAnimation(
413 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, 405 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
414 SessionStateAnimator::ANIMATION_LIFT, 406 SessionStateAnimator::ANIMATION_LIFT,
415 SessionStateAnimator::ANIMATION_SPEED_UNDOABLE); 407 SessionStateAnimator::ANIMATION_SPEED_UNDOABLE);
416 animation_sequence->StartAnimation( 408 animation_sequence->StartAnimation(
417 SessionStateAnimator::LAUNCHER, 409 SessionStateAnimator::LAUNCHER, SessionStateAnimator::ANIMATION_FADE_OUT,
418 SessionStateAnimator::ANIMATION_FADE_OUT,
419 SessionStateAnimator::ANIMATION_SPEED_UNDOABLE); 410 SessionStateAnimator::ANIMATION_SPEED_UNDOABLE);
420 // Hide the screen locker containers so we can raise them later. 411 // Hide the screen locker containers so we can raise them later.
421 animator_->StartAnimation(SessionStateAnimator::LOCK_SCREEN_CONTAINERS, 412 animator_->StartAnimation(SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
422 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY, 413 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY,
423 SessionStateAnimator::ANIMATION_SPEED_IMMEDIATE); 414 SessionStateAnimator::ANIMATION_SPEED_IMMEDIATE);
424 AnimateBackgroundAppearanceIfNecessary( 415 AnimateBackgroundAppearanceIfNecessary(
425 SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, animation_sequence); 416 SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, animation_sequence);
426 417
427 DispatchCancelMode(); 418 DispatchCancelMode();
428 FOR_EACH_OBSERVER(LockStateObserver, observers_, 419 FOR_EACH_OBSERVER(
420 LockStateObserver, observers_,
429 OnLockStateEvent(LockStateObserver::EVENT_PRELOCK_ANIMATION_STARTED)); 421 OnLockStateEvent(LockStateObserver::EVENT_PRELOCK_ANIMATION_STARTED));
430 animation_sequence->EndSequence(); 422 animation_sequence->EndSequence();
431 } 423 }
432 424
433 void LockStateController::CancelPreLockAnimation() { 425 void LockStateController::CancelPreLockAnimation() {
434 VLOG(1) << "CancelPreLockAnimation"; 426 VLOG(1) << "CancelPreLockAnimation";
435 base::Closure next_animation_starter = 427 base::Closure next_animation_starter =
436 base::Bind(&LockStateController::LockAnimationCancelled, 428 base::Bind(&LockStateController::LockAnimationCancelled,
437 weak_ptr_factory_.GetWeakPtr()); 429 weak_ptr_factory_.GetWeakPtr());
438 SessionStateAnimator::AnimationSequence* animation_sequence = 430 SessionStateAnimator::AnimationSequence* animation_sequence =
439 animator_->BeginAnimationSequence(next_animation_starter); 431 animator_->BeginAnimationSequence(next_animation_starter);
440 432
441 animation_sequence->StartAnimation( 433 animation_sequence->StartAnimation(
442 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, 434 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
443 SessionStateAnimator::ANIMATION_UNDO_LIFT, 435 SessionStateAnimator::ANIMATION_UNDO_LIFT,
444 SessionStateAnimator::ANIMATION_SPEED_UNDO_MOVE_WINDOWS); 436 SessionStateAnimator::ANIMATION_SPEED_UNDO_MOVE_WINDOWS);
445 animation_sequence->StartAnimation( 437 animation_sequence->StartAnimation(
446 SessionStateAnimator::LAUNCHER, 438 SessionStateAnimator::LAUNCHER, SessionStateAnimator::ANIMATION_FADE_IN,
447 SessionStateAnimator::ANIMATION_FADE_IN,
448 SessionStateAnimator::ANIMATION_SPEED_UNDO_MOVE_WINDOWS); 439 SessionStateAnimator::ANIMATION_SPEED_UNDO_MOVE_WINDOWS);
449 AnimateBackgroundHidingIfNecessary( 440 AnimateBackgroundHidingIfNecessary(
450 SessionStateAnimator::ANIMATION_SPEED_UNDO_MOVE_WINDOWS, 441 SessionStateAnimator::ANIMATION_SPEED_UNDO_MOVE_WINDOWS,
451 animation_sequence); 442 animation_sequence);
452 443
453 animation_sequence->EndSequence(); 444 animation_sequence->EndSequence();
454 } 445 }
455 446
456 void LockStateController::StartPostLockAnimation() { 447 void LockStateController::StartPostLockAnimation() {
457 VLOG(1) << "StartPostLockAnimation"; 448 VLOG(1) << "StartPostLockAnimation";
458 base::Closure next_animation_starter = 449 base::Closure next_animation_starter =
459 base::Bind(&LockStateController::PostLockAnimationFinished, 450 base::Bind(&LockStateController::PostLockAnimationFinished,
460 weak_ptr_factory_.GetWeakPtr()); 451 weak_ptr_factory_.GetWeakPtr());
461 SessionStateAnimator::AnimationSequence* animation_sequence = 452 SessionStateAnimator::AnimationSequence* animation_sequence =
462 animator_->BeginAnimationSequence(next_animation_starter); 453 animator_->BeginAnimationSequence(next_animation_starter);
463 454
464 animation_sequence->StartAnimation( 455 animation_sequence->StartAnimation(
465 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, 456 SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
466 SessionStateAnimator::ANIMATION_RAISE_TO_SCREEN, 457 SessionStateAnimator::ANIMATION_RAISE_TO_SCREEN,
467 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); 458 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS);
468 animation_sequence->EndSequence(); 459 animation_sequence->EndSequence();
469 } 460 }
470 461
471 void LockStateController::StartUnlockAnimationBeforeUIDestroyed( 462 void LockStateController::StartUnlockAnimationBeforeUIDestroyed(
472 base::Closure& callback) { 463 base::Closure& callback) {
473 VLOG(1) << "StartUnlockAnimationBeforeUIDestroyed"; 464 VLOG(1) << "StartUnlockAnimationBeforeUIDestroyed";
474 animator_->StartAnimationWithCallback( 465 animator_->StartAnimationWithCallback(
475 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, 466 SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
476 SessionStateAnimator::ANIMATION_LIFT, 467 SessionStateAnimator::ANIMATION_LIFT,
477 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS, 468 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS, callback);
478 callback);
479 } 469 }
480 470
481 void LockStateController::StartUnlockAnimationAfterUIDestroyed() { 471 void LockStateController::StartUnlockAnimationAfterUIDestroyed() {
482 VLOG(1) << "StartUnlockAnimationAfterUIDestroyed"; 472 VLOG(1) << "StartUnlockAnimationAfterUIDestroyed";
483 base::Closure next_animation_starter = 473 base::Closure next_animation_starter =
484 base::Bind(&LockStateController::UnlockAnimationAfterUIDestroyedFinished, 474 base::Bind(&LockStateController::UnlockAnimationAfterUIDestroyedFinished,
485 weak_ptr_factory_.GetWeakPtr()); 475 weak_ptr_factory_.GetWeakPtr());
486 SessionStateAnimator::AnimationSequence* animation_sequence = 476 SessionStateAnimator::AnimationSequence* animation_sequence =
487 animator_->BeginAnimationSequence(next_animation_starter); 477 animator_->BeginAnimationSequence(next_animation_starter);
488 478
489 animation_sequence->StartAnimation( 479 animation_sequence->StartAnimation(
490 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, 480 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
491 SessionStateAnimator::ANIMATION_DROP, 481 SessionStateAnimator::ANIMATION_DROP,
492 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); 482 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS);
493 animation_sequence->StartAnimation( 483 animation_sequence->StartAnimation(
494 SessionStateAnimator::LAUNCHER, 484 SessionStateAnimator::LAUNCHER, SessionStateAnimator::ANIMATION_FADE_IN,
495 SessionStateAnimator::ANIMATION_FADE_IN,
496 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); 485 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS);
497 AnimateBackgroundHidingIfNecessary( 486 AnimateBackgroundHidingIfNecessary(
498 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS, animation_sequence); 487 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS, animation_sequence);
499 animation_sequence->EndSequence(); 488 animation_sequence->EndSequence();
500 } 489 }
501 490
502 void LockStateController::LockAnimationCancelled() { 491 void LockStateController::LockAnimationCancelled() {
503 can_cancel_lock_animation_ = false; 492 can_cancel_lock_animation_ = false;
504 RestoreUnlockedProperties(); 493 RestoreUnlockedProperties();
505 } 494 }
(...skipping 22 matching lines...) Expand all
528 #if defined(OS_CHROMEOS) 517 #if defined(OS_CHROMEOS)
529 // Increase lock timeout for slower hardware, see http://crbug.com/350628 518 // Increase lock timeout for slower hardware, see http://crbug.com/350628
530 const std::string board = base::SysInfo::GetLsbReleaseBoard(); 519 const std::string board = base::SysInfo::GetLsbReleaseBoard();
531 if (board == "x86-mario" || 520 if (board == "x86-mario" ||
532 base::StartsWith(board, "x86-alex", base::CompareCase::SENSITIVE) || 521 base::StartsWith(board, "x86-alex", base::CompareCase::SENSITIVE) ||
533 base::StartsWith(board, "x86-zgb", base::CompareCase::SENSITIVE) || 522 base::StartsWith(board, "x86-zgb", base::CompareCase::SENSITIVE) ||
534 base::StartsWith(board, "daisy", base::CompareCase::SENSITIVE)) { 523 base::StartsWith(board, "daisy", base::CompareCase::SENSITIVE)) {
535 timeout *= 2; 524 timeout *= 2;
536 } 525 }
537 #endif 526 #endif
538 lock_fail_timer_.Start( 527 lock_fail_timer_.Start(FROM_HERE, timeout, this,
539 FROM_HERE, timeout, this, &LockStateController::OnLockFailTimeout); 528 &LockStateController::OnLockFailTimeout);
540 529
541 lock_duration_timer_.reset(new base::ElapsedTimer()); 530 lock_duration_timer_.reset(new base::ElapsedTimer());
542 } 531 }
543 532
544 void LockStateController::PostLockAnimationFinished() { 533 void LockStateController::PostLockAnimationFinished() {
545 animating_lock_ = false; 534 animating_lock_ = false;
546 VLOG(1) << "PostLockAnimationFinished"; 535 VLOG(1) << "PostLockAnimationFinished";
547 FOR_EACH_OBSERVER(LockStateObserver, observers_, 536 FOR_EACH_OBSERVER(
537 LockStateObserver, observers_,
548 OnLockStateEvent(LockStateObserver::EVENT_LOCK_ANIMATION_FINISHED)); 538 OnLockStateEvent(LockStateObserver::EVENT_LOCK_ANIMATION_FINISHED));
549 if (!lock_screen_displayed_callback_.is_null()) { 539 if (!lock_screen_displayed_callback_.is_null()) {
550 lock_screen_displayed_callback_.Run(); 540 lock_screen_displayed_callback_.Run();
551 lock_screen_displayed_callback_.Reset(); 541 lock_screen_displayed_callback_.Reset();
552 } 542 }
553 CHECK(!views::MenuController::GetActiveInstance()); 543 CHECK(!views::MenuController::GetActiveInstance());
554 if (shutdown_after_lock_) { 544 if (shutdown_after_lock_) {
555 shutdown_after_lock_ = false; 545 shutdown_after_lock_ = false;
556 StartLockToShutdownTimer(); 546 StartLockToShutdownTimer();
557 } 547 }
(...skipping 29 matching lines...) Expand all
587 SessionStateAnimator::ANIMATION_SPEED_IMMEDIATE); 577 SessionStateAnimator::ANIMATION_SPEED_IMMEDIATE);
588 } 578 }
589 unlocked_properties_.reset(); 579 unlocked_properties_.reset();
590 } 580 }
591 581
592 void LockStateController::AnimateBackgroundAppearanceIfNecessary( 582 void LockStateController::AnimateBackgroundAppearanceIfNecessary(
593 SessionStateAnimator::AnimationSpeed speed, 583 SessionStateAnimator::AnimationSpeed speed,
594 SessionStateAnimator::AnimationSequence* animation_sequence) { 584 SessionStateAnimator::AnimationSequence* animation_sequence) {
595 if (unlocked_properties_.get() && 585 if (unlocked_properties_.get() &&
596 unlocked_properties_->background_is_hidden) { 586 unlocked_properties_->background_is_hidden) {
597 animation_sequence->StartAnimation( 587 animation_sequence->StartAnimation(SessionStateAnimator::DESKTOP_BACKGROUND,
598 SessionStateAnimator::DESKTOP_BACKGROUND, 588 SessionStateAnimator::ANIMATION_FADE_IN,
599 SessionStateAnimator::ANIMATION_FADE_IN, 589 speed);
600 speed);
601 } 590 }
602 } 591 }
603 592
604 void LockStateController::AnimateBackgroundHidingIfNecessary( 593 void LockStateController::AnimateBackgroundHidingIfNecessary(
605 SessionStateAnimator::AnimationSpeed speed, 594 SessionStateAnimator::AnimationSpeed speed,
606 SessionStateAnimator::AnimationSequence* animation_sequence) { 595 SessionStateAnimator::AnimationSequence* animation_sequence) {
607 if (unlocked_properties_.get() && 596 if (unlocked_properties_.get() &&
608 unlocked_properties_->background_is_hidden) { 597 unlocked_properties_->background_is_hidden) {
609 animation_sequence->StartAnimation( 598 animation_sequence->StartAnimation(SessionStateAnimator::DESKTOP_BACKGROUND,
610 SessionStateAnimator::DESKTOP_BACKGROUND, 599 SessionStateAnimator::ANIMATION_FADE_OUT,
611 SessionStateAnimator::ANIMATION_FADE_OUT, 600 speed);
612 speed);
613 } 601 }
614 } 602 }
615 603
616 } // namespace ash 604 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/lock_state_controller.h ('k') | ash/wm/lock_state_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698