Index: Source/core/frame/DOMWindow.cpp |
diff --git a/Source/core/frame/DOMWindow.cpp b/Source/core/frame/DOMWindow.cpp |
index f301a446854c952d9e5d615c8fa947f8bcde5072..cce5251f7b7e3b2b6ee802e0067131f0285bd7da 100644 |
--- a/Source/core/frame/DOMWindow.cpp |
+++ b/Source/core/frame/DOMWindow.cpp |
@@ -105,6 +105,9 @@ |
#include "wtf/text/WTFString.h" |
#include <algorithm> |
+// FIXME: this is a layering vilation. |
Inactive
2014/03/14 19:46:08
Yes, we don't want that :)
kbalazs
2014/03/14 23:51:27
Done.
|
+#include "modules/gamepad/NavigatorGamepad.h" |
+ |
using std::min; |
using std::max; |
@@ -1518,6 +1521,13 @@ bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<Event |
// Subframes return false from allowsBeforeUnloadListeners. |
UseCounter::count(document(), UseCounter::SubFrameBeforeUnloadRegistered); |
} |
+ } else if (eventType == EventTypeNames::gamepadconnected || eventType == EventTypeNames::gamepaddisconnected) { |
sof
2014/03/14 20:52:43
Just above these special cases, DOMWindow observer
kbalazs
2014/03/14 23:51:27
Wonderful, thanks. Together with FrameLoaderClient
|
+ // If an event listener is added for gamepad events sample the gamepads once to start monitoring gamepad state. |
+ // FIXME: we need to instantiate NavigatorGamepad here so that it can listen to the events. |
+ // Otherwise it would only be created when js calls getGamepads() or webkitGetGamepads() and we cannot assume that |
+ // it will happen before a gamepad is connected. But this is a layering violation because NavigatorGamepad lives |
+ // in modules. |
+ NavigatorGamepad::getGamepads(navigator()); |
Inactive
2014/03/14 19:46:08
You should probably take a look at FrameLoaderClie
kbalazs
2014/03/14 23:51:27
Done.
|
} |
return true; |