Index: content/renderer/renderer_webkitplatformsupport_impl.cc |
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc |
index d2c087c7c5f2dcb3e317a4c109a5353d965e7d24..70ed0585deb8be9deaaafdfc07221fc10e9d925a 100644 |
--- a/content/renderer/renderer_webkitplatformsupport_impl.cc |
+++ b/content/renderer/renderer_webkitplatformsupport_impl.cc |
@@ -35,6 +35,7 @@ |
#include "content/common/mime_registry_messages.h" |
#include "content/common/view_messages.h" |
#include "content/public/common/content_switches.h" |
+#include "content/public/common/service_registry.h" |
#include "content/public/common/webplugininfo.h" |
#include "content/public/renderer/content_renderer_client.h" |
#include "content/renderer/battery_status/battery_status_dispatcher.h" |
@@ -1041,12 +1042,21 @@ void RendererWebKitPlatformSupportImpl::SetMockDeviceOrientationDataForTesting( |
//------------------------------------------------------------------------------ |
void RendererWebKitPlatformSupportImpl::vibrate(unsigned int milliseconds) { |
- RenderThread::Get()->Send( |
- new ViewHostMsg_Vibrate(base::checked_cast<int64>(milliseconds))); |
+ GetConnectedVibrationManagerService()->Vibrate( |
+ base::checked_cast<int64>(milliseconds)); |
} |
void RendererWebKitPlatformSupportImpl::cancelVibration() { |
- RenderThread::Get()->Send(new ViewHostMsg_CancelVibration()); |
+ GetConnectedVibrationManagerService()->Cancel(); |
+} |
+ |
+device::VibrationManagerPtr& |
+RendererWebKitPlatformSupportImpl::GetConnectedVibrationManagerService() { |
+ if (!vibration_manager_) { |
+ RenderThread::Get()->GetServiceRegistry() |
+ ->ConnectToRemoteService(&vibration_manager_); |
+ } |
+ return vibration_manager_; |
} |
//------------------------------------------------------------------------------ |