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/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/wm/session_state_animator.h" | 9 #include "ash/wm/session_state_animator.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 | 11 |
12 #if defined(OS_CHROMEOS) && defined(USE_X11) | 12 #if defined(OS_CHROMEOS) |
13 #include "ui/display/chromeos/output_configurator.h" | 13 #include "ui/display/chromeos/output_configurator.h" |
14 #endif | 14 #endif |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 class Rect; | 17 class Rect; |
18 class Size; | 18 class Size; |
19 } | 19 } |
20 | 20 |
21 namespace ui { | 21 namespace ui { |
22 class Layer; | 22 class Layer; |
23 } | 23 } |
24 | 24 |
25 namespace ash { | 25 namespace ash { |
26 | 26 |
27 namespace test { | 27 namespace test { |
28 class PowerButtonControllerTest; | 28 class PowerButtonControllerTest; |
29 } | 29 } |
30 | 30 |
31 class LockStateController; | 31 class LockStateController; |
32 | 32 |
33 // Displays onscreen animations and locks or suspends the system in response to | 33 // Displays onscreen animations and locks or suspends the system in response to |
34 // the power button being pressed or released. | 34 // the power button being pressed or released. |
35 class ASH_EXPORT PowerButtonController | 35 class ASH_EXPORT PowerButtonController |
36 // TODO(derat): Remove these ifdefs after OutputConfigurator becomes | 36 // TODO(derat): Remove these ifdefs after OutputConfigurator becomes |
37 // cross-platform. | 37 // cross-platform. |
38 #if defined(OS_CHROMEOS) && defined(USE_X11) | 38 #if defined(OS_CHROMEOS) |
39 : public ui::OutputConfigurator::Observer | 39 : public ui::OutputConfigurator::Observer |
40 #endif | 40 #endif |
41 { | 41 { |
42 public: | 42 public: |
43 explicit PowerButtonController(LockStateController* controller); | 43 explicit PowerButtonController(LockStateController* controller); |
44 virtual ~PowerButtonController(); | 44 virtual ~PowerButtonController(); |
45 | 45 |
46 void set_has_legacy_power_button_for_test(bool legacy) { | 46 void set_has_legacy_power_button_for_test(bool legacy) { |
47 has_legacy_power_button_ = legacy; | 47 has_legacy_power_button_ = legacy; |
48 } | 48 } |
49 | 49 |
50 // Called when the current screen brightness changes. | 50 // Called when the current screen brightness changes. |
51 void OnScreenBrightnessChanged(double percent); | 51 void OnScreenBrightnessChanged(double percent); |
52 | 52 |
53 // Called when the power or lock buttons are pressed or released. | 53 // Called when the power or lock buttons are pressed or released. |
54 void OnPowerButtonEvent(bool down, const base::TimeTicks& timestamp); | 54 void OnPowerButtonEvent(bool down, const base::TimeTicks& timestamp); |
55 void OnLockButtonEvent(bool down, const base::TimeTicks& timestamp); | 55 void OnLockButtonEvent(bool down, const base::TimeTicks& timestamp); |
56 | 56 |
57 #if defined(OS_CHROMEOS) && defined(USE_X11) | 57 #if defined(OS_CHROMEOS) |
58 // Overriden from ui::OutputConfigurator::Observer: | 58 // Overriden from ui::OutputConfigurator::Observer: |
59 virtual void OnDisplayModeChanged( | 59 virtual void OnDisplayModeChanged( |
60 const ui::OutputConfigurator::DisplayStateList& outputs) OVERRIDE; | 60 const ui::OutputConfigurator::DisplayStateList& outputs) OVERRIDE; |
61 #endif | 61 #endif |
62 | 62 |
63 private: | 63 private: |
64 friend class test::PowerButtonControllerTest; | 64 friend class test::PowerButtonControllerTest; |
65 | 65 |
66 // Are the power or lock buttons currently held? | 66 // Are the power or lock buttons currently held? |
67 bool power_button_down_; | 67 bool power_button_down_; |
(...skipping 12 matching lines...) Expand all Loading... |
80 bool has_legacy_power_button_; | 80 bool has_legacy_power_button_; |
81 | 81 |
82 LockStateController* controller_; // Not owned. | 82 LockStateController* controller_; // Not owned. |
83 | 83 |
84 DISALLOW_COPY_AND_ASSIGN(PowerButtonController); | 84 DISALLOW_COPY_AND_ASSIGN(PowerButtonController); |
85 }; | 85 }; |
86 | 86 |
87 } // namespace ash | 87 } // namespace ash |
88 | 88 |
89 #endif // ASH_WM_POWER_BUTTON_CONTROLLER_H_ | 89 #endif // ASH_WM_POWER_BUTTON_CONTROLLER_H_ |
OLD | NEW |