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

Side by Side Diff: Source/modules/vibration/Vibration.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: Delete unused code. 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/vibration/NavigatorVibration.idl ('k') | Source/modules/vibration/Vibration.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 Vibration_h 20 #ifndef Vibration_h
21 #define Vibration_h 21 #define Vibration_h
22 22
23 #if ENABLE(VIBRATION)
24
25 #include "core/page/Page.h" 23 #include "core/page/Page.h"
26 #include "core/platform/Timer.h" 24 #include "core/platform/Timer.h"
27 #include "wtf/PassOwnPtr.h" 25 #include "wtf/PassOwnPtr.h"
28 26
29 namespace WebCore { 27 namespace WebCore {
30 28
31 class VibrationClient;
32
33 class Vibration : public Supplement<Page> { 29 class Vibration : public Supplement<Page> {
34 public: 30 public:
35 typedef Vector<unsigned> VibrationPattern; 31 typedef Vector<unsigned> VibrationPattern;
36 32
37 explicit Vibration(VibrationClient*);
38 ~Vibration(); 33 ~Vibration();
39 34
40 static PassOwnPtr<Vibration> create(VibrationClient*);
41
42 void vibrate(const unsigned& time); 35 void vibrate(const unsigned& time);
43 void vibrate(const VibrationPattern&); 36 void vibrate(const VibrationPattern&);
44 void cancelVibration(); 37 void cancelVibration();
45 38
46 // FIXME : Add suspendVibration() and resumeVibration() to the page visibili ty feature, when the document.hidden attribute is changed. 39 // FIXME : Add suspendVibration() and resumeVibration() to the page visibili ty feature, when the document.hidden attribute is changed.
47 void suspendVibration(); 40 void suspendVibration();
48 void resumeVibration(); 41 void resumeVibration();
49 void timerStartFired(Timer<Vibration>*); 42 void timerStartFired(Timer<Vibration>*);
50 void timerStopFired(Timer<Vibration>*); 43 void timerStopFired(Timer<Vibration>*);
51 44
52 static const char* supplementName(); 45 static const char* supplementName();
53 static Vibration* from(Page* page) { return static_cast<Vibration*>(Suppleme nt<Page>::from(page, supplementName())); } 46 static Vibration* from(Page*);
54 static bool isActive(Page*); 47 static bool isActive(Page*);
Peter Beverloo 2013/06/11 14:30:36 Sorry, two more nits I missed earlier on. isActiv
Michael van Ouwerkerk 2013/06/11 14:58:56 Done.
55 48
56 private: 49 private:
57 VibrationClient* m_vibrationClient; 50 Vibration();
51
58 Timer<Vibration> m_timerStart; 52 Timer<Vibration> m_timerStart;
59 Timer<Vibration> m_timerStop; 53 Timer<Vibration> m_timerStop;
60 bool m_isVibrating; 54 bool m_isVibrating;
61 VibrationPattern m_pattern; 55 VibrationPattern m_pattern;
62 }; 56 };
63 57
64 } // namespace WebCore 58 } // namespace WebCore
65 59
66 #endif // ENABLE(VIBRATION)
67
68 #endif // Vibration_h 60 #endif // Vibration_h
69
OLDNEW
« no previous file with comments | « Source/modules/vibration/NavigatorVibration.idl ('k') | Source/modules/vibration/Vibration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698