| 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
|
|
|
|
|