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..eea81bd52c3a6a0421efd84d1f458317b443f097 |
| --- /dev/null |
| +++ b/content/public/android/java/src/org/chromium/content/browser/VibrationService.java |
| @@ -0,0 +1,36 @@ |
| +// 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") |
| +class VibrationService { |
| + |
| + private Vibrator mVibrator; |
|
Peter Beverloo
2013/06/13 11:27:45
This can be final.
Michael van Ouwerkerk
2013/06/18 14:39:23
Done.
|
| + |
| + @CalledByNative |
| + public static VibrationService create(Context context) { |
| + return new VibrationService(context); |
| + } |
| + |
| + @CalledByNative |
| + public void vibrate(int time) { |
| + mVibrator.vibrate(time); |
| + } |
| + |
| + @CalledByNative |
| + public void cancelVibration() { |
| + mVibrator.cancel(); |
| + } |
| + |
| + private VibrationService(Context context) { |
| + mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); |
| + } |
| +} |