Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2687)

Unified Diff: device/battery/battery_status_manager_linux.h

Issue 2066503002: Implement device::BatteryStatus support for UPower daemon 0.99.x (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implement device::BatteryStatus support for UPower daemon 0.99.x (rebased) Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/battery/battery.gyp ('k') | device/battery/battery_status_manager_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/battery/battery_status_manager_linux.h
diff --git a/device/battery/battery_status_manager_linux.h b/device/battery/battery_status_manager_linux.h
index 7b71a04dc458c7b1b0f6f840c76e36c5d8dfb5aa..019fd3efec6d9606605f2b577d5a84083f2f4979 100644
--- a/device/battery/battery_status_manager_linux.h
+++ b/device/battery/battery_status_manager_linux.h
@@ -6,13 +6,13 @@
#include "device/battery/battery_export.h"
#include "device/battery/battery_status.mojom.h"
+#include "device/battery/battery_status_manager.h"
-namespace base {
-class DictionaryValue;
-}
+namespace dbus {
+class Bus;
+} // namespace dbus
namespace device {
-
// UPowerDeviceState reflects the possible UPower.Device.State values,
// see upower.freedesktop.org/docs/Device.html#Device:State.
enum UPowerDeviceState {
@@ -25,9 +25,50 @@ enum UPowerDeviceState {
UPOWER_DEVICE_STATE_PENDING_DISCHARGE = 6,
};
-// Returns the BatteryStatus computed using the provided dictionary.
-DEVICE_BATTERY_EXPORT BatteryStatus ComputeWebBatteryStatus(
- const base::DictionaryValue& dictionary);
+// UPowerDeviceType reflects the possible UPower.Device.Type values,
+// see upower.freedesktop.org/docs/Device.html#Device:Type.
+enum UPowerDeviceType {
+ UPOWER_DEVICE_TYPE_UNKNOWN = 0,
+ UPOWER_DEVICE_TYPE_LINE_POWER = 1,
+ UPOWER_DEVICE_TYPE_BATTERY = 2,
+ UPOWER_DEVICE_TYPE_UPS = 3,
+ UPOWER_DEVICE_TYPE_MONITOR = 4,
+ UPOWER_DEVICE_TYPE_MOUSE = 5,
+ UPOWER_DEVICE_TYPE_KEYBOARD = 6,
+ UPOWER_DEVICE_TYPE_PDA = 7,
+ UPOWER_DEVICE_TYPE_PHONE = 8,
+};
+
+// Creates a notification thread and delegates Start/Stop calls to it.
+class DEVICE_BATTERY_EXPORT BatteryStatusManagerLinux
+ : public BatteryStatusManager {
+ public:
+ explicit BatteryStatusManagerLinux(
+ const BatteryStatusService::BatteryUpdateCallback& callback);
+ ~BatteryStatusManagerLinux() override;
+
+ private:
+ friend class BatteryStatusManagerLinuxTest;
+ class BatteryStatusNotificationThread;
+
+ // BatteryStatusManager:
+ bool StartListeningBatteryChange() override;
+ void StopListeningBatteryChange() override;
+
+ // Starts the notifier thread if not already started and returns true on
+ // success.
+ bool StartNotifierThreadIfNecessary();
+ base::Thread* GetNotifierThreadForTesting();
+
+ static std::unique_ptr<BatteryStatusManagerLinux> CreateForTesting(
+ const BatteryStatusService::BatteryUpdateCallback& callback,
+ dbus::Bus* bus);
+
+ BatteryStatusService::BatteryUpdateCallback callback_;
+ std::unique_ptr<BatteryStatusNotificationThread> notifier_thread_;
+
+ DISALLOW_COPY_AND_ASSIGN(BatteryStatusManagerLinux);
+};
} // namespace device
« no previous file with comments | « device/battery/battery.gyp ('k') | device/battery/battery_status_manager_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698