Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_BATTERY_STATUS_BATTERY_STATUS_DISPATCHER_H_ | 5 #ifndef BLINK_PLATFORM_BATTERY_BATTERY_DISPATCHER_PROXY_H_ |
| 6 #define CONTENT_RENDERER_BATTERY_STATUS_BATTERY_STATUS_DISPATCHER_H_ | 6 #define BLINK_PLATFORM_BATTERY_BATTERY_DISPATCHER_PROXY_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "content/common/content_export.h" | |
| 11 #include "device/battery/battery_monitor.mojom.h" | 8 #include "device/battery/battery_monitor.mojom.h" |
| 9 #include "platform/PlatformExport.h" | |
| 10 #include "wtf/Noncopyable.h" | |
| 12 | 11 |
| 13 namespace blink { | 12 namespace blink { |
| 14 class WebBatteryStatusListener; | |
| 15 } | |
| 16 | 13 |
| 17 namespace content { | 14 class BatteryStatusListener; |
| 18 | 15 |
| 19 class CONTENT_EXPORT BatteryStatusDispatcher { | 16 // This class connects a BatteryStatusListener to the underlying Mojo service. |
| 17 // Note that currently the access to the Mojo service is limited in platform/. | |
| 18 // In future, we'll let classes in core/ and modules/ directly communicate with | |
| 19 // Mojo, and then, there will be no need to use this proxy class. | |
|
haraken
2016/02/15 13:18:39
// TODO(yukishiino): Remove this class.
Yuki
2016/02/16 07:31:58
Done.
| |
| 20 class PLATFORM_EXPORT BatteryDispatcherProxy { | |
| 21 WTF_MAKE_NONCOPYABLE(BatteryDispatcherProxy); | |
| 20 public: | 22 public: |
| 21 explicit BatteryStatusDispatcher(blink::WebBatteryStatusListener* listener); | 23 explicit BatteryDispatcherProxy(BatteryStatusListener*); |
| 22 ~BatteryStatusDispatcher(); | 24 ~BatteryDispatcherProxy(); |
| 25 | |
| 26 void StartListening(); | |
| 27 void StopListening(); | |
| 23 | 28 |
| 24 private: | 29 private: |
| 25 friend class BatteryStatusDispatcherTest; | |
| 26 | |
| 27 void QueryNextStatus(); | 30 void QueryNextStatus(); |
| 28 void DidChange(device::BatteryStatusPtr battery_status); | 31 void OnDidChange(device::BatteryStatusPtr); |
| 29 | 32 |
| 30 device::BatteryMonitorPtr monitor_; | 33 device::BatteryMonitorPtr monitor_; |
| 31 blink::WebBatteryStatusListener* listener_; | 34 BatteryStatusListener* listener_; |
| 32 | 35 |
| 33 DISALLOW_COPY_AND_ASSIGN(BatteryStatusDispatcher); | 36 friend class BatteryDispatcherProxyTest; |
| 34 }; | 37 }; |
| 35 | 38 |
| 36 } // namespace content | 39 } // namespace blink |
| 37 | 40 |
| 38 #endif // CONTENT_RENDERER_BATTERY_STATUS_BATTERY_STATUS_DISPATCHER_H_ | 41 #endif // BLINK_PLATFORM_BATTERY_BATTERY_DISPATCHER_PROXY_H_ |
| OLD | NEW |