| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 namespace dbus { | 13 namespace dbus { |
| 14 class Bus; | 14 class Bus; |
| 15 class ObjectProxy; | 15 class ObjectProxy; |
| 16 class Response; | 16 class Response; |
| 17 class Signal; | 17 class Signal; |
| 18 } // namespace | 18 } // namespace |
| 19 | 19 |
| 20 namespace chromeos { | 20 namespace chromeos { |
| 21 | 21 |
| 22 struct PowerStatus; |
| 23 |
| 22 // PowerManagerClient is used to communicate with the power manager. | 24 // PowerManagerClient is used to communicate with the power manager. |
| 23 class PowerManagerClient { | 25 class PowerManagerClient { |
| 24 public: | 26 public: |
| 25 // Interface for observing changes from the power manager. | 27 // Interface for observing changes from the power manager. |
| 26 class Observer { | 28 class Observer { |
| 27 public: | 29 public: |
| 28 // Called when the brightness is changed. | 30 // Called when the brightness is changed. |
| 29 // |level| is of the range [0, 100]. | 31 // |level| is of the range [0, 100]. |
| 30 // |user_initiated| is true if the action is initiated by the user. | 32 // |user_initiated| is true if the action is initiated by the user. |
| 31 virtual void BrightnessChanged(int level, bool user_initiated) = 0; | 33 virtual void BrightnessChanged(int level, bool user_initiated) {} |
| 34 |
| 35 // Called when power supply polling takes place. |status| is a data |
| 36 // structure that contains the current state of the power supply. |
| 37 virtual void UpdatePowerStatus(const chromeos::PowerStatus& status) {} |
| 32 }; | 38 }; |
| 33 | 39 |
| 34 // Adds and removes the observer. | 40 // Adds and removes the observer. |
| 35 virtual void AddObserver(Observer* observer) = 0; | 41 virtual void AddObserver(Observer* observer) = 0; |
| 36 virtual void RemoveObserver(Observer* observer) = 0; | 42 virtual void RemoveObserver(Observer* observer) = 0; |
| 37 | 43 |
| 38 // Decreases the screen brightness. |allow_off| controls whether or not | 44 // Decreases the screen brightness. |allow_off| controls whether or not |
| 39 // it's allowed to turn off the back light. | 45 // it's allowed to turn off the back light. |
| 40 virtual void DecreaseScreenBrightness(bool allow_off) = 0; | 46 virtual void DecreaseScreenBrightness(bool allow_off) = 0; |
| 41 | 47 |
| 42 // Increases the screen brightness. | 48 // Increases the screen brightness. |
| 43 virtual void IncreaseScreenBrightness() = 0; | 49 virtual void IncreaseScreenBrightness() = 0; |
| 44 | 50 |
| 45 // Creates the instance. | 51 // Creates the instance. |
| 46 static PowerManagerClient* Create(dbus::Bus* bus); | 52 static PowerManagerClient* Create(dbus::Bus* bus); |
| 47 | 53 |
| 48 PowerManagerClient(); | 54 PowerManagerClient(); |
| 49 virtual ~PowerManagerClient(); | 55 virtual ~PowerManagerClient(); |
| 50 | 56 |
| 51 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); | 57 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); |
| 52 }; | 58 }; |
| 53 | 59 |
| 54 } // namespace chromeos | 60 } // namespace chromeos |
| 55 | 61 |
| 56 #endif // CHROME_BROWSER_CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ | 62 #endif // CHROME_BROWSER_CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ |
| OLD | NEW |