| 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 #ifndef ASH_WM_POWER_BUTTON_CONTROLLER_H_ | 5 #ifndef ASH_WM_POWER_BUTTON_CONTROLLER_H_ |
| 6 #define ASH_WM_POWER_BUTTON_CONTROLLER_H_ | 6 #define ASH_WM_POWER_BUTTON_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 // Handles power & lock button events which may result in the locking or | 27 // Handles power & lock button events which may result in the locking or |
| 28 // shutting down of the system as well as taking screen shots while in maximize | 28 // shutting down of the system as well as taking screen shots while in maximize |
| 29 // mode. | 29 // mode. |
| 30 class ASH_EXPORT PowerButtonController | 30 class ASH_EXPORT PowerButtonController |
| 31 : public ui::EventHandler | 31 : public ui::EventHandler |
| 32 // TODO(derat): Remove these ifdefs after DisplayConfigurator becomes | 32 // TODO(derat): Remove these ifdefs after DisplayConfigurator becomes |
| 33 // cross-platform. | 33 // cross-platform. |
| 34 #if defined(OS_CHROMEOS) | 34 #if defined(OS_CHROMEOS) |
| 35 , | 35 , |
| 36 public ui::DisplayConfigurator::Observer, | 36 public display::DisplayConfigurator::Observer, |
| 37 public chromeos::PowerManagerClient::Observer | 37 public chromeos::PowerManagerClient::Observer |
| 38 #endif | 38 #endif |
| 39 { | 39 { |
| 40 public: | 40 public: |
| 41 explicit PowerButtonController(LockStateController* controller); | 41 explicit PowerButtonController(LockStateController* controller); |
| 42 ~PowerButtonController() override; | 42 ~PowerButtonController() override; |
| 43 | 43 |
| 44 void set_has_legacy_power_button_for_test(bool legacy) { | 44 void set_has_legacy_power_button_for_test(bool legacy) { |
| 45 has_legacy_power_button_ = legacy; | 45 has_legacy_power_button_ = legacy; |
| 46 } | 46 } |
| 47 | 47 |
| 48 // Called when the current screen brightness changes. | 48 // Called when the current screen brightness changes. |
| 49 void OnScreenBrightnessChanged(double percent); | 49 void OnScreenBrightnessChanged(double percent); |
| 50 | 50 |
| 51 // Called when the power or lock buttons are pressed or released. | 51 // Called when the power or lock buttons are pressed or released. |
| 52 void OnPowerButtonEvent(bool down, const base::TimeTicks& timestamp); | 52 void OnPowerButtonEvent(bool down, const base::TimeTicks& timestamp); |
| 53 void OnLockButtonEvent(bool down, const base::TimeTicks& timestamp); | 53 void OnLockButtonEvent(bool down, const base::TimeTicks& timestamp); |
| 54 | 54 |
| 55 // ui::EventHandler: | 55 // ui::EventHandler: |
| 56 void OnKeyEvent(ui::KeyEvent* event) override; | 56 void OnKeyEvent(ui::KeyEvent* event) override; |
| 57 | 57 |
| 58 #if defined(OS_CHROMEOS) | 58 #if defined(OS_CHROMEOS) |
| 59 // Overriden from ui::DisplayConfigurator::Observer: | 59 // Overriden from display::DisplayConfigurator::Observer: |
| 60 void OnDisplayModeChanged( | 60 void OnDisplayModeChanged( |
| 61 const ui::DisplayConfigurator::DisplayStateList& outputs) override; | 61 const display::DisplayConfigurator::DisplayStateList& outputs) override; |
| 62 | 62 |
| 63 // Overridden from chromeos::PowerManagerClient::Observer: | 63 // Overridden from chromeos::PowerManagerClient::Observer: |
| 64 void PowerButtonEventReceived(bool down, | 64 void PowerButtonEventReceived(bool down, |
| 65 const base::TimeTicks& timestamp) override; | 65 const base::TimeTicks& timestamp) override; |
| 66 | 66 |
| 67 TabletPowerButtonController* tablet_power_button_controller_for_test() { | 67 TabletPowerButtonController* tablet_power_button_controller_for_test() { |
| 68 return tablet_controller_.get(); | 68 return tablet_controller_.get(); |
| 69 } | 69 } |
| 70 #endif | 70 #endif |
| 71 | 71 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 101 // Handles events for convertible/tablet devices. | 101 // Handles events for convertible/tablet devices. |
| 102 std::unique_ptr<TabletPowerButtonController> tablet_controller_; | 102 std::unique_ptr<TabletPowerButtonController> tablet_controller_; |
| 103 #endif | 103 #endif |
| 104 | 104 |
| 105 DISALLOW_COPY_AND_ASSIGN(PowerButtonController); | 105 DISALLOW_COPY_AND_ASSIGN(PowerButtonController); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 } // namespace ash | 108 } // namespace ash |
| 109 | 109 |
| 110 #endif // ASH_WM_POWER_BUTTON_CONTROLLER_H_ | 110 #endif // ASH_WM_POWER_BUTTON_CONTROLLER_H_ |
| OLD | NEW |