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

Side by Side Diff: third_party/WebKit/Source/modules/vibration/VibrationController.cpp

Issue 2196843003: Blink ServiceRegistry -> InterfaceProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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
1 /* 1 /*
2 * Copyright (C) 2012 Samsung Electronics 2 * Copyright (C) 2012 Samsung Electronics
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 */ 18 */
19 19
20 #include "modules/vibration/VibrationController.h" 20 #include "modules/vibration/VibrationController.h"
21 21
22 #include "bindings/modules/v8/UnsignedLongOrUnsignedLongSequence.h" 22 #include "bindings/modules/v8/UnsignedLongOrUnsignedLongSequence.h"
23 #include "core/dom/Document.h" 23 #include "core/dom/Document.h"
24 #include "core/frame/Navigator.h" 24 #include "core/frame/Navigator.h"
25 #include "core/frame/UseCounter.h" 25 #include "core/frame/UseCounter.h"
26 #include "core/page/Page.h" 26 #include "core/page/Page.h"
27 #include "platform/mojo/MojoHelper.h" 27 #include "platform/mojo/MojoHelper.h"
28 #include "public/platform/ServiceRegistry.h" 28 #include "public/platform/InterfaceProvider.h"
29 29
30 // Maximum number of entries in a vibration pattern. 30 // Maximum number of entries in a vibration pattern.
31 const unsigned kVibrationPatternLengthMax = 99; 31 const unsigned kVibrationPatternLengthMax = 99;
32 32
33 // Maximum duration of a vibration is 10 seconds. 33 // Maximum duration of a vibration is 10 seconds.
34 const unsigned kVibrationDurationMsMax = 10000; 34 const unsigned kVibrationDurationMsMax = 10000;
35 35
36 blink::VibrationController::VibrationPattern sanitizeVibrationPatternInternal(co nst blink::VibrationController::VibrationPattern& pattern) 36 blink::VibrationController::VibrationPattern sanitizeVibrationPatternInternal(co nst blink::VibrationController::VibrationPattern& pattern)
37 { 37 {
38 blink::VibrationController::VibrationPattern sanitized = pattern; 38 blink::VibrationController::VibrationPattern sanitized = pattern;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 74
75 VibrationController::VibrationController(Document& document) 75 VibrationController::VibrationController(Document& document)
76 : ContextLifecycleObserver(&document) 76 : ContextLifecycleObserver(&document)
77 , PageVisibilityObserver(document.page()) 77 , PageVisibilityObserver(document.page())
78 , m_timerDoVibrate(this, &VibrationController::doVibrate) 78 , m_timerDoVibrate(this, &VibrationController::doVibrate)
79 , m_isRunning(false) 79 , m_isRunning(false)
80 , m_isCallingCancel(false) 80 , m_isCallingCancel(false)
81 , m_isCallingVibrate(false) 81 , m_isCallingVibrate(false)
82 { 82 {
83 document.frame()->serviceRegistry()->connectToRemoteService(mojo::GetProxy(& m_service)); 83 document.frame()->interfaceProvider()->getInterface(mojo::GetProxy(&m_servic e));
84 } 84 }
85 85
86 VibrationController::~VibrationController() 86 VibrationController::~VibrationController()
87 { 87 {
88 } 88 }
89 89
90 bool VibrationController::vibrate(const VibrationPattern& pattern) 90 bool VibrationController::vibrate(const VibrationPattern& pattern)
91 { 91 {
92 // Cancel clears the stored pattern and cancels any ongoing vibration. 92 // Cancel clears the stored pattern and cancels any ongoing vibration.
93 cancel(); 93 cancel();
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 cancel(); 197 cancel();
198 } 198 }
199 199
200 DEFINE_TRACE(VibrationController) 200 DEFINE_TRACE(VibrationController)
201 { 201 {
202 ContextLifecycleObserver::trace(visitor); 202 ContextLifecycleObserver::trace(visitor);
203 PageVisibilityObserver::trace(visitor); 203 PageVisibilityObserver::trace(visitor);
204 } 204 }
205 205
206 } // namespace blink 206 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698