Chromium Code Reviews| Index: third_party/WebKit/Source/modules/battery/BatteryDispatcher.h |
| diff --git a/third_party/WebKit/Source/modules/battery/BatteryDispatcher.h b/third_party/WebKit/Source/modules/battery/BatteryDispatcher.h |
| index 40c3fcfb2ebf307d45372439b08f9c12e018c191..d1fbdb3c4a001c6ada4c6b7ef002d4d9ab09a1a9 100644 |
| --- a/third_party/WebKit/Source/modules/battery/BatteryDispatcher.h |
| +++ b/third_party/WebKit/Source/modules/battery/BatteryDispatcher.h |
| @@ -6,26 +6,28 @@ |
| #define BatteryDispatcher_h |
| #include "core/frame/PlatformEventDispatcher.h" |
| +#include "modules/ModulesExport.h" |
| #include "modules/battery/BatteryManager.h" |
| -#include "modules/battery/BatteryStatus.h" |
| -#include "public/platform/WebBatteryStatusListener.h" |
| +#include "platform/battery/battery_dispatcher_proxy.h" |
| +#include "wtf/OwnPtr.h" |
| namespace blink { |
| -class WebBatteryStatus; |
| +class BatteryDispatcherProxy; |
|
kinuko
2016/02/18 00:50:53
nit: now we include the header for Listener class
Yuki
2016/02/18 06:05:14
Done.
|
| -class BatteryDispatcher final : public GarbageCollectedFinalized<BatteryDispatcher>, public PlatformEventDispatcher, public WebBatteryStatusListener { |
| +class MODULES_EXPORT BatteryDispatcher final : public GarbageCollectedFinalized<BatteryDispatcher>, public PlatformEventDispatcher, public BatteryDispatcherProxy::Listener { |
| USING_GARBAGE_COLLECTED_MIXIN(BatteryDispatcher); |
| public: |
| static BatteryDispatcher& instance(); |
| ~BatteryDispatcher() override; |
| - BatteryStatus* latestData(); |
| + const BatteryStatus* latestData() const |
| + { |
| + return m_hasLatestData ? &m_batteryStatus : nullptr; |
| + } |
| - // Inherited from WebBatteryStatusListener. |
| - void updateBatteryStatus(const WebBatteryStatus&) override; |
| - |
| - DECLARE_VIRTUAL_TRACE(); |
| + // Inherited from BatteryDispatcherProxy::Listener. |
| + void OnUpdateBatteryStatus(const BatteryStatus&) override; |
| private: |
| BatteryDispatcher(); |
| @@ -34,7 +36,9 @@ private: |
| void startListening() override; |
| void stopListening() override; |
| - Member<BatteryStatus> m_batteryStatus; |
| + BatteryStatus m_batteryStatus; |
| + bool m_hasLatestData; |
| + OwnPtr<BatteryDispatcherProxy> m_batteryDispatcherProxy; |
| }; |
| } // namespace blink |