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

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

Issue 10990118: Polish lock animation - launcher should do a fade out. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move launcher container up 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 | Annotate | Revision Log
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/power_button_controller.h" 5 #include "ash/wm/power_button_controller.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"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // Fills |containers| with the containers described by |container_mask|. 162 // Fills |containers| with the containers described by |container_mask|.
163 void GetContainers(int container_mask, aura::Window::Windows* containers) { 163 void GetContainers(int container_mask, aura::Window::Windows* containers) {
164 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); 164 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow();
165 containers->clear(); 165 containers->clear();
166 166
167 if (container_mask & PowerButtonController::DESKTOP_BACKGROUND) { 167 if (container_mask & PowerButtonController::DESKTOP_BACKGROUND) {
168 containers->push_back(Shell::GetContainer( 168 containers->push_back(Shell::GetContainer(
169 root_window, 169 root_window,
170 internal::kShellWindowId_DesktopBackgroundContainer)); 170 internal::kShellWindowId_DesktopBackgroundContainer));
171 } 171 }
172 if (container_mask & PowerButtonController::LAUNCHER) {
173 containers->push_back(Shell::GetContainer(
174 root_window,
175 internal::kShellWindowId_LauncherContainer));
176 }
172 if (container_mask & PowerButtonController::NON_LOCK_SCREEN_CONTAINERS) { 177 if (container_mask & PowerButtonController::NON_LOCK_SCREEN_CONTAINERS) {
173 containers->push_back(Shell::GetContainer( 178 containers->push_back(Shell::GetContainer(
174 root_window, 179 root_window,
175 internal::kShellWindowId_NonLockScreenContainersContainer)); 180 internal::kShellWindowId_NonLockScreenContainersContainer));
176 } 181 }
177 if (container_mask & PowerButtonController::LOCK_SCREEN_BACKGROUND) { 182 if (container_mask & PowerButtonController::LOCK_SCREEN_BACKGROUND) {
178 containers->push_back(Shell::GetContainer( 183 containers->push_back(Shell::GetContainer(
179 root_window, 184 root_window,
180 internal::kShellWindowId_LockScreenBackgroundContainer)); 185 internal::kShellWindowId_LockScreenBackgroundContainer));
181 } 186 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 281 }
277 282
278 gfx::Rect PowerButtonController::TestApi::GetBlackLayerBounds() const { 283 gfx::Rect PowerButtonController::TestApi::GetBlackLayerBounds() const {
279 ui::Layer* layer = controller_->black_layer_.get(); 284 ui::Layer* layer = controller_->black_layer_.get();
280 return layer ? layer->bounds() : gfx::Rect(); 285 return layer ? layer->bounds() : gfx::Rect();
281 } 286 }
282 287
283 // static 288 // static
284 int PowerButtonController::GetAllContainersMask() { 289 int PowerButtonController::GetAllContainersMask() {
285 return PowerButtonController::DESKTOP_BACKGROUND | 290 return PowerButtonController::DESKTOP_BACKGROUND |
291 PowerButtonController::LAUNCHER |
286 PowerButtonController::NON_LOCK_SCREEN_CONTAINERS | 292 PowerButtonController::NON_LOCK_SCREEN_CONTAINERS |
287 GetAllLockScreenContainersMask(); 293 GetAllLockScreenContainersMask();
288 } 294 }
289 295
290 // static 296 // static
291 int PowerButtonController::GetAllLockScreenContainersMask() { 297 int PowerButtonController::GetAllLockScreenContainersMask() {
292 return PowerButtonController::LOCK_SCREEN_BACKGROUND | 298 return PowerButtonController::LOCK_SCREEN_BACKGROUND |
293 PowerButtonController::LOCK_SCREEN_CONTAINERS | 299 PowerButtonController::LOCK_SCREEN_CONTAINERS |
294 PowerButtonController::LOCK_SCREEN_RELATED_CONTAINERS; 300 PowerButtonController::LOCK_SCREEN_RELATED_CONTAINERS;
295 } 301 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 lock_fail_timer_.Stop(); 352 lock_fail_timer_.Stop();
347 353
348 if (!has_legacy_power_button_ && power_button_down_) { 354 if (!has_legacy_power_button_ && power_button_down_) {
349 lock_to_shutdown_timer_.Stop(); 355 lock_to_shutdown_timer_.Stop();
350 lock_to_shutdown_timer_.Start( 356 lock_to_shutdown_timer_.Start(
351 FROM_HERE, 357 FROM_HERE,
352 base::TimeDelta::FromMilliseconds(kLockToShutdownTimeoutMs), 358 base::TimeDelta::FromMilliseconds(kLockToShutdownTimeoutMs),
353 this, &PowerButtonController::OnLockToShutdownTimeout); 359 this, &PowerButtonController::OnLockToShutdownTimeout);
354 } 360 }
355 } else { 361 } else {
356 StartAnimation(DESKTOP_BACKGROUND | NON_LOCK_SCREEN_CONTAINERS, 362 StartAnimation(DESKTOP_BACKGROUND | LAUNCHER | NON_LOCK_SCREEN_CONTAINERS,
357 ANIMATION_RESTORE); 363 ANIMATION_RESTORE);
358 HideBlackLayer(); 364 HideBlackLayer();
359 } 365 }
360 } 366 }
361 367
362 void PowerButtonController::OnScreenBrightnessChanged(double percent) { 368 void PowerButtonController::OnScreenBrightnessChanged(double percent) {
363 screen_is_off_ = percent <= 0.001; 369 screen_is_off_ = percent <= 0.001;
364 } 370 }
365 371
366 void PowerButtonController::OnStartingLock() { 372 void PowerButtonController::OnStartingLock() {
367 if (shutting_down_ || login_status_ == user::LOGGED_IN_LOCKED) 373 if (shutting_down_ || login_status_ == user::LOGGED_IN_LOCKED)
368 return; 374 return;
369 375
370 // Ensure that the black layer is visible -- if the screen was locked via 376 // Ensure that the black layer is visible -- if the screen was locked via
371 // the wrench menu, we won't have already shown the black background 377 // the wrench menu, we won't have already shown the black background
372 // as part of the slow-close animation. 378 // as part of the slow-close animation.
373 ShowBlackLayer(); 379 ShowBlackLayer();
374 380
381 StartAnimation(LAUNCHER, ANIMATION_HIDE);
382
375 StartAnimation(NON_LOCK_SCREEN_CONTAINERS, ANIMATION_FAST_CLOSE); 383 StartAnimation(NON_LOCK_SCREEN_CONTAINERS, ANIMATION_FAST_CLOSE);
376 384
377 // Hide the screen locker containers so we can make them fade in later. 385 // Hide the screen locker containers so we can make them fade in later.
378 StartAnimation(LOCK_SCREEN_CONTAINERS, ANIMATION_HIDE); 386 StartAnimation(LOCK_SCREEN_CONTAINERS, ANIMATION_HIDE);
379 } 387 }
380 388
381 void PowerButtonController::OnPowerButtonEvent( 389 void PowerButtonController::OnPowerButtonEvent(
382 bool down, const base::TimeTicks& timestamp) { 390 bool down, const base::TimeTicks& timestamp) {
383 power_button_down_ = down; 391 power_button_down_ = down;
384 392
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 delegate_->RequestLockScreen(); 511 delegate_->RequestLockScreen();
504 lock_fail_timer_.Start( 512 lock_fail_timer_.Start(
505 FROM_HERE, 513 FROM_HERE,
506 base::TimeDelta::FromMilliseconds(kLockFailTimeoutMs), 514 base::TimeDelta::FromMilliseconds(kLockFailTimeoutMs),
507 this, &PowerButtonController::OnLockFailTimeout); 515 this, &PowerButtonController::OnLockFailTimeout);
508 } 516 }
509 517
510 void PowerButtonController::OnLockFailTimeout() { 518 void PowerButtonController::OnLockFailTimeout() {
511 DCHECK_NE(login_status_, user::LOGGED_IN_LOCKED); 519 DCHECK_NE(login_status_, user::LOGGED_IN_LOCKED);
512 LOG(ERROR) << "Screen lock request timed out"; 520 LOG(ERROR) << "Screen lock request timed out";
513 StartAnimation(NON_LOCK_SCREEN_CONTAINERS, ANIMATION_RESTORE); 521 StartAnimation(LAUNCHER | NON_LOCK_SCREEN_CONTAINERS, ANIMATION_RESTORE);
514 HideBlackLayer(); 522 HideBlackLayer();
515 } 523 }
516 524
517 void PowerButtonController::OnLockToShutdownTimeout() { 525 void PowerButtonController::OnLockToShutdownTimeout() {
518 DCHECK_EQ(login_status_, user::LOGGED_IN_LOCKED); 526 DCHECK_EQ(login_status_, user::LOGGED_IN_LOCKED);
519 StartShutdownTimer(); 527 StartShutdownTimer();
520 } 528 }
521 529
522 void PowerButtonController::OnShutdownTimeout() { 530 void PowerButtonController::OnShutdownTimeout() {
523 if (!shutting_down_) 531 if (!shutting_down_)
(...skipping 29 matching lines...) Expand all
553 shutting_down_ = true; 561 shutting_down_ = true;
554 562
555 Shell* shell = ash::Shell::GetInstance(); 563 Shell* shell = ash::Shell::GetInstance();
556 shell->cursor_manager()->ShowCursor(false); 564 shell->cursor_manager()->ShowCursor(false);
557 565
558 ShowBlackLayer(); 566 ShowBlackLayer();
559 if (login_status_ != user::LOGGED_IN_NONE) { 567 if (login_status_ != user::LOGGED_IN_NONE) {
560 // Hide the other containers before starting the animation. 568 // Hide the other containers before starting the animation.
561 // ANIMATION_FAST_CLOSE will make the screen locker windows partially 569 // ANIMATION_FAST_CLOSE will make the screen locker windows partially
562 // transparent, and we don't want the other windows to show through. 570 // transparent, and we don't want the other windows to show through.
563 StartAnimation(NON_LOCK_SCREEN_CONTAINERS, ANIMATION_HIDE); 571 StartAnimation(LAUNCHER | NON_LOCK_SCREEN_CONTAINERS, ANIMATION_HIDE);
564 StartAnimation(GetAllLockScreenContainersMask(), ANIMATION_FAST_CLOSE); 572 StartAnimation(GetAllLockScreenContainersMask(), ANIMATION_FAST_CLOSE);
565 } else { 573 } else {
566 StartAnimation(GetAllContainersMask(), ANIMATION_FAST_CLOSE); 574 StartAnimation(GetAllContainersMask(), ANIMATION_FAST_CLOSE);
567 } 575 }
568 576
569 real_shutdown_timer_.Start( 577 real_shutdown_timer_.Start(
570 FROM_HERE, 578 FROM_HERE,
571 base::TimeDelta::FromMilliseconds( 579 base::TimeDelta::FromMilliseconds(
572 kFastCloseAnimMs + kShutdownRequestDelayMs), 580 kFastCloseAnimMs + kShutdownRequestDelayMs),
573 this, &PowerButtonController::OnRealShutdownTimeout); 581 this, &PowerButtonController::OnRealShutdownTimeout);
(...skipping 13 matching lines...) Expand all
587 root_layer->StackAtBottom(black_layer_.get()); 595 root_layer->StackAtBottom(black_layer_.get());
588 } 596 }
589 black_layer_->SetVisible(true); 597 black_layer_->SetVisible(true);
590 } 598 }
591 599
592 void PowerButtonController::HideBlackLayer() { 600 void PowerButtonController::HideBlackLayer() {
593 black_layer_.reset(); 601 black_layer_.reset();
594 } 602 }
595 603
596 } // namespace ash 604 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698