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

Unified Diff: Source/modules/gamepad/GamepadDispatcher.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/core/events/EventTypeNames.in ('k') | Source/modules/gamepad/GamepadDispatcher.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/core/events/EventTypeNames.in ('k') | Source/modules/gamepad/GamepadDispatcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698