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..3003f0462307faa4086fb64ab492921199f11ddd 100644 |
| --- a/third_party/WebKit/Source/modules/battery/BatteryDispatcher.h |
| +++ b/third_party/WebKit/Source/modules/battery/BatteryDispatcher.h |
| @@ -6,26 +6,27 @@ |
| #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" |
|
kinuko
2016/02/16 10:09:18
nit: this could be forward-declared
Yuki
2016/02/16 13:21:58
Done.
|
| +#include "platform/battery/battery_status_listener.h" |
| +#include "wtf/OwnPtr.h" |
| namespace blink { |
| -class WebBatteryStatus; |
| - |
| -class BatteryDispatcher final : public GarbageCollectedFinalized<BatteryDispatcher>, public PlatformEventDispatcher, public WebBatteryStatusListener { |
| +class MODULES_EXPORT BatteryDispatcher final : public GarbageCollectedFinalized<BatteryDispatcher>, public PlatformEventDispatcher, public BatteryStatusListener { |
| USING_GARBAGE_COLLECTED_MIXIN(BatteryDispatcher); |
| public: |
| static BatteryDispatcher& instance(); |
| ~BatteryDispatcher() override; |
| - BatteryStatus* latestData(); |
| - |
| - // Inherited from WebBatteryStatusListener. |
| - void updateBatteryStatus(const WebBatteryStatus&) override; |
| + const BatteryStatus* latestData() const |
| + { |
| + return m_hasLatestData ? &m_batteryStatus : nullptr; |
| + } |
| - DECLARE_VIRTUAL_TRACE(); |
| + // Inherited from BatteryStatusListener. |
| + void OnUpdateBatteryStatus(const BatteryStatus&) override; |
| private: |
| BatteryDispatcher(); |
| @@ -34,7 +35,9 @@ private: |
| void startListening() override; |
| void stopListening() override; |
| - Member<BatteryStatus> m_batteryStatus; |
| + BatteryStatus m_batteryStatus; |
| + bool m_hasLatestData; |
| + OwnPtr<BatteryDispatcherProxy> m_batteryDispatcherProxy; |
| }; |
| } // namespace blink |