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

Side by Side Diff: content/browser/vibration_message_filter.cc

Issue 23496051: Make VibrationMessageFilter available to other platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 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 #include "content/browser/vibration_message_filter.h"
6
7 #include <algorithm>
8
9 #include "base/safe_numerics.h"
10 #include "content/common/view_messages.h"
11 #include "third_party/WebKit/public/platform/WebVibration.h"
12
13 namespace content {
14
15 VibrationMessageFilter::VibrationMessageFilterFactory* VibrationMessageFilter::f actory_ = 0;
Avi (use Gerrit) 2013/09/12 05:05:58 80 columns! And NULL, not 0.
16
17 // Minimum duration of a vibration is 1 millisecond.
18 const int64 kMinimumVibrationDurationMs = 1;
19
20 VibrationMessageFilter::VibrationMessageFilter() {
21 }
22
23 VibrationMessageFilter::~VibrationMessageFilter() {
24 }
25
26 bool VibrationMessageFilter::OnMessageReceived(
27 const IPC::Message& message,
28 bool* message_was_ok) {
29 bool handled = true;
30 IPC_BEGIN_MESSAGE_MAP_EX(VibrationMessageFilter,
31 message,
32 *message_was_ok)
33 IPC_MESSAGE_HANDLER(ViewHostMsg_Vibrate, OnVibrate)
34 IPC_MESSAGE_HANDLER(ViewHostMsg_CancelVibration, OnCancelVibration)
35 IPC_MESSAGE_UNHANDLED(handled = false)
36 IPC_END_MESSAGE_MAP_EX()
37 return handled;
38 }
39
40 #if !defined(OS_ANDROID)
41 // static
42 VibrationMessageFilter* VibrationMessageFilter::Create() {
43 if (factory_)
44 return factory_();
45
46 return 0;
47 }
48 #endif
49
50 // static
51 void VibrationMessageFilter::SetVibrationMessageFilterFactory(
52 VibrationMessageFilter::VibrationMessageFilterFactory* factory) {
53 factory_ = factory;
54 }
55
56 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698