| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROMEOS_DBUS_POWER_DATA_COLLECTOR_H_ |
| 6 #define CHROMEOS_DBUS_POWER_DATA_COLLECTOR_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chromeos/dbus/power_manager_client.h" |
| 12 |
| 13 namespace power_manager { |
| 14 class PowerSupplyProperties; |
| 15 } |
| 16 |
| 17 namespace chromeos { |
| 18 |
| 19 class PowerDataCollector : public PowerManagerClient::Observer { |
| 20 public: |
| 21 struct PowerSupplySnapshot { |
| 22 // Generated by Time::ToInternalValue. |
| 23 int64 time; |
| 24 |
| 25 // true if connected to externel power at the time of the snapshot. |
| 26 bool external_power; |
| 27 |
| 28 // The battery charge as a percentage of full charge in range [0.0, 100.00]. |
| 29 double battery_charge; |
| 30 }; |
| 31 |
| 32 public: |
| 33 PowerDataCollector(PowerManagerClient* pm_client); |
| 34 ~PowerDataCollector(); |
| 35 |
| 36 virtual void PowerChanged(const power_manager::PowerSupplyProperties& prop); |
| 37 |
| 38 std::vector<PowerSupplySnapshot> *GetPowerSupplyData(void) const { |
| 39 return power_supply_.get(); |
| 40 } |
| 41 |
| 42 private: |
| 43 PowerManagerClient* pm_client_; |
| 44 scoped_ptr<std::vector<PowerSupplySnapshot> > power_supply_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(PowerDataCollector); |
| 47 }; |
| 48 |
| 49 } // namespace chromeos |
| 50 |
| 51 #endif // CHROMEOS_DBUS_POWER_DATA_COLLECTOR_H_ |
| OLD | NEW |