| 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 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 | 12 |
| 13 #if defined(USE_ASH) | 13 #include "chromeos/dbus/power_supply_status.h" |
| 14 #include "ash/system/power/power_supply_status.h" | |
| 15 #endif | |
| 16 | 14 |
| 17 namespace base { | 15 namespace base { |
| 18 class TimeTicks; | 16 class TimeTicks; |
| 19 } | 17 } |
| 20 namespace dbus { | 18 namespace dbus { |
| 21 class Bus; | 19 class Bus; |
| 22 } | 20 } |
| 23 | 21 |
| 24 namespace chromeos { | 22 namespace chromeos { |
| 25 | 23 |
| 26 #if defined(USE_ASH) | |
| 27 typedef struct ash::PowerSupplyStatus PowerSupplyStatus; | |
| 28 #else | |
| 29 // This is the local struct that is used in Chrome. | |
| 30 struct PowerSupplyStatus { | |
| 31 bool line_power_on; | |
| 32 | |
| 33 bool battery_is_present; | |
| 34 bool battery_is_full; | |
| 35 | |
| 36 // Time in seconds until the battery is empty or full, 0 for unknown. | |
| 37 int64 battery_seconds_to_empty; | |
| 38 int64 battery_seconds_to_full; | |
| 39 | |
| 40 double battery_percentage; | |
| 41 | |
| 42 PowerSupplyStatus(); | |
| 43 std::string ToString() const; | |
| 44 }; | |
| 45 #endif | |
| 46 | |
| 47 // Callback used for processing the idle time. The int64 param is the number of | 24 // Callback used for processing the idle time. The int64 param is the number of |
| 48 // seconds the user has been idle. | 25 // seconds the user has been idle. |
| 49 typedef base::Callback<void(int64)> CalculateIdleTimeCallback; | 26 typedef base::Callback<void(int64)> CalculateIdleTimeCallback; |
| 50 typedef base::Callback<void(void)> IdleNotificationCallback; | 27 typedef base::Callback<void(void)> IdleNotificationCallback; |
| 51 | 28 |
| 52 // PowerManagerClient is used to communicate with the power manager. | 29 // PowerManagerClient is used to communicate with the power manager. |
| 53 class PowerManagerClient { | 30 class PowerManagerClient { |
| 54 public: | 31 public: |
| 55 // Interface for observing changes from the power manager. | 32 // Interface for observing changes from the power manager. |
| 56 class Observer { | 33 class Observer { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // Create() should be used instead. | 136 // Create() should be used instead. |
| 160 PowerManagerClient(); | 137 PowerManagerClient(); |
| 161 | 138 |
| 162 private: | 139 private: |
| 163 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); | 140 DISALLOW_COPY_AND_ASSIGN(PowerManagerClient); |
| 164 }; | 141 }; |
| 165 | 142 |
| 166 } // namespace chromeos | 143 } // namespace chromeos |
| 167 | 144 |
| 168 #endif // CHROME_BROWSER_CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ | 145 #endif // CHROME_BROWSER_CHROMEOS_DBUS_POWER_MANAGER_CLIENT_H_ |
| OLD | NEW |