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 "ash/accelerators/accelerator_controller.h" | 8 #include "ash/accelerators/accelerator_controller.h" |
9 #include "ash/accelerators/accelerator_table.h" | 9 #include "ash/accelerators/accelerator_table.h" |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // mode. | 39 // mode. |
40 class ASH_EXPORT PowerButtonController : ui::EventHandler | 40 class ASH_EXPORT PowerButtonController : ui::EventHandler |
41 // TODO(derat): Remove these ifdefs after DisplayConfigurator becomes | 41 // TODO(derat): Remove these ifdefs after DisplayConfigurator becomes |
42 // cross-platform. | 42 // cross-platform. |
43 #if defined(OS_CHROMEOS) | 43 #if defined(OS_CHROMEOS) |
44 , public ui::DisplayConfigurator::Observer | 44 , public ui::DisplayConfigurator::Observer |
45 #endif | 45 #endif |
46 { | 46 { |
47 public: | 47 public: |
48 explicit PowerButtonController(LockStateController* controller); | 48 explicit PowerButtonController(LockStateController* controller); |
49 virtual ~PowerButtonController(); | 49 ~PowerButtonController() override; |
50 | 50 |
51 void set_has_legacy_power_button_for_test(bool legacy) { | 51 void set_has_legacy_power_button_for_test(bool legacy) { |
52 has_legacy_power_button_ = legacy; | 52 has_legacy_power_button_ = legacy; |
53 } | 53 } |
54 | 54 |
55 void set_enable_quick_lock_for_test(bool enable_quick_lock) { | 55 void set_enable_quick_lock_for_test(bool enable_quick_lock) { |
56 enable_quick_lock_ = enable_quick_lock; | 56 enable_quick_lock_ = enable_quick_lock; |
57 } | 57 } |
58 | 58 |
59 // Called when the current screen brightness changes. | 59 // Called when the current screen brightness changes. |
60 void OnScreenBrightnessChanged(double percent); | 60 void OnScreenBrightnessChanged(double percent); |
61 | 61 |
62 // Called when the power or lock buttons are pressed or released. | 62 // Called when the power or lock buttons are pressed or released. |
63 void OnPowerButtonEvent(bool down, const base::TimeTicks& timestamp); | 63 void OnPowerButtonEvent(bool down, const base::TimeTicks& timestamp); |
64 void OnLockButtonEvent(bool down, const base::TimeTicks& timestamp); | 64 void OnLockButtonEvent(bool down, const base::TimeTicks& timestamp); |
65 | 65 |
66 // ui::EventHandler: | 66 // ui::EventHandler: |
67 virtual void OnKeyEvent(ui::KeyEvent* event) override; | 67 void OnKeyEvent(ui::KeyEvent* event) override; |
68 | 68 |
69 #if defined(OS_CHROMEOS) | 69 #if defined(OS_CHROMEOS) |
70 // Overriden from ui::DisplayConfigurator::Observer: | 70 // Overriden from ui::DisplayConfigurator::Observer: |
71 virtual void OnDisplayModeChanged( | 71 virtual void OnDisplayModeChanged( |
72 const ui::DisplayConfigurator::DisplayStateList& outputs) override; | 72 const ui::DisplayConfigurator::DisplayStateList& outputs) override; |
73 #endif | 73 #endif |
74 | 74 |
75 private: | 75 private: |
76 friend class test::PowerButtonControllerTest; | 76 friend class test::PowerButtonControllerTest; |
77 | 77 |
(...skipping 20 matching lines...) Expand all Loading... |
98 bool enable_quick_lock_; | 98 bool enable_quick_lock_; |
99 | 99 |
100 LockStateController* controller_; // Not owned. | 100 LockStateController* controller_; // Not owned. |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(PowerButtonController); | 102 DISALLOW_COPY_AND_ASSIGN(PowerButtonController); |
103 }; | 103 }; |
104 | 104 |
105 } // namespace ash | 105 } // namespace ash |
106 | 106 |
107 #endif // ASH_WM_POWER_BUTTON_CONTROLLER_H_ | 107 #endif // ASH_WM_POWER_BUTTON_CONTROLLER_H_ |
OLD | NEW |