| Index: third_party/WebKit/Source/platform/battery/battery_dispatcher_proxy.h
|
| diff --git a/content/renderer/battery_status/battery_status_dispatcher.h b/third_party/WebKit/Source/platform/battery/battery_dispatcher_proxy.h
|
| similarity index 21%
|
| rename from content/renderer/battery_status/battery_status_dispatcher.h
|
| rename to third_party/WebKit/Source/platform/battery/battery_dispatcher_proxy.h
|
| index f117a4b385e7ade0d39565f84bdb9bf6b9334a3c..514724660c804c8ce11f29241b7815f04f3130fc 100644
|
| --- a/content/renderer/battery_status/battery_status_dispatcher.h
|
| +++ b/third_party/WebKit/Source/platform/battery/battery_dispatcher_proxy.h
|
| @@ -2,37 +2,51 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CONTENT_RENDERER_BATTERY_STATUS_BATTERY_STATUS_DISPATCHER_H_
|
| -#define CONTENT_RENDERER_BATTERY_STATUS_BATTERY_STATUS_DISPATCHER_H_
|
| +#ifndef BLINK_PLATFORM_BATTERY_BATTERY_DISPATCHER_PROXY_H_
|
| +#define BLINK_PLATFORM_BATTERY_BATTERY_DISPATCHER_PROXY_H_
|
|
|
| -#include "base/compiler_specific.h"
|
| -#include "base/macros.h"
|
| -#include "content/common/content_export.h"
|
| #include "device/battery/battery_monitor.mojom.h"
|
| +#include "platform/PlatformExport.h"
|
| +#include "wtf/Noncopyable.h"
|
|
|
| namespace blink {
|
| -class WebBatteryStatusListener;
|
| -}
|
|
|
| -namespace content {
|
| -
|
| -class CONTENT_EXPORT BatteryStatusDispatcher {
|
| +class BatteryStatus;
|
| +
|
| +// This class connects a BatteryDispatcherProxy::Listener to the underlying Mojo
|
| +// service. Note that currently the access to the Mojo service is limited in
|
| +// platform/. In future, we'll let classes in core/ and modules/ directly
|
| +// communicate with Mojo, and then, there will be no need to use this proxy
|
| +// class.
|
| +//
|
| +// TODO(yukishiino): Remove this class once Mojo supports WTF-types.
|
| +class PLATFORM_EXPORT BatteryDispatcherProxy {
|
| + WTF_MAKE_NONCOPYABLE(BatteryDispatcherProxy);
|
| public:
|
| - explicit BatteryStatusDispatcher(blink::WebBatteryStatusListener* listener);
|
| - ~BatteryStatusDispatcher();
|
| + class Listener {
|
| + public:
|
| + virtual ~Listener() = default;
|
|
|
| - private:
|
| - friend class BatteryStatusDispatcherTest;
|
| + // This method is called when a new battery status is available.
|
| + virtual void OnUpdateBatteryStatus(const BatteryStatus&) = 0;
|
| + };
|
| +
|
| + explicit BatteryDispatcherProxy(Listener*);
|
| + ~BatteryDispatcherProxy();
|
|
|
| + void StartListening();
|
| + void StopListening();
|
| +
|
| + private:
|
| void QueryNextStatus();
|
| - void DidChange(device::BatteryStatusPtr battery_status);
|
| + void OnDidChange(device::BatteryStatusPtr);
|
|
|
| device::BatteryMonitorPtr monitor_;
|
| - blink::WebBatteryStatusListener* listener_;
|
| + Listener* listener_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(BatteryStatusDispatcher);
|
| + friend class BatteryDispatcherProxyTest;
|
| };
|
|
|
| -} // namespace content
|
| +} // namespace blink
|
|
|
| -#endif // CONTENT_RENDERER_BATTERY_STATUS_BATTERY_STATUS_DISPATCHER_H_
|
| +#endif // BLINK_PLATFORM_BATTERY_BATTERY_DISPATCHER_PROXY_H_
|
|
|