| 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/common/ash_switches.h" | 7 #include "ash/common/ash_switches.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/shell_window_ids.h" | 9 #include "ash/common/shell_window_ids.h" |
| 10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 if (controller_->ShutdownRequested()) | 61 if (controller_->ShutdownRequested()) |
| 62 return; | 62 return; |
| 63 | 63 |
| 64 // Avoid starting the lock/shutdown sequence if the power button is pressed | 64 // Avoid starting the lock/shutdown sequence if the power button is pressed |
| 65 // while the screen is off (http://crbug.com/128451), unless an external | 65 // while the screen is off (http://crbug.com/128451), unless an external |
| 66 // display is still on (http://crosbug.com/p/24912). | 66 // display is still on (http://crosbug.com/p/24912). |
| 67 if (brightness_is_zero_ && !internal_display_off_and_external_display_on_) | 67 if (brightness_is_zero_ && !internal_display_off_and_external_display_on_) |
| 68 return; | 68 return; |
| 69 | 69 |
| 70 if (volume_down_pressed_ && down && | 70 if (volume_down_pressed_ && down && |
| 71 Shell::GetInstance() | 71 WmShell::Get() |
| 72 ->maximize_mode_controller() | 72 ->maximize_mode_controller() |
| 73 ->IsMaximizeModeWindowManagerEnabled()) { | 73 ->IsMaximizeModeWindowManagerEnabled()) { |
| 74 Shell::GetInstance()->accelerator_controller()->PerformActionIfEnabled( | 74 Shell::GetInstance()->accelerator_controller()->PerformActionIfEnabled( |
| 75 TAKE_SCREENSHOT); | 75 TAKE_SCREENSHOT); |
| 76 return; | 76 return; |
| 77 } | 77 } |
| 78 | 78 |
| 79 const SessionStateDelegate* session_state_delegate = | 79 const SessionStateDelegate* session_state_delegate = |
| 80 WmShell::Get()->GetSessionStateDelegate(); | 80 WmShell::Get()->GetSessionStateDelegate(); |
| 81 if (has_legacy_power_button_) { | 81 if (has_legacy_power_button_) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 } else { // !has_legacy_power_button_ | 94 } else { // !has_legacy_power_button_ |
| 95 if (down) { | 95 if (down) { |
| 96 // If we already have a pending request to lock the screen, wait. | 96 // If we already have a pending request to lock the screen, wait. |
| 97 if (controller_->LockRequested()) | 97 if (controller_->LockRequested()) |
| 98 return; | 98 return; |
| 99 | 99 |
| 100 if (session_state_delegate->CanLockScreen() && | 100 if (session_state_delegate->CanLockScreen() && |
| 101 !session_state_delegate->IsUserSessionBlocked()) { | 101 !session_state_delegate->IsUserSessionBlocked()) { |
| 102 if (Shell::GetInstance() | 102 if (WmShell::Get() |
| 103 ->maximize_mode_controller() | 103 ->maximize_mode_controller() |
| 104 ->IsMaximizeModeWindowManagerEnabled() && | 104 ->IsMaximizeModeWindowManagerEnabled() && |
| 105 enable_quick_lock_) | 105 enable_quick_lock_) |
| 106 controller_->StartLockAnimationAndLockImmediately(true); | 106 controller_->StartLockAnimationAndLockImmediately(true); |
| 107 else | 107 else |
| 108 controller_->StartLockAnimation(true); | 108 controller_->StartLockAnimation(true); |
| 109 } else { | 109 } else { |
| 110 controller_->StartShutdownAnimation(); | 110 controller_->StartShutdownAnimation(); |
| 111 } | 111 } |
| 112 } else { // Button is up. | 112 } else { // Button is up. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } else if (display->current_mode()) { | 158 } else if (display->current_mode()) { |
| 159 external_display_on = true; | 159 external_display_on = true; |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 internal_display_off_and_external_display_on_ = | 162 internal_display_off_and_external_display_on_ = |
| 163 internal_display_off && external_display_on; | 163 internal_display_off && external_display_on; |
| 164 } | 164 } |
| 165 #endif | 165 #endif |
| 166 | 166 |
| 167 } // namespace ash | 167 } // namespace ash |
| OLD | NEW |