| Index: content/browser/vibration/vibration_service_impl_android.cc
|
| diff --git a/content/browser/vibration/vibration_service_impl_android.cc b/content/browser/vibration/vibration_service_impl_android.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..eb46a7ea3dbe107519fd1ee3f91e0bf82d3bce9d
|
| --- /dev/null
|
| +++ b/content/browser/vibration/vibration_service_impl_android.cc
|
| @@ -0,0 +1,45 @@
|
| +// 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.
|
| +
|
| +#include "content/browser/vibration/vibration_service_impl_android.h"
|
| +
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "jni/VibrationService_jni.h"
|
| +
|
| +using base::android::AttachCurrentThread;
|
| +
|
| +namespace content {
|
| +
|
| +// static
|
| +scoped_ptr<VibrationService> VibrationService::Create() {
|
| + return scoped_ptr<VibrationService>(new VibrationServiceImplAndroid());
|
| +}
|
| +
|
| +// static
|
| +bool VibrationServiceImplAndroid::Register(JNIEnv* env) {
|
| + return RegisterNativesImpl(env);
|
| +}
|
| +
|
| +VibrationServiceImplAndroid::VibrationServiceImplAndroid() {
|
| + j_vibration_service_.Reset(
|
| + Java_VibrationService_create(
|
| + AttachCurrentThread(),
|
| + base::android::GetApplicationContext()));
|
| +}
|
| +
|
| +VibrationServiceImplAndroid::~VibrationServiceImplAndroid() {
|
| +}
|
| +
|
| +void VibrationServiceImplAndroid::Vibrate(int64 milliseconds) {
|
| + Java_VibrationService_vibrate(AttachCurrentThread(),
|
| + j_vibration_service_.obj(),
|
| + milliseconds);
|
| +}
|
| +
|
| +void VibrationServiceImplAndroid::CancelVibration() {
|
| + Java_VibrationService_cancelVibration(AttachCurrentThread(),
|
| + j_vibration_service_.obj());
|
| +}
|
| +
|
| +} // namespace content
|
|
|