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

Unified Diff: content/renderer/renderer_webkitplatformsupport_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: remove debug logging Created 6 years, 3 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 850166d7663cb5613989f4815c289979a8a2334f..193e33d430c8cb7234823e16cdd46e07c6885869 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"
@@ -1036,12 +1037,16 @@ void RendererWebKitPlatformSupportImpl::SetMockDeviceOrientationDataForTesting(
//------------------------------------------------------------------------------
void RendererWebKitPlatformSupportImpl::vibrate(unsigned int milliseconds) {
- RenderThread::Get()->Send(
- new ViewHostMsg_Vibrate(base::checked_cast<int64>(milliseconds)));
+ if (!vibration_manager_) {
+ RenderThread::Get()->GetServiceRegistry()
+ ->ConnectToRemoteService(&vibration_manager_);
+ }
+ vibration_manager_->Vibrate(milliseconds);
Michael van Ouwerkerk 2014/09/29 12:55:19 Why did you omit the cast?
timvolodine 2014/10/03 15:57:14 I've put it back. Done.
}
void RendererWebKitPlatformSupportImpl::cancelVibration() {
- RenderThread::Get()->Send(new ViewHostMsg_CancelVibration());
+ if (vibration_manager_)
Michael van Ouwerkerk 2014/09/29 12:55:19 Why isn't one instantiated when needed? A vibratio
timvolodine 2014/10/03 15:57:14 good point. Done.
+ vibration_manager_->Cancel();
}
//------------------------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698