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

Unified Diff: content/renderer/renderer_webkitplatformsupport_impl.cc

Issue 304403002: Gamepad: add test support for page visibility behavior (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add missing override's Created 6 years, 6 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 fd130728426f531ddab314f010181b831b55eb6d..33fa336c0ca94ef9c387f2b827ba9e4fe9aeb4bf 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.cc
+++ b/content/renderer/renderer_webkitplatformsupport_impl.cc
@@ -141,9 +141,6 @@ namespace content {
namespace {
static bool g_sandbox_enabled = true;
-static blink::WebGamepadListener* web_gamepad_listener = NULL;
-base::LazyInstance<WebGamepads>::Leaky g_test_gamepads =
- LAZY_INSTANCE_INITIALIZER;
base::LazyInstance<blink::WebDeviceMotionData>::Leaky
g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER;
base::LazyInstance<blink::WebDeviceOrientationData>::Leaky
@@ -231,7 +228,8 @@ RendererWebKitPlatformSupportImpl::RendererWebKitPlatformSupportImpl()
sudden_termination_disables_(0),
plugin_refresh_allowed_(true),
child_thread_loop_(base::MessageLoopProxy::current()),
- web_scrollbar_behavior_(new WebScrollbarBehaviorImpl) {
+ web_scrollbar_behavior_(new WebScrollbarBehaviorImpl),
+ gamepad_provider_(NULL) {
if (g_sandbox_enabled && sandboxEnabled()) {
sandbox_support_.reset(
new RendererWebKitPlatformSupportImpl::SandboxSupport);
@@ -885,19 +883,14 @@ WebBlobRegistry* RendererWebKitPlatformSupportImpl::blobRegistry() {
//------------------------------------------------------------------------------
void RendererWebKitPlatformSupportImpl::sampleGamepads(WebGamepads& gamepads) {
- if (g_test_gamepads == 0) {
- RenderThreadImpl::current()->gamepad_shared_memory_reader()->
- SampleGamepads(gamepads);
- } else {
- gamepads = g_test_gamepads.Get();
- }
+ DCHECK(gamepad_provider_);
+ gamepad_provider_->SampleGamepads(gamepads);
}
void RendererWebKitPlatformSupportImpl::setGamepadListener(
blink::WebGamepadListener* listener) {
- web_gamepad_listener = listener;
- RenderThreadImpl::current()->gamepad_shared_memory_reader()->
- SetGamepadListener(listener);
+ DCHECK(gamepad_provider_);
+ gamepad_provider_->SetGamepadListener(listener);
}
//------------------------------------------------------------------------------
@@ -945,28 +938,6 @@ bool RendererWebKitPlatformSupportImpl::SetSandboxEnabledForTesting(
return was_enabled;
}
-// static
-void RendererWebKitPlatformSupportImpl::SetMockGamepadsForTesting(
- const WebGamepads& pads) {
- 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