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

Unified Diff: content/renderer/renderer_blink_platform_impl.cc

Issue 583663003: Vibration API : migrate to device/vibration using mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hide default service implementation, fix android_aosp Created 6 years 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 | « content/renderer/renderer_blink_platform_impl.h ('k') | device/vibration/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/renderer_blink_platform_impl.cc
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
index c247612a17c764283b9b8ce3f3bd772bbdf72a88..9b5d79121e925bd0e21584aeeb210ec30418bee5 100644
--- a/content/renderer/renderer_blink_platform_impl.cc
+++ b/content/renderer/renderer_blink_platform_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"
@@ -1054,12 +1055,21 @@ void RendererBlinkPlatformImpl::SetMockDeviceOrientationDataForTesting(
//------------------------------------------------------------------------------
void RendererBlinkPlatformImpl::vibrate(unsigned int milliseconds) {
- RenderThread::Get()->Send(
- new ViewHostMsg_Vibrate(base::checked_cast<int64>(milliseconds)));
+ GetConnectedVibrationManagerService()->Vibrate(
+ base::checked_cast<int64>(milliseconds));
}
void RendererBlinkPlatformImpl::cancelVibration() {
- RenderThread::Get()->Send(new ViewHostMsg_CancelVibration());
+ GetConnectedVibrationManagerService()->Cancel();
+}
+
+device::VibrationManagerPtr&
+RendererBlinkPlatformImpl::GetConnectedVibrationManagerService() {
+ if (!vibration_manager_) {
+ RenderThread::Get()->GetServiceRegistry()
+ ->ConnectToRemoteService(&vibration_manager_);
+ }
+ return vibration_manager_;
}
//------------------------------------------------------------------------------
« no previous file with comments | « content/renderer/renderer_blink_platform_impl.h ('k') | device/vibration/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698