summaryrefslogtreecommitdiffstats
path: root/content/public/android
diff options
context:
space:
mode:
authormvanouwerkerk@chromium.org <mvanouwerkerk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-19 22:20:04 +0000
committermvanouwerkerk@chromium.org <mvanouwerkerk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-19 22:20:04 +0000
commit16518f9ecbb5c03ce64e2a960e79f1e43e871488 (patch)
treed4efdb8a2a248c596c54a1405037bd6d699ca8fc /content/public/android
parent4646a753f201b0b31497996cd2109e941829f6db (diff)
downloadchromium_src-16518f9ecbb5c03ce64e2a960e79f1e43e871488.zip
chromium_src-16518f9ecbb5c03ce64e2a960e79f1e43e871488.tar.gz
chromium_src-16518f9ecbb5c03ce64e2a960e79f1e43e871488.tar.bz2
Vibration API: plumbing from Blink to Java.
Intent to implement & ship thread: https://groups.google.com/a/chromium.org/forum/#!searchin/blink-dev/vibration$20api/blink-dev/hH9bJGWKAbk/AFPov-g5VMMJ BUG=222504 Review URL: https://chromiumcodereview.appspot.com/16781002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212670 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/public/android')
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/VibrationMessageFilter.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/content/public/android/java/src/org/chromium/content/browser/VibrationMessageFilter.java b/content/public/android/java/src/org/chromium/content/browser/VibrationMessageFilter.java
new file mode 100644
index 0000000..0e04209
--- /dev/null
+++ b/content/public/android/java/src/org/chromium/content/browser/VibrationMessageFilter.java
@@ -0,0 +1,39 @@
+// Copyright 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;
+
+/**
+ * This is the implementation of the C++ counterpart VibrationMessageFilter.
+ */
+@JNINamespace("content")
+class VibrationMessageFilter {
+
+ private final Vibrator mVibrator;
+
+ @CalledByNative
+ private static VibrationMessageFilter create(Context context) {
+ return new VibrationMessageFilter(context);
+ }
+
+ @CalledByNative
+ private void vibrate(long milliseconds) {
+ mVibrator.vibrate(milliseconds);
+ }
+
+ @CalledByNative
+ private void cancelVibration() {
+ mVibrator.cancel();
+ }
+
+ private VibrationMessageFilter(Context context) {
+ mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
+ }
+}