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

Unified Diff: content/renderer/renderer_webkitplatformsupport_impl.cc

Issue 207323002: Gamepad API: add test support for gamepad events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: content/renderer/renderer_webkitplatformsupport_impl.cc
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc
index 8ccd60aca42cbccbf9550049c4ab1f3fc36e948f..8708c934f24926cbee573b45d81301ab5bb9c697 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.cc
+++ b/content/renderer/renderer_webkitplatformsupport_impl.cc
@@ -120,6 +120,7 @@ using blink::WebBlobRegistry;
using blink::WebDatabaseObserver;
using blink::WebFileInfo;
using blink::WebFileSystem;
+using blink::WebGamepad;
using blink::WebGamepads;
using blink::WebIDBFactory;
using blink::WebMIDIAccessor;
@@ -136,6 +137,7 @@ using blink::WebVector;
namespace content {
static bool g_sandbox_enabled = true;
+static blink::WebGamepadListener* web_gamepad_listener = NULL;
jochen (gone - plz use gerrit) 2014/03/24 12:22:40 can this be a member of RendererWebKitPlatformSupp
base::LazyInstance<WebGamepads>::Leaky g_test_gamepads =
LAZY_INSTANCE_INITIALIZER;
base::LazyInstance<blink::WebDeviceMotionData>::Leaky
@@ -915,6 +917,11 @@ void RendererWebKitPlatformSupportImpl::sampleGamepads(WebGamepads& gamepads) {
}
}
+void RendererWebKitPlatformSupportImpl::setGamepadListener(
+ blink::WebGamepadListener* listener) {
+ web_gamepad_listener = listener;
+}
+
//------------------------------------------------------------------------------
WebRTCPeerConnectionHandler*
@@ -966,6 +973,22 @@ void RendererWebKitPlatformSupportImpl::SetMockGamepadsForTesting(
g_test_gamepads.Get() = pads;
}
+// static
+void RendererWebKitPlatformSupportImpl::MockGamepadConnected(
+ int index,
+ const WebGamepad& pad) {
+ if (web_gamepad_listener)
+ web_gamepad_listener->didConnectGamepad(index, pad);
+}
+
+// static
+void RendererWebKitPlatformSupportImpl::MockGamepadDisconnected(
+ int index,
+ const WebGamepad& pad) {
+ if (web_gamepad_listener)
+ web_gamepad_listener->didDisconnectGamepad(index, pad);
+}
+
//------------------------------------------------------------------------------
blink::WebSpeechSynthesizer*
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.h ('k') | content/shell/renderer/test_runner/WebTestDelegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698