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_CROS_POWER_LIBRARY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_POWER_LIBRARY_H_ |
6 #define CHROME_BROWSER_CHROMEOS_CROS_POWER_LIBRARY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CROS_POWER_LIBRARY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // TODO(sque): Move to chrome/browser/chromeos/system, crosbug.com/16558 | 9 // TODO(sque): Move to chrome/browser/chromeos/system, crosbug.com/16558 |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 bool line_power_on; | 22 bool line_power_on; |
23 | 23 |
24 bool battery_is_present; | 24 bool battery_is_present; |
25 bool battery_is_full; | 25 bool battery_is_full; |
26 | 26 |
27 // Time in seconds until the battery is empty or full, 0 for unknown. | 27 // Time in seconds until the battery is empty or full, 0 for unknown. |
28 int64 battery_seconds_to_empty; | 28 int64 battery_seconds_to_empty; |
29 int64 battery_seconds_to_full; | 29 int64 battery_seconds_to_full; |
30 | 30 |
31 double battery_percentage; | 31 double battery_percentage; |
| 32 |
| 33 PowerSupplyStatus() : line_power_on(false), |
| 34 battery_is_present(false), |
| 35 battery_is_full(false), |
| 36 battery_seconds_to_empty(0), |
| 37 battery_seconds_to_full(0), |
| 38 battery_percentage(0) {} |
32 }; | 39 }; |
33 | 40 |
34 // This interface defines interaction with the ChromeOS power library APIs. | 41 // This interface defines interaction with the ChromeOS power library APIs. |
35 // Classes can add themselves as observers. Users can get an instance of this | 42 // Classes can add themselves as observers. Users can get an instance of this |
36 // library class like this: chromeos::CrosLibrary::Get()->GetPowerLibrary() | 43 // library class like this: chromeos::CrosLibrary::Get()->GetPowerLibrary() |
37 class PowerLibrary { | 44 class PowerLibrary { |
38 public: | 45 public: |
39 class Observer { | 46 class Observer { |
40 public: | 47 public: |
41 virtual void PowerChanged(const PowerSupplyStatus& status) = 0; | 48 virtual void PowerChanged(const PowerSupplyStatus& status) = 0; |
(...skipping 27 matching lines...) Expand all Loading... |
69 virtual void RequestStatusUpdate() = 0; | 76 virtual void RequestStatusUpdate() = 0; |
70 | 77 |
71 // Factory function, creates a new instance and returns ownership. | 78 // Factory function, creates a new instance and returns ownership. |
72 // For normal usage, access the singleton via CrosLibrary::Get(). | 79 // For normal usage, access the singleton via CrosLibrary::Get(). |
73 static PowerLibrary* GetImpl(bool stub); | 80 static PowerLibrary* GetImpl(bool stub); |
74 }; | 81 }; |
75 | 82 |
76 } // namespace chromeos | 83 } // namespace chromeos |
77 | 84 |
78 #endif // CHROME_BROWSER_CHROMEOS_CROS_POWER_LIBRARY_H_ | 85 #endif // CHROME_BROWSER_CHROMEOS_CROS_POWER_LIBRARY_H_ |
OLD | NEW |