Index: Source/modules/gamepad/GamepadDispatcher.h |
diff --git a/Source/modules/gamepad/GamepadDispatcher.h b/Source/modules/gamepad/GamepadDispatcher.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8ee91a024cfac4afce91f4d445dd4b2ad14a5f71 |
--- /dev/null |
+++ b/Source/modules/gamepad/GamepadDispatcher.h |
@@ -0,0 +1,42 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef GamepadDispatcher_h |
+#define GamepadDispatcher_h |
+ |
+#include "core/frame/DeviceSensorEventDispatcher.h" |
+#include "public/platform/WebGamepadListener.h" |
+ |
+namespace blink { |
+class WebGamepad; |
+class WebGamepads; |
+} |
+ |
+namespace WebCore { |
+ |
+class NavigatorGamepad; |
+ |
+class GamepadDispatcher : public DeviceSensorEventDispatcher, public blink::WebGamepadListener { |
+public: |
+ static GamepadDispatcher& instance(); |
+ |
+ void addClient(NavigatorGamepad*); |
+ void removeClient(NavigatorGamepad*); |
+ void sampleGamepads(blink::WebGamepads&); |
+ |
+private: |
+ GamepadDispatcher(); |
+ virtual ~GamepadDispatcher(); |
+ |
+ virtual void didConnectGamepad(unsigned index, const blink::WebGamepad&) OVERRIDE; |
+ virtual void didDisconnectGamepad(unsigned index, const blink::WebGamepad&) OVERRIDE; |
+ void dispatchDidConnectOrDisconnectGamepad(unsigned index, const blink::WebGamepad&, bool connected); |
+ |
+ virtual void startListening() OVERRIDE; |
+ virtual void stopListening() OVERRIDE; |
+}; |
+ |
+} // namespace WebCore |
+ |
+#endif |