| 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/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
| 8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
| 9 #include "ash/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
| 10 #include "ash/session/session_controller.h" | 10 #include "ash/session/session_controller.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/system/audio/tray_audio.h" | 12 #include "ash/system/audio/tray_audio.h" |
| 13 #include "ash/system/power/tablet_power_button_controller.h" | 13 #include "ash/system/power/tablet_power_button_controller.h" |
| 14 #include "ash/system/tray/system_tray.h" | 14 #include "ash/system/tray/system_tray.h" |
| 15 #include "ash/wm/lock_state_controller.h" | 15 #include "ash/wm/lock_state_controller.h" |
| 16 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | |
| 17 #include "ash/wm/session_state_animator.h" | 16 #include "ash/wm/session_state_animator.h" |
| 17 #include "ash/wm/tablet_mode/tablet_mode_controller.h" |
| 18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 19 #include "chromeos/audio/cras_audio_handler.h" | 19 #include "chromeos/audio/cras_audio_handler.h" |
| 20 #include "chromeos/dbus/dbus_thread_manager.h" | 20 #include "chromeos/dbus/dbus_thread_manager.h" |
| 21 #include "ui/aura/window_event_dispatcher.h" | 21 #include "ui/aura/window_event_dispatcher.h" |
| 22 #include "ui/display/types/display_snapshot.h" | 22 #include "ui/display/types/display_snapshot.h" |
| 23 #include "ui/wm/core/compound_event_filter.h" | 23 #include "ui/wm/core/compound_event_filter.h" |
| 24 | 24 |
| 25 namespace ash { | 25 namespace ash { |
| 26 | 26 |
| 27 PowerButtonController::PowerButtonController(LockStateController* controller) | 27 PowerButtonController::PowerButtonController(LockStateController* controller) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 52 void PowerButtonController::OnPowerButtonEvent( | 52 void PowerButtonController::OnPowerButtonEvent( |
| 53 bool down, | 53 bool down, |
| 54 const base::TimeTicks& timestamp) { | 54 const base::TimeTicks& timestamp) { |
| 55 power_button_down_ = down; | 55 power_button_down_ = down; |
| 56 | 56 |
| 57 if (lock_state_controller_->ShutdownRequested()) | 57 if (lock_state_controller_->ShutdownRequested()) |
| 58 return; | 58 return; |
| 59 | 59 |
| 60 bool should_take_screenshot = down && volume_down_pressed_ && | 60 bool should_take_screenshot = down && volume_down_pressed_ && |
| 61 Shell::Get() | 61 Shell::Get() |
| 62 ->maximize_mode_controller() | 62 ->tablet_mode_controller() |
| 63 ->IsMaximizeModeWindowManagerEnabled(); | 63 ->IsTabletModeWindowManagerEnabled(); |
| 64 | 64 |
| 65 if (!has_legacy_power_button_ && !should_take_screenshot && | 65 if (!has_legacy_power_button_ && !should_take_screenshot && |
| 66 tablet_controller_ && | 66 tablet_controller_ && |
| 67 tablet_controller_->ShouldHandlePowerButtonEvents()) { | 67 tablet_controller_->ShouldHandlePowerButtonEvents()) { |
| 68 tablet_controller_->OnPowerButtonEvent(down, timestamp); | 68 tablet_controller_->OnPowerButtonEvent(down, timestamp); |
| 69 return; | 69 return; |
| 70 } | 70 } |
| 71 | 71 |
| 72 // Avoid starting the lock/shutdown sequence if the power button is pressed | 72 // Avoid starting the lock/shutdown sequence if the power button is pressed |
| 73 // while the screen is off (http://crbug.com/128451), unless an external | 73 // while the screen is off (http://crbug.com/128451), unless an external |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 return; | 193 return; |
| 194 tablet_controller_.reset( | 194 tablet_controller_.reset( |
| 195 new TabletPowerButtonController(lock_state_controller_)); | 195 new TabletPowerButtonController(lock_state_controller_)); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void PowerButtonController::ResetTabletPowerButtonControllerForTest() { | 198 void PowerButtonController::ResetTabletPowerButtonControllerForTest() { |
| 199 tablet_controller_.reset(); | 199 tablet_controller_.reset(); |
| 200 } | 200 } |
| 201 | 201 |
| 202 } // namespace ash | 202 } // namespace ash |
| OLD | NEW |