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

Unified Diff: content/browser/vibration/vibration_service_impl_android.cc

Issue 16781002: Vibration API: plumbing from Blink to Java. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 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/browser/vibration/vibration_service_impl_android.cc
diff --git a/content/browser/vibration/vibration_service_impl_android.cc b/content/browser/vibration/vibration_service_impl_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fdf2f5fe1861f3222bf4f63d3cdf192219265ded
--- /dev/null
+++ b/content/browser/vibration/vibration_service_impl_android.cc
@@ -0,0 +1,38 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/vibration/vibration_service_impl_android.h"
+
+#include "jni/VibrationService_jni.h"
+
+using base::android::AttachCurrentThread;
+
+namespace content {
+
+VibrationServiceImplAndroid::VibrationServiceImplAndroid() {
+ j_vibration_service_.Reset(
bulach 2013/06/20 14:21:04 nit: unindent
Michael van Ouwerkerk 2013/06/20 17:34:09 Done.
+ Java_VibrationService_create(
+ AttachCurrentThread(),
+ base::android::GetApplicationContext()));
+}
+
+VibrationServiceImplAndroid::~VibrationServiceImplAndroid() {
+}
+
+void VibrationServiceImplAndroid::Vibrate(unsigned milliseconds) {
+ Java_VibrationService_vibrate(AttachCurrentThread(),
+ j_vibration_service_.obj(),
+ milliseconds);
+}
+
+void VibrationServiceImplAndroid::CancelVibration() {
+ Java_VibrationService_cancelVibration(AttachCurrentThread(),
+ j_vibration_service_.obj());
+}
+
+bool RegisterVibrationService(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698