| Index: content/browser/android/vibration_message_filter_android.cc
|
| diff --git a/content/browser/android/vibration_message_filter.cc b/content/browser/android/vibration_message_filter_android.cc
|
| similarity index 64%
|
| rename from content/browser/android/vibration_message_filter.cc
|
| rename to content/browser/android/vibration_message_filter_android.cc
|
| index 578fbfdf6e9d9083bde285ca2b4911ed6118fc08..469e06a5ad0a2eb595bbd67c9a85e94a71a66a44 100644
|
| --- a/content/browser/android/vibration_message_filter.cc
|
| +++ b/content/browser/android/vibration_message_filter_android.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "content/browser/android/vibration_message_filter.h"
|
| +#include "content/browser/android/vibration_message_filter_android.h"
|
|
|
| #include <algorithm>
|
|
|
| @@ -18,32 +18,18 @@ namespace content {
|
| // Minimum duration of a vibration is 1 millisecond.
|
| const int64 kMinimumVibrationDurationMs = 1;
|
|
|
| -VibrationMessageFilter::VibrationMessageFilter() {
|
| +VibrationMessageFilterAndroid::VibrationMessageFilterAndroid() {
|
| }
|
|
|
| -VibrationMessageFilter::~VibrationMessageFilter() {
|
| +VibrationMessageFilterAndroid::~VibrationMessageFilterAndroid() {
|
| }
|
|
|
| // static
|
| -bool VibrationMessageFilter::Register(JNIEnv* env) {
|
| +bool VibrationMessageFilterAndroid::Register(JNIEnv* env) {
|
| return RegisterNativesImpl(env);
|
| }
|
|
|
| -bool VibrationMessageFilter::OnMessageReceived(
|
| - const IPC::Message& message,
|
| - bool* message_was_ok) {
|
| - bool handled = true;
|
| - IPC_BEGIN_MESSAGE_MAP_EX(VibrationMessageFilter,
|
| - message,
|
| - *message_was_ok)
|
| - IPC_MESSAGE_HANDLER(ViewHostMsg_Vibrate, OnVibrate)
|
| - IPC_MESSAGE_HANDLER(ViewHostMsg_CancelVibration, OnCancelVibration)
|
| - IPC_MESSAGE_UNHANDLED(handled = false)
|
| - IPC_END_MESSAGE_MAP_EX()
|
| - return handled;
|
| -}
|
| -
|
| -void VibrationMessageFilter::OnVibrate(int64 milliseconds) {
|
| +void VibrationMessageFilterAndroid::OnVibrate(int64 milliseconds) {
|
| // Though the Blink implementation already sanitizes vibration times, don't
|
| // trust any values passed from the renderer.
|
| milliseconds = std::max(kMinimumVibrationDurationMs,
|
| @@ -61,9 +47,17 @@ void VibrationMessageFilter::OnVibrate(int64 milliseconds) {
|
| milliseconds);
|
| }
|
|
|
| -void VibrationMessageFilter::OnCancelVibration() {
|
| +void VibrationMessageFilterAndroid::OnCancelVibration() {
|
| Java_VibrationMessageFilter_cancelVibration(AttachCurrentThread(),
|
| j_vibration_message_filter_.obj());
|
| }
|
|
|
| +// static
|
| +VibrationMessageFilter* VibrationMessageFilter::Create() {
|
| + if (factory_)
|
| + return factory_();
|
| +
|
| + return new VibrationMessageFilterAndroid();
|
| +}
|
| +
|
| } // namespace content
|
|
|