| Index: content/browser/vibration/vibration_provider_android.cc
|
| diff --git a/content/browser/vibration/vibration_provider_android.cc b/content/browser/vibration/vibration_provider_android.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ca06ed4253dddae3df784d2259e4d68f992a3ae2
|
| --- /dev/null
|
| +++ b/content/browser/vibration/vibration_provider_android.cc
|
| @@ -0,0 +1,46 @@
|
| +// Copyright 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.
|
| +
|
| +#include "content/browser/vibration/vibration_provider_android.h"
|
| +
|
| +#include <algorithm>
|
| +
|
| +#include "base/safe_numerics.h"
|
| +#include "content/common/view_messages.h"
|
| +#include "jni/VibrationProvider_jni.h"
|
| +#include "third_party/WebKit/public/platform/WebVibration.h"
|
| +
|
| +using base::android::AttachCurrentThread;
|
| +
|
| +namespace content {
|
| +
|
| +VibrationProviderAndroid::VibrationProviderAndroid() {
|
| +}
|
| +
|
| +VibrationProviderAndroid::~VibrationProviderAndroid() {
|
| +}
|
| +
|
| +// static
|
| +bool VibrationProviderAndroid::Register(JNIEnv* env) {
|
| + return RegisterNativesImpl(env);
|
| +}
|
| +
|
| +void VibrationProviderAndroid::OnVibrate(int64 milliseconds) {
|
| + if (j_vibration_provider_.is_null()) {
|
| + j_vibration_provider_.Reset(
|
| + Java_VibrationProvider_create(
|
| + AttachCurrentThread(),
|
| + base::android::GetApplicationContext()));
|
| + }
|
| + Java_VibrationProvider_vibrate(AttachCurrentThread(),
|
| + j_vibration_provider_.obj(),
|
| + milliseconds);
|
| +}
|
| +
|
| +void VibrationProviderAndroid::OnCancelVibration() {
|
| + Java_VibrationProvider_cancelVibration(AttachCurrentThread(),
|
| + j_vibration_provider_.obj());
|
| +}
|
| +
|
| +} // namespace content
|
|
|