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..9e4d6c1113e265184d4967f8c3f88a02b217eeee |
| --- /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") |
|
bulach
2013/06/20 14:21:04
nit:
/**
* This is the implementation of the C++
Michael van Ouwerkerk
2013/06/20 17:34:09
Done.
|
| +class VibrationService { |
| + |
| + private final Vibrator mVibrator; |
| + |
| + @CalledByNative |
| + public static VibrationService create(Context context) { |
| + return new VibrationService(context); |
| + } |
| + |
| + @CalledByNative |
| + public void vibrate(int milliseconds) { |
| + mVibrator.vibrate(milliseconds); |
|
bulach
2013/06/20 14:21:04
should we have some kind of throttling at this lev
Michael van Ouwerkerk
2013/06/20 17:34:09
It's a bit tricky, because there is a valid use ca
|
| + } |
| + |
| + @CalledByNative |
| + public void cancelVibration() { |
|
bulach
2013/06/20 14:21:04
nit: make these whole lot private.. we tend to use
Michael van Ouwerkerk
2013/06/20 17:34:09
Done.
|
| + mVibrator.cancel(); |
| + } |
| + |
| + private VibrationService(Context context) { |
| + mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); |
| + } |
| +} |