Chromium Code Reviews| 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..4c77f04244cb5aeede37fd3d8b2646d3ef59ee34 |
| --- /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; |
| + |
| +/** |
| + * This is the implementation of the C++ counterpart VibrationService. |
| + */ |
| +@JNINamespace("content") |
| +class VibrationService { |
| + |
| + private final Vibrator mVibrator; |
| + |
| + @CalledByNative |
| + private static VibrationService create(Context context) { |
| + return new VibrationService(context); |
| + } |
| + |
| + @CalledByNative |
| + private void vibrate(long milliseconds) { |
|
palmer
2013/06/21 18:17:40
The IPC sends unsigned int, but Java long is defin
Michael van Ouwerkerk
2013/06/24 13:46:57
So, I chose an int :-)
On 2013/06/21 18:17:40, Ch
|
| + mVibrator.vibrate(milliseconds); |
| + } |
| + |
| + @CalledByNative |
| + private void cancelVibration() { |
| + mVibrator.cancel(); |
| + } |
| + |
| + private VibrationService(Context context) { |
| + mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); |
| + } |
| +} |