OLD | NEW |
---|---|
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> { |
abarth-chromium
2013/06/11 23:57:31
What's the point of having a separate Vibration pa
Michael van Ouwerkerk
2013/06/12 16:44:50
You're right, so: done! I was trying to keep this
| |
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 Vibration* from(Page*); |
53 static Vibration* from(Page* page) { return static_cast<Vibration*>(Suppleme nt<Page>::from(page, supplementName())); } | |
54 static bool isActive(Page*); | |
55 | 46 |
56 private: | 47 private: |
57 VibrationClient* m_vibrationClient; | 48 Vibration(); |
49 static const char* supplementName(); | |
50 | |
58 Timer<Vibration> m_timerStart; | 51 Timer<Vibration> m_timerStart; |
59 Timer<Vibration> m_timerStop; | 52 Timer<Vibration> m_timerStop; |
60 bool m_isVibrating; | 53 bool m_isVibrating; |
61 VibrationPattern m_pattern; | 54 VibrationPattern m_pattern; |
62 }; | 55 }; |
63 | 56 |
64 } // namespace WebCore | 57 } // namespace WebCore |
65 | 58 |
66 #endif // ENABLE(VIBRATION) | |
67 | |
68 #endif // Vibration_h | 59 #endif // Vibration_h |
69 | |
OLD | NEW |