| Index: content/renderer/renderer_webkitplatformsupport_impl.cc
|
| diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc
|
| index cf00ab6b2ecaf174fe2bd9a88523aa0e70743ca8..777581c9bf6e4a9d50db97555f600a48fb3888fc 100644
|
| --- a/content/renderer/renderer_webkitplatformsupport_impl.cc
|
| +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc
|
| @@ -39,6 +39,7 @@
|
| #include "content/public/renderer/content_renderer_client.h"
|
| #include "content/renderer/battery_status/battery_status_dispatcher.h"
|
| #include "content/renderer/battery_status/fake_battery_status_dispatcher.h"
|
| +#include "content/renderer/device_sensors/device_light_event_pump.h"
|
| #include "content/renderer/device_sensors/device_motion_event_pump.h"
|
| #include "content/renderer/device_sensors/device_orientation_event_pump.h"
|
| #include "content/renderer/dom_storage/webstoragenamespace_impl.h"
|
| @@ -64,6 +65,7 @@
|
| #include "net/base/net_util.h"
|
| #include "third_party/WebKit/public/platform/WebBatteryStatusListener.h"
|
| #include "third_party/WebKit/public/platform/WebBlobRegistry.h"
|
| +#include "third_party/WebKit/public/platform/WebDeviceLightListener.h"
|
| #include "third_party/WebKit/public/platform/WebDeviceMotionListener.h"
|
| #include "third_party/WebKit/public/platform/WebDeviceOrientationListener.h"
|
| #include "third_party/WebKit/public/platform/WebFileInfo.h"
|
| @@ -140,7 +142,8 @@ namespace content {
|
|
|
| namespace {
|
|
|
| -static bool g_sandbox_enabled = true;
|
| +bool g_sandbox_enabled = true;
|
| +double g_test_device_light_data = -1;
|
| base::LazyInstance<blink::WebDeviceMotionData>::Leaky
|
| g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER;
|
| base::LazyInstance<blink::WebDeviceOrientationData>::Leaky
|
| @@ -1021,6 +1024,32 @@ blink::WebString RendererWebKitPlatformSupportImpl::convertIDNToUnicode(
|
|
|
| //------------------------------------------------------------------------------
|
|
|
| +void RendererWebKitPlatformSupportImpl::setDeviceLightListener(
|
| + blink::WebDeviceLightListener* listener) {
|
| + if (g_test_device_light_data < 0) {
|
| + if (!device_light_event_pump_) {
|
| + device_light_event_pump_.reset(new DeviceLightEventPump);
|
| + device_light_event_pump_->Attach(RenderThreadImpl::current());
|
| + }
|
| + device_light_event_pump_->SetListener(listener);
|
| + } else if (listener) {
|
| + // Testing mode: just echo the test data to the listener.
|
| + base::MessageLoopProxy::current()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&blink::WebDeviceLightListener::didChangeDeviceLight,
|
| + base::Unretained(listener),
|
| + g_test_device_light_data));
|
| + }
|
| +}
|
| +
|
| +// static
|
| +void RendererWebKitPlatformSupportImpl::SetMockDeviceLightDataForTesting(
|
| + double data) {
|
| + g_test_device_light_data = data;
|
| +}
|
| +
|
| +//------------------------------------------------------------------------------
|
| +
|
| void RendererWebKitPlatformSupportImpl::setDeviceMotionListener(
|
| blink::WebDeviceMotionListener* listener) {
|
| if (g_test_device_motion_data == 0) {
|
|
|