OLD | NEW |
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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, | 357 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, |
358 SessionStateAnimator::ANIMATION_LIFT, | 358 SessionStateAnimator::ANIMATION_LIFT, |
359 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 359 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); |
360 animation_sequence->StartAnimation( | 360 animation_sequence->StartAnimation( |
361 SessionStateAnimator::LAUNCHER, SessionStateAnimator::ANIMATION_FADE_OUT, | 361 SessionStateAnimator::LAUNCHER, SessionStateAnimator::ANIMATION_FADE_OUT, |
362 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 362 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); |
363 // Hide the screen locker containers so we can raise them later. | 363 // Hide the screen locker containers so we can raise them later. |
364 animator_->StartAnimation(SessionStateAnimator::LOCK_SCREEN_CONTAINERS, | 364 animator_->StartAnimation(SessionStateAnimator::LOCK_SCREEN_CONTAINERS, |
365 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY, | 365 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY, |
366 SessionStateAnimator::ANIMATION_SPEED_IMMEDIATE); | 366 SessionStateAnimator::ANIMATION_SPEED_IMMEDIATE); |
367 AnimateBackgroundAppearanceIfNecessary( | 367 AnimateWallpaperAppearanceIfNecessary( |
368 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS, animation_sequence); | 368 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS, animation_sequence); |
369 | 369 |
370 animation_sequence->EndSequence(); | 370 animation_sequence->EndSequence(); |
371 | 371 |
372 DispatchCancelMode(); | 372 DispatchCancelMode(); |
373 WmShell::Get()->OnLockStateEvent( | 373 WmShell::Get()->OnLockStateEvent( |
374 LockStateObserver::EVENT_LOCK_ANIMATION_STARTED); | 374 LockStateObserver::EVENT_LOCK_ANIMATION_STARTED); |
375 } | 375 } |
376 | 376 |
377 void LockStateController::StartCancellablePreLockAnimation() { | 377 void LockStateController::StartCancellablePreLockAnimation() { |
(...skipping 10 matching lines...) Expand all Loading... |
388 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, | 388 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, |
389 SessionStateAnimator::ANIMATION_LIFT, | 389 SessionStateAnimator::ANIMATION_LIFT, |
390 SessionStateAnimator::ANIMATION_SPEED_UNDOABLE); | 390 SessionStateAnimator::ANIMATION_SPEED_UNDOABLE); |
391 animation_sequence->StartAnimation( | 391 animation_sequence->StartAnimation( |
392 SessionStateAnimator::LAUNCHER, SessionStateAnimator::ANIMATION_FADE_OUT, | 392 SessionStateAnimator::LAUNCHER, SessionStateAnimator::ANIMATION_FADE_OUT, |
393 SessionStateAnimator::ANIMATION_SPEED_UNDOABLE); | 393 SessionStateAnimator::ANIMATION_SPEED_UNDOABLE); |
394 // Hide the screen locker containers so we can raise them later. | 394 // Hide the screen locker containers so we can raise them later. |
395 animator_->StartAnimation(SessionStateAnimator::LOCK_SCREEN_CONTAINERS, | 395 animator_->StartAnimation(SessionStateAnimator::LOCK_SCREEN_CONTAINERS, |
396 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY, | 396 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY, |
397 SessionStateAnimator::ANIMATION_SPEED_IMMEDIATE); | 397 SessionStateAnimator::ANIMATION_SPEED_IMMEDIATE); |
398 AnimateBackgroundAppearanceIfNecessary( | 398 AnimateWallpaperAppearanceIfNecessary( |
399 SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, animation_sequence); | 399 SessionStateAnimator::ANIMATION_SPEED_UNDOABLE, animation_sequence); |
400 | 400 |
401 DispatchCancelMode(); | 401 DispatchCancelMode(); |
402 WmShell::Get()->OnLockStateEvent( | 402 WmShell::Get()->OnLockStateEvent( |
403 LockStateObserver::EVENT_PRELOCK_ANIMATION_STARTED); | 403 LockStateObserver::EVENT_PRELOCK_ANIMATION_STARTED); |
404 animation_sequence->EndSequence(); | 404 animation_sequence->EndSequence(); |
405 } | 405 } |
406 | 406 |
407 void LockStateController::CancelPreLockAnimation() { | 407 void LockStateController::CancelPreLockAnimation() { |
408 VLOG(1) << "CancelPreLockAnimation"; | 408 VLOG(1) << "CancelPreLockAnimation"; |
409 base::Closure next_animation_starter = | 409 base::Closure next_animation_starter = |
410 base::Bind(&LockStateController::LockAnimationCancelled, | 410 base::Bind(&LockStateController::LockAnimationCancelled, |
411 weak_ptr_factory_.GetWeakPtr()); | 411 weak_ptr_factory_.GetWeakPtr()); |
412 SessionStateAnimator::AnimationSequence* animation_sequence = | 412 SessionStateAnimator::AnimationSequence* animation_sequence = |
413 animator_->BeginAnimationSequence(next_animation_starter); | 413 animator_->BeginAnimationSequence(next_animation_starter); |
414 | 414 |
415 animation_sequence->StartAnimation( | 415 animation_sequence->StartAnimation( |
416 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, | 416 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, |
417 SessionStateAnimator::ANIMATION_UNDO_LIFT, | 417 SessionStateAnimator::ANIMATION_UNDO_LIFT, |
418 SessionStateAnimator::ANIMATION_SPEED_UNDO_MOVE_WINDOWS); | 418 SessionStateAnimator::ANIMATION_SPEED_UNDO_MOVE_WINDOWS); |
419 animation_sequence->StartAnimation( | 419 animation_sequence->StartAnimation( |
420 SessionStateAnimator::LAUNCHER, SessionStateAnimator::ANIMATION_FADE_IN, | 420 SessionStateAnimator::LAUNCHER, SessionStateAnimator::ANIMATION_FADE_IN, |
421 SessionStateAnimator::ANIMATION_SPEED_UNDO_MOVE_WINDOWS); | 421 SessionStateAnimator::ANIMATION_SPEED_UNDO_MOVE_WINDOWS); |
422 AnimateBackgroundHidingIfNecessary( | 422 AnimateWallpaperHidingIfNecessary( |
423 SessionStateAnimator::ANIMATION_SPEED_UNDO_MOVE_WINDOWS, | 423 SessionStateAnimator::ANIMATION_SPEED_UNDO_MOVE_WINDOWS, |
424 animation_sequence); | 424 animation_sequence); |
425 | 425 |
426 animation_sequence->EndSequence(); | 426 animation_sequence->EndSequence(); |
427 } | 427 } |
428 | 428 |
429 void LockStateController::StartPostLockAnimation() { | 429 void LockStateController::StartPostLockAnimation() { |
430 VLOG(1) << "StartPostLockAnimation"; | 430 VLOG(1) << "StartPostLockAnimation"; |
431 base::Closure next_animation_starter = | 431 base::Closure next_animation_starter = |
432 base::Bind(&LockStateController::PostLockAnimationFinished, | 432 base::Bind(&LockStateController::PostLockAnimationFinished, |
(...skipping 25 matching lines...) Expand all Loading... |
458 SessionStateAnimator::AnimationSequence* animation_sequence = | 458 SessionStateAnimator::AnimationSequence* animation_sequence = |
459 animator_->BeginAnimationSequence(next_animation_starter); | 459 animator_->BeginAnimationSequence(next_animation_starter); |
460 | 460 |
461 animation_sequence->StartAnimation( | 461 animation_sequence->StartAnimation( |
462 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, | 462 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, |
463 SessionStateAnimator::ANIMATION_DROP, | 463 SessionStateAnimator::ANIMATION_DROP, |
464 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 464 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); |
465 animation_sequence->StartAnimation( | 465 animation_sequence->StartAnimation( |
466 SessionStateAnimator::LAUNCHER, SessionStateAnimator::ANIMATION_FADE_IN, | 466 SessionStateAnimator::LAUNCHER, SessionStateAnimator::ANIMATION_FADE_IN, |
467 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); | 467 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS); |
468 AnimateBackgroundHidingIfNecessary( | 468 AnimateWallpaperHidingIfNecessary( |
469 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS, animation_sequence); | 469 SessionStateAnimator::ANIMATION_SPEED_MOVE_WINDOWS, animation_sequence); |
470 animation_sequence->EndSequence(); | 470 animation_sequence->EndSequence(); |
471 } | 471 } |
472 | 472 |
473 void LockStateController::LockAnimationCancelled() { | 473 void LockStateController::LockAnimationCancelled() { |
474 can_cancel_lock_animation_ = false; | 474 can_cancel_lock_animation_ = false; |
475 RestoreUnlockedProperties(); | 475 RestoreUnlockedProperties(); |
476 } | 476 } |
477 | 477 |
478 void LockStateController::PreLockAnimationFinished(bool request_lock) { | 478 void LockStateController::PreLockAnimationFinished(bool request_lock) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 } | 532 } |
533 } | 533 } |
534 | 534 |
535 void LockStateController::UnlockAnimationAfterUIDestroyedFinished() { | 535 void LockStateController::UnlockAnimationAfterUIDestroyedFinished() { |
536 RestoreUnlockedProperties(); | 536 RestoreUnlockedProperties(); |
537 } | 537 } |
538 | 538 |
539 void LockStateController::StoreUnlockedProperties() { | 539 void LockStateController::StoreUnlockedProperties() { |
540 if (!unlocked_properties_) { | 540 if (!unlocked_properties_) { |
541 unlocked_properties_.reset(new UnlockedStateProperties()); | 541 unlocked_properties_.reset(new UnlockedStateProperties()); |
542 unlocked_properties_->background_is_hidden = | 542 unlocked_properties_->wallpaper_is_hidden = animator_->IsWallpaperHidden(); |
543 animator_->IsBackgroundHidden(); | |
544 } | 543 } |
545 if (unlocked_properties_->background_is_hidden) { | 544 if (unlocked_properties_->wallpaper_is_hidden) { |
546 // Hide background so that it can be animated later. | 545 // Hide wallpaper so that it can be animated later. |
547 animator_->StartAnimation(SessionStateAnimator::DESKTOP_BACKGROUND, | 546 animator_->StartAnimation(SessionStateAnimator::WALLPAPER, |
548 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY, | 547 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY, |
549 SessionStateAnimator::ANIMATION_SPEED_IMMEDIATE); | 548 SessionStateAnimator::ANIMATION_SPEED_IMMEDIATE); |
550 animator_->ShowBackground(); | 549 animator_->ShowWallpaper(); |
551 } | 550 } |
552 } | 551 } |
553 | 552 |
554 void LockStateController::RestoreUnlockedProperties() { | 553 void LockStateController::RestoreUnlockedProperties() { |
555 if (!unlocked_properties_) | 554 if (!unlocked_properties_) |
556 return; | 555 return; |
557 if (unlocked_properties_->background_is_hidden) { | 556 if (unlocked_properties_->wallpaper_is_hidden) { |
558 animator_->HideBackground(); | 557 animator_->HideWallpaper(); |
559 // Restore background visibility. | 558 // Restore wallpaper visibility. |
560 animator_->StartAnimation(SessionStateAnimator::DESKTOP_BACKGROUND, | 559 animator_->StartAnimation(SessionStateAnimator::WALLPAPER, |
561 SessionStateAnimator::ANIMATION_FADE_IN, | 560 SessionStateAnimator::ANIMATION_FADE_IN, |
562 SessionStateAnimator::ANIMATION_SPEED_IMMEDIATE); | 561 SessionStateAnimator::ANIMATION_SPEED_IMMEDIATE); |
563 } | 562 } |
564 unlocked_properties_.reset(); | 563 unlocked_properties_.reset(); |
565 } | 564 } |
566 | 565 |
567 void LockStateController::AnimateBackgroundAppearanceIfNecessary( | 566 void LockStateController::AnimateWallpaperAppearanceIfNecessary( |
568 SessionStateAnimator::AnimationSpeed speed, | 567 SessionStateAnimator::AnimationSpeed speed, |
569 SessionStateAnimator::AnimationSequence* animation_sequence) { | 568 SessionStateAnimator::AnimationSequence* animation_sequence) { |
570 if (unlocked_properties_.get() && | 569 if (unlocked_properties_.get() && unlocked_properties_->wallpaper_is_hidden) { |
571 unlocked_properties_->background_is_hidden) { | 570 animation_sequence->StartAnimation(SessionStateAnimator::WALLPAPER, |
572 animation_sequence->StartAnimation(SessionStateAnimator::DESKTOP_BACKGROUND, | |
573 SessionStateAnimator::ANIMATION_FADE_IN, | 571 SessionStateAnimator::ANIMATION_FADE_IN, |
574 speed); | 572 speed); |
575 } | 573 } |
576 } | 574 } |
577 | 575 |
578 void LockStateController::AnimateBackgroundHidingIfNecessary( | 576 void LockStateController::AnimateWallpaperHidingIfNecessary( |
579 SessionStateAnimator::AnimationSpeed speed, | 577 SessionStateAnimator::AnimationSpeed speed, |
580 SessionStateAnimator::AnimationSequence* animation_sequence) { | 578 SessionStateAnimator::AnimationSequence* animation_sequence) { |
581 if (unlocked_properties_.get() && | 579 if (unlocked_properties_.get() && unlocked_properties_->wallpaper_is_hidden) { |
582 unlocked_properties_->background_is_hidden) { | 580 animation_sequence->StartAnimation(SessionStateAnimator::WALLPAPER, |
583 animation_sequence->StartAnimation(SessionStateAnimator::DESKTOP_BACKGROUND, | |
584 SessionStateAnimator::ANIMATION_FADE_OUT, | 581 SessionStateAnimator::ANIMATION_FADE_OUT, |
585 speed); | 582 speed); |
586 } | 583 } |
587 } | 584 } |
588 | 585 |
589 } // namespace ash | 586 } // namespace ash |
OLD | NEW |