Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: third_party/WebKit/Source/modules/battery/BatteryDispatcher.h

Issue 1538803002: Migrates battery_status from content/renderer/ to WebKit/platform/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a TODO comment. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698