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

Side by Side Diff: Source/modules/vibration/NavigatorVibration.h

Issue 15724023: Vibration API: use runtime flag, change from client to platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 7 years, 6 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
« no previous file with comments | « Source/modules/modules.gypi ('k') | Source/modules/vibration/NavigatorVibration.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef NavigatorVibration_h 20 #ifndef NavigatorVibration_h
21 #define NavigatorVibration_h 21 #define NavigatorVibration_h
22 22
23 #if ENABLE(VIBRATION) 23 #include "core/page/Navigator.h"
24 24 #include "core/platform/Timer.h"
25 #include "core/dom/ExceptionCode.h" 25 #include "wtf/PassOwnPtr.h"
26 #include "wtf/Vector.h" 26 #include "wtf/Vector.h"
27 27
28 namespace WebCore { 28 namespace WebCore {
29 29
30 class Navigator; 30 class NavigatorVibration : public Supplement<Navigator> {
31 class Uint32Array;
32
33 class NavigatorVibration {
34 public: 31 public:
35 typedef Vector<unsigned> VibrationPattern; 32 typedef Vector<unsigned> VibrationPattern;
36 33
37 static void vibrate(Navigator*, unsigned time, ExceptionCode&); 34 ~NavigatorVibration();
38 static void vibrate(Navigator*, const VibrationPattern&, ExceptionCode&); 35
36 bool vibrate(const VibrationPattern&);
37 void cancelVibration();
38 // FIXME : Hook suspendVibration() and resumeVibration() into the page
39 // visibility feature, when the document.hidden attribute is changed.
40 void suspendVibration();
41 void resumeVibration();
42 void timerStartFired(Timer<NavigatorVibration>*);
43 void timerStopFired(Timer<NavigatorVibration>*);
44
45 static bool vibrate(Navigator*, unsigned time);
46 static bool vibrate(Navigator*, const VibrationPattern&);
47 static NavigatorVibration* from(Navigator*);
39 48
40 private: 49 private:
41 NavigatorVibration(); 50 NavigatorVibration();
42 ~NavigatorVibration(); 51 static const char* supplementName();
52
53 Timer<NavigatorVibration> m_timerStart;
54 Timer<NavigatorVibration> m_timerStop;
55 bool m_isVibrating;
56 VibrationPattern m_pattern;
43 }; 57 };
44 58
45 } // namespace WebCore 59 } // namespace WebCore
46 60
47 #endif // ENABLE(VIBRATION)
48
49 #endif // NavigatorVibration_h 61 #endif // NavigatorVibration_h
50
OLDNEW
« no previous file with comments | « Source/modules/modules.gypi ('k') | Source/modules/vibration/NavigatorVibration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698