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..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); |
| + } |
| +} |