OLD | NEW |
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_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 10 #include "ash/wm/cursor_manager.h" |
10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/time.h" | 13 #include "base/time.h" |
13 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
14 #include "ui/aura/cursor_manager.h" | |
15 #include "ui/aura/env.h" | 15 #include "ui/aura/env.h" |
16 #include "ui/aura/root_window.h" | 16 #include "ui/aura/root_window.h" |
17 #include "ui/aura/shared/compound_event_filter.h" | 17 #include "ui/aura/shared/compound_event_filter.h" |
18 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
19 #include "ui/compositor/layer.h" | 19 #include "ui/compositor/layer.h" |
20 #include "ui/compositor/layer_animation_element.h" | 20 #include "ui/compositor/layer_animation_element.h" |
21 #include "ui/compositor/layer_animation_sequence.h" | 21 #include "ui/compositor/layer_animation_sequence.h" |
22 #include "ui/compositor/layer_animator.h" | 22 #include "ui/compositor/layer_animator.h" |
23 #include "ui/gfx/canvas.h" | 23 #include "ui/gfx/canvas.h" |
24 #include "ui/gfx/rect.h" | 24 #include "ui/gfx/rect.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 void PowerButtonController::OnLoginStateChanged(user::LoginStatus status) { | 304 void PowerButtonController::OnLoginStateChanged(user::LoginStatus status) { |
305 login_status_ = status; | 305 login_status_ = status; |
306 unlocked_login_status_ = user::LOGGED_IN_NONE; | 306 unlocked_login_status_ = user::LOGGED_IN_NONE; |
307 } | 307 } |
308 | 308 |
309 void PowerButtonController::OnAppTerminating() { | 309 void PowerButtonController::OnAppTerminating() { |
310 // If we hear that Chrome is exiting but didn't request it ourselves, all we | 310 // If we hear that Chrome is exiting but didn't request it ourselves, all we |
311 // can really hope for is that we'll have time to clear the screen. | 311 // can really hope for is that we'll have time to clear the screen. |
312 if (!shutting_down_) { | 312 if (!shutting_down_) { |
313 shutting_down_ = true; | 313 shutting_down_ = true; |
314 ash::Shell::GetInstance()->env_filter()-> | 314 Shell* shell = ash::Shell::GetInstance(); |
315 set_update_cursor_visibility(false); | 315 shell->env_filter()->set_update_cursor_visibility(false); |
316 aura::Env::GetInstance()->cursor_manager()->ShowCursor(false); | 316 shell->cursor_manager()->ShowCursor(false); |
317 ShowBackgroundLayer(); | 317 ShowBackgroundLayer(); |
318 StartAnimation(ALL_CONTAINERS, ANIMATION_HIDE); | 318 StartAnimation(ALL_CONTAINERS, ANIMATION_HIDE); |
319 } | 319 } |
320 } | 320 } |
321 | 321 |
322 void PowerButtonController::OnLockStateChanged(bool locked) { | 322 void PowerButtonController::OnLockStateChanged(bool locked) { |
323 if (shutting_down_ || (login_status_ == user::LOGGED_IN_LOCKED) == locked) | 323 if (shutting_down_ || (login_status_ == user::LOGGED_IN_LOCKED) == locked) |
324 return; | 324 return; |
325 | 325 |
326 if (!locked && login_status_ == user::LOGGED_IN_LOCKED) { | 326 if (!locked && login_status_ == user::LOGGED_IN_LOCKED) { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 shutdown_timer_.Start( | 529 shutdown_timer_.Start( |
530 FROM_HERE, | 530 FROM_HERE, |
531 base::TimeDelta::FromMilliseconds(kShutdownTimeoutMs), | 531 base::TimeDelta::FromMilliseconds(kShutdownTimeoutMs), |
532 this, &PowerButtonController::OnShutdownTimeout); | 532 this, &PowerButtonController::OnShutdownTimeout); |
533 } | 533 } |
534 | 534 |
535 void PowerButtonController::StartShutdownAnimationAndRequestShutdown() { | 535 void PowerButtonController::StartShutdownAnimationAndRequestShutdown() { |
536 DCHECK(!shutting_down_); | 536 DCHECK(!shutting_down_); |
537 shutting_down_ = true; | 537 shutting_down_ = true; |
538 | 538 |
539 ash::Shell::GetInstance()->env_filter()->set_update_cursor_visibility(false); | 539 Shell* shell = ash::Shell::GetInstance(); |
540 aura::Env::GetInstance()->cursor_manager()->ShowCursor(false); | 540 shell->env_filter()->set_update_cursor_visibility(false); |
| 541 shell->cursor_manager()->ShowCursor(false); |
541 | 542 |
542 ShowBackgroundLayer(); | 543 ShowBackgroundLayer(); |
543 if (login_status_ != user::LOGGED_IN_NONE) { | 544 if (login_status_ != user::LOGGED_IN_NONE) { |
544 // Hide the other containers before starting the animation. | 545 // Hide the other containers before starting the animation. |
545 // ANIMATION_FAST_CLOSE will make the screen locker windows partially | 546 // ANIMATION_FAST_CLOSE will make the screen locker windows partially |
546 // transparent, and we don't want the other windows to show through. | 547 // transparent, and we don't want the other windows to show through. |
547 StartAnimation(ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, | 548 StartAnimation(ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, |
548 ANIMATION_HIDE); | 549 ANIMATION_HIDE); |
549 StartAnimation(SCREEN_LOCKER_AND_RELATED_CONTAINERS, ANIMATION_FAST_CLOSE); | 550 StartAnimation(SCREEN_LOCKER_AND_RELATED_CONTAINERS, ANIMATION_FAST_CLOSE); |
550 } else { | 551 } else { |
(...skipping 21 matching lines...) Expand all Loading... |
572 root_layer->StackAtBottom(background_layer_.get()); | 573 root_layer->StackAtBottom(background_layer_.get()); |
573 } | 574 } |
574 background_layer_->SetVisible(true); | 575 background_layer_->SetVisible(true); |
575 } | 576 } |
576 | 577 |
577 void PowerButtonController::HideBackgroundLayer() { | 578 void PowerButtonController::HideBackgroundLayer() { |
578 background_layer_.reset(); | 579 background_layer_.reset(); |
579 } | 580 } |
580 | 581 |
581 } // namespace ash | 582 } // namespace ash |
OLD | NEW |