OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_SYSTEM_CHROMEOS_POWER_POWER_STATUS_H_ | 5 #ifndef ASH_SYSTEM_CHROMEOS_POWER_POWER_STATUS_H_ |
6 #define ASH_SYSTEM_CHROMEOS_POWER_POWER_STATUS_H_ | 6 #define ASH_SYSTEM_CHROMEOS_POWER_POWER_STATUS_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 // Gets the global instance. Initialize must be called first. | 56 // Gets the global instance. Initialize must be called first. |
57 static PowerStatus* Get(); | 57 static PowerStatus* Get(); |
58 | 58 |
59 // Returns true if |time|, a time returned by GetBatteryTimeToEmpty() or | 59 // Returns true if |time|, a time returned by GetBatteryTimeToEmpty() or |
60 // GetBatteryTimeToFull(), should be displayed in the UI. | 60 // GetBatteryTimeToFull(), should be displayed in the UI. |
61 // Less-than-a-minute or very large values aren't displayed. | 61 // Less-than-a-minute or very large values aren't displayed. |
62 static bool ShouldDisplayBatteryTime(const base::TimeDelta& time); | 62 static bool ShouldDisplayBatteryTime(const base::TimeDelta& time); |
63 | 63 |
64 // Copies the hour and minute components of |time| to |hours| and |minutes|. | 64 // Copies the hour and minute components of |time| to |hours| and |minutes|. |
| 65 // The minute component is rounded rather than truncated: a |time| value |
| 66 // corresponding to 92 seconds will produce a |minutes| value of 2, for |
| 67 // example. |
65 static void SplitTimeIntoHoursAndMinutes(const base::TimeDelta& time, | 68 static void SplitTimeIntoHoursAndMinutes(const base::TimeDelta& time, |
66 int* hours, | 69 int* hours, |
67 int* minutes); | 70 int* minutes); |
68 | 71 |
69 // Adds or removes an observer. | 72 // Adds or removes an observer. |
70 void AddObserver(Observer* observer); | 73 void AddObserver(Observer* observer); |
71 void RemoveObserver(Observer* observer); | 74 void RemoveObserver(Observer* observer); |
72 | 75 |
73 // Requests updated status from the power manager. | 76 // Requests updated status from the power manager. |
74 void RequestStatusUpdate(); | 77 void RequestStatusUpdate(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Current state. | 146 // Current state. |
144 power_manager::PowerSupplyProperties proto_; | 147 power_manager::PowerSupplyProperties proto_; |
145 | 148 |
146 DISALLOW_COPY_AND_ASSIGN(PowerStatus); | 149 DISALLOW_COPY_AND_ASSIGN(PowerStatus); |
147 }; | 150 }; |
148 | 151 |
149 } // namespace internal | 152 } // namespace internal |
150 } // namespace ash | 153 } // namespace ash |
151 | 154 |
152 #endif // ASH_SYSTEM_CHROMEOS_POWER_POWER_STATUS_H_ | 155 #endif // ASH_SYSTEM_CHROMEOS_POWER_POWER_STATUS_H_ |
OLD | NEW |