Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1431)

Unified Diff: content/browser/vibration/vibration_message_filter.cc

Issue 583663003: Vibration API : migrate to device/vibration using mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove debug logging Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/vibration/vibration_message_filter.cc
diff --git a/content/browser/vibration/vibration_message_filter.cc b/content/browser/vibration/vibration_message_filter.cc
deleted file mode 100644
index fbc9041c71f883bd73a7c438d0fc4a68c5bfc22a..0000000000000000000000000000000000000000
--- a/content/browser/vibration/vibration_message_filter.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// 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_message_filter.h"
-
-#include <algorithm>
-
-#include "base/numerics/safe_conversions.h"
-#include "content/common/view_messages.h"
-#include "content/public/browser/content_browser_client.h"
-#include "content/public/browser/vibration_provider.h"
-#include "content/public/common/content_client.h"
-#include "third_party/WebKit/public/platform/WebVibration.h"
-
-namespace content {
-
-// Minimum duration of a vibration is 1 millisecond.
-const int64 kMinimumVibrationDurationMs = 1;
-
-VibrationMessageFilter::VibrationMessageFilter()
- : BrowserMessageFilter(ViewMsgStart) {
- provider_.reset(GetContentClient()->browser()->OverrideVibrationProvider());
- if (!provider_.get())
- provider_.reset(CreateProvider());
-}
-
-VibrationMessageFilter::~VibrationMessageFilter() {
-}
-
-bool VibrationMessageFilter::OnMessageReceived(
- const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(VibrationMessageFilter, message)
- IPC_MESSAGE_HANDLER(ViewHostMsg_Vibrate, OnVibrate)
- IPC_MESSAGE_HANDLER(ViewHostMsg_CancelVibration, OnCancelVibration)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
-void VibrationMessageFilter::OnVibrate(int64 milliseconds) {
- if (!provider_.get())
- return;
-
- // Though the Blink implementation already sanitizes vibration times, don't
- // trust any values passed from the renderer.
- milliseconds = std::max(kMinimumVibrationDurationMs, std::min(milliseconds,
- base::checked_cast<int64>(blink::kVibrationDurationMax)));
-
- provider_->Vibrate(milliseconds);
-}
-
-void VibrationMessageFilter::OnCancelVibration() {
- if (!provider_.get())
- return;
-
- provider_->CancelVibration();
-}
-
-#if !defined(OS_ANDROID)
-// static
-VibrationProvider* VibrationMessageFilter::CreateProvider() {
- return NULL;
-}
-#endif
-} // namespace content

Powered by Google App Engine
This is Rietveld 408576698