Roll WebRTC 8987:8989, Libjingle 8985:8990
[chromium-blink-merge.git] / device / battery / battery_monitor_impl.h
blob6bf65f73f27f2a04837cd67a2f28fd41aa5c858c
1 // Copyright 2014 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.
5 #ifndef DEVICE_BATTERY_BATTERY_MONITOR_IMPL_H_
6 #define DEVICE_BATTERY_BATTERY_MONITOR_IMPL_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "device/battery/battery_export.h"
10 #include "device/battery/battery_monitor.mojom.h"
11 #include "device/battery/battery_status_service.h"
12 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
14 namespace device {
16 class BatteryMonitorImpl : public BatteryMonitor {
17 public:
18 DEVICE_BATTERY_EXPORT static void Create(
19 mojo::InterfaceRequest<BatteryMonitor> request);
21 private:
22 typedef mojo::Callback<void(BatteryStatusPtr)> BatteryStatusCallback;
24 explicit BatteryMonitorImpl(mojo::InterfaceRequest<BatteryMonitor> request);
25 ~BatteryMonitorImpl() override;
27 // BatteryMonitor methods:
28 void QueryNextStatus(const BatteryStatusCallback& callback) override;
30 void RegisterSubscription();
31 void DidChange(const BatteryStatus& battery_status);
32 void ReportStatus();
34 mojo::StrongBinding<BatteryMonitor> binding_;
35 scoped_ptr<BatteryStatusService::BatteryUpdateSubscription> subscription_;
36 BatteryStatusCallback callback_;
37 BatteryStatus status_;
38 bool status_to_report_;
40 DISALLOW_COPY_AND_ASSIGN(BatteryMonitorImpl);
43 } // namespace device
45 #endif // DEVICE_BATTERY_BATTERY_MONITOR_IMPL_H_