OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 package org.chromium.content.browser; | |
6 | |
7 import android.content.Context; | |
8 import android.os.Vibrator; | |
9 | |
10 import org.chromium.base.CalledByNative; | |
11 import org.chromium.base.JNINamespace; | |
12 | |
13 @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.
| |
14 class VibrationService { | |
15 | |
16 private final Vibrator mVibrator; | |
17 | |
18 @CalledByNative | |
19 public static VibrationService create(Context context) { | |
20 return new VibrationService(context); | |
21 } | |
22 | |
23 @CalledByNative | |
24 public void vibrate(int milliseconds) { | |
25 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
| |
26 } | |
27 | |
28 @CalledByNative | |
29 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.
| |
30 mVibrator.cancel(); | |
31 } | |
32 | |
33 private VibrationService(Context context) { | |
34 mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE ); | |
35 } | |
36 } | |
OLD | NEW |