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

Unified Diff: Source/modules/gamepad/NavigatorGamepad.h

Issue 200783002: Gamepad API: add support for gamepadconnected and gamepaddisconnected events (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: layout fix: webexposed/global-constructors-listing Created 6 years, 9 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
« no previous file with comments | « Source/modules/gamepad/GamepadEvent.idl ('k') | Source/modules/gamepad/NavigatorGamepad.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/gamepad/NavigatorGamepad.h
diff --git a/Source/modules/gamepad/NavigatorGamepad.h b/Source/modules/gamepad/NavigatorGamepad.h
index 456b96a6bfa2ef33a3f62ca09a598ab4b20f0e44..cd397b9358fbd1c4863d40e9c663cef9701ff0fe 100644
--- a/Source/modules/gamepad/NavigatorGamepad.h
+++ b/Source/modules/gamepad/NavigatorGamepad.h
@@ -26,21 +26,30 @@
#ifndef NavigatorGamepad_h
#define NavigatorGamepad_h
+#include "core/frame/DOMWindowLifecycleObserver.h"
+#include "core/frame/DOMWindowProperty.h"
+#include "core/frame/DeviceSensorEventController.h"
#include "heap/Handle.h"
#include "platform/Supplementable.h"
#include "public/platform/WebGamepads.h"
+namespace blink {
+class WebGamepad;
+class WebGamepads;
+}
+
namespace WebCore {
class GamepadList;
class Navigator;
class WebKitGamepadList;
-class NavigatorGamepad FINAL : public NoBaseWillBeGarbageCollectedFinalized<NavigatorGamepad>, public WillBeHeapSupplement<Navigator> {
+class NavigatorGamepad FINAL : public NoBaseWillBeGarbageCollectedFinalized<NavigatorGamepad>, public WillBeHeapSupplement<Navigator>, public DOMWindowProperty, public DeviceSensorEventController, public DOMWindowLifecycleObserver {
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NavigatorGamepad);
public:
- virtual ~NavigatorGamepad();
+ static NavigatorGamepad* from(Document&);
static NavigatorGamepad& from(Navigator&);
+ virtual ~NavigatorGamepad();
static WebKitGamepadList* webkitGetGamepads(Navigator&);
static GamepadList* getGamepads(Navigator&);
@@ -50,10 +59,29 @@ public:
virtual void trace(Visitor*);
+ void didConnectOrDisconnectGamepad(unsigned index, const blink::WebGamepad&, bool connected);
+
private:
- NavigatorGamepad();
+ explicit NavigatorGamepad(Document&);
+
static const char* supplementName();
+ // DOMWindowProperty
+ virtual void willDestroyGlobalObjectInFrame() OVERRIDE FINAL;
+ virtual void willDetachGlobalObjectFromFrame() OVERRIDE FINAL;
+
+ // DeviceSensorEventController
+ virtual void registerWithDispatcher() OVERRIDE FINAL;
+ virtual void unregisterWithDispatcher() OVERRIDE FINAL;
+ virtual bool hasLastData() OVERRIDE FINAL;
+ virtual PassRefPtr<Event> getLastEvent() OVERRIDE FINAL;
+ virtual bool isNullEvent(Event*) OVERRIDE FINAL;
+
+ // DOMWindowLifecycleObserver
+ virtual void didAddEventListener(DOMWindow*, const AtomicString&) OVERRIDE FINAL;
+ virtual void didRemoveEventListener(DOMWindow*, const AtomicString&) OVERRIDE FINAL;
+ virtual void didRemoveAllEventListeners(DOMWindow*) OVERRIDE FINAL;
+
RefPtrWillBeMember<GamepadList> m_gamepads;
RefPtrWillBeMember<WebKitGamepadList> m_webkitGamepads;
};
« no previous file with comments | « Source/modules/gamepad/GamepadEvent.idl ('k') | Source/modules/gamepad/NavigatorGamepad.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698