| Index: chromeos/dbus/power_data_collector.h
|
| diff --git a/chromeos/dbus/power_data_collector.h b/chromeos/dbus/power_data_collector.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f7cfe316a2f6255e4a3c91ca930b0cca786242b1
|
| --- /dev/null
|
| +++ b/chromeos/dbus/power_data_collector.h
|
| @@ -0,0 +1,51 @@
|
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROMEOS_DBUS_POWER_DATA_COLLECTOR_H_
|
| +#define CHROMEOS_DBUS_POWER_DATA_COLLECTOR_H_
|
| +
|
| +#include <vector>
|
| +
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "chromeos/dbus/power_manager_client.h"
|
| +
|
| +namespace power_manager {
|
| +class PowerSupplyProperties;
|
| +}
|
| +
|
| +namespace chromeos {
|
| +
|
| +class PowerDataCollector : public PowerManagerClient::Observer {
|
| + public:
|
| + struct PowerSupplySnapshot {
|
| + // Generated by Time::ToInternalValue.
|
| + int64 time;
|
| +
|
| + // true if connected to externel power at the time of the snapshot.
|
| + bool external_power;
|
| +
|
| + // The battery charge as a percentage of full charge in range [0.0, 100.00].
|
| + double battery_charge;
|
| + };
|
| +
|
| + public:
|
| + PowerDataCollector(PowerManagerClient* pm_client);
|
| + ~PowerDataCollector();
|
| +
|
| + virtual void PowerChanged(const power_manager::PowerSupplyProperties& prop);
|
| +
|
| + std::vector<PowerSupplySnapshot> *GetPowerSupplyData(void) const {
|
| + return power_supply_.get();
|
| + }
|
| +
|
| + private:
|
| + PowerManagerClient* pm_client_;
|
| + scoped_ptr<std::vector<PowerSupplySnapshot> > power_supply_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(PowerDataCollector);
|
| +};
|
| +
|
| +} // namespace chromeos
|
| +
|
| +#endif // CHROMEOS_DBUS_POWER_DATA_COLLECTOR_H_
|
|
|