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 |
| 10 |
9 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "chrome/browser/chromeos/dbus/power_manager_client.h" |
10 | 13 |
11 namespace base { | 14 namespace base { |
12 class TimeDelta; | 15 class TimeDelta; |
13 } | 16 } |
14 | 17 |
15 namespace chromeos { | 18 namespace chromeos { |
16 | 19 |
17 typedef base::Callback<void(int64_t)> CalculateIdleTimeCallback; | 20 typedef base::Callback<void(int64_t)> CalculateIdleTimeCallback; |
| 21 struct PowerStatus; |
18 | 22 |
19 // This interface defines interaction with the ChromeOS power library APIs. | 23 // This interface defines interaction with the ChromeOS power library APIs. |
20 // Classes can add themselves as observers. Users can get an instance of this | 24 // Classes can add themselves as observers. Users can get an instance of this |
21 // library class like this: chromeos::CrosLibrary::Get()->GetPowerLibrary() | 25 // library class like this: chromeos::CrosLibrary::Get()->GetPowerLibrary() |
22 class PowerLibrary { | 26 class PowerLibrary : public PowerManagerClient::Observer { |
23 public: | 27 public: |
24 class Observer { | 28 class Observer { |
25 public: | 29 public: |
26 virtual void PowerChanged(PowerLibrary* obj) = 0; | 30 virtual void PowerChanged(PowerLibrary* obj) = 0; |
27 virtual void SystemResumed() = 0; | 31 virtual void SystemResumed() = 0; |
28 | 32 |
29 protected: | 33 protected: |
30 virtual ~Observer() {} | 34 virtual ~Observer() {} |
31 }; | 35 }; |
32 | 36 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 68 |
65 // Requests restart of the system. | 69 // Requests restart of the system. |
66 virtual void RequestRestart() = 0; | 70 virtual void RequestRestart() = 0; |
67 | 71 |
68 // Requests shutdown of the system. | 72 // Requests shutdown of the system. |
69 virtual void RequestShutdown() = 0; | 73 virtual void RequestShutdown() = 0; |
70 | 74 |
71 // UI initiated request for status update. | 75 // UI initiated request for status update. |
72 virtual void RequestStatusUpdate() = 0; | 76 virtual void RequestStatusUpdate() = 0; |
73 | 77 |
| 78 // Requests power supply info. |
| 79 virtual void UpdatePowerStatus(const chromeos::PowerStatus& status) = 0; |
| 80 |
| 81 |
74 // Factory function, creates a new instance and returns ownership. | 82 // Factory function, creates a new instance and returns ownership. |
75 // For normal usage, access the singleton via CrosLibrary::Get(). | 83 // For normal usage, access the singleton via CrosLibrary::Get(). |
76 static PowerLibrary* GetImpl(bool stub); | 84 static PowerLibrary* GetImpl(bool stub); |
77 }; | 85 }; |
78 | 86 |
79 } // namespace chromeos | 87 } // namespace chromeos |
80 | 88 |
81 #endif // CHROME_BROWSER_CHROMEOS_CROS_POWER_LIBRARY_H_ | 89 #endif // CHROME_BROWSER_CHROMEOS_CROS_POWER_LIBRARY_H_ |
OLD | NEW |