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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/VibrationService.java

Issue 16781002: Vibration API: plumbing from Blink to Java. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use 'unsigned int' everywhere. 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/public/android/java/src/org/chromium/content/browser/VibrationService.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/VibrationService.java b/content/public/android/java/src/org/chromium/content/browser/VibrationService.java
new file mode 100644
index 0000000000000000000000000000000000000000..d493109e7033370664834050434edc5b3c3fec4d
--- /dev/null
+++ b/content/public/android/java/src/org/chromium/content/browser/VibrationService.java
@@ -0,0 +1,39 @@
+// 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.
+
+package org.chromium.content.browser;
+
+import android.content.Context;
+import android.os.Vibrator;
+
+import org.chromium.base.CalledByNative;
+import org.chromium.base.JNINamespace;
+
+@JNINamespace("content")
bulach 2013/06/21 12:55:54 nit: move this right above the class, after the co
Michael van Ouwerkerk 2013/06/21 15:07:41 Done.
+/**
+ * This is the implementation of the C++ counterpart VibrationService.
+ */
+class VibrationService {
+
+ private final Vibrator mVibrator;
+
+ @CalledByNative
+ private static VibrationService create(Context context) {
+ return new VibrationService(context);
+ }
+
+ @CalledByNative
+ private void vibrate(long milliseconds) {
+ mVibrator.vibrate(milliseconds);
+ }
+
+ @CalledByNative
+ private void cancelVibration() {
+ mVibrator.cancel();
+ }
+
+ private VibrationService(Context context) {
+ mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698