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 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #define NavigatorVibration_h | 21 #define NavigatorVibration_h |
22 | 22 |
23 #include "core/page/Page.h" | 23 #include "core/page/Page.h" |
24 #include "core/page/PageLifecycleObserver.h" | 24 #include "core/page/PageLifecycleObserver.h" |
25 #include "core/platform/Timer.h" | 25 #include "core/platform/Timer.h" |
26 #include "wtf/PassOwnPtr.h" | 26 #include "wtf/PassOwnPtr.h" |
27 #include "wtf/Vector.h" | 27 #include "wtf/Vector.h" |
28 | 28 |
29 namespace WebCore { | 29 namespace WebCore { |
30 | 30 |
| 31 class Frame; |
31 class Navigator; | 32 class Navigator; |
32 | 33 |
33 class NavigatorVibration | 34 class NavigatorVibration |
34 : public Supplement<Page> | 35 : public Supplement<Page> |
35 , public PageLifecycleObserver { | 36 , public PageLifecycleObserver { |
36 public: | 37 public: |
37 typedef Vector<unsigned> VibrationPattern; | 38 typedef Vector<unsigned> VibrationPattern; |
38 | 39 |
39 virtual ~NavigatorVibration(); | 40 virtual ~NavigatorVibration(); |
40 | 41 |
41 bool vibrate(const VibrationPattern&); | 42 bool vibrate(const VibrationPattern&); |
42 void cancelVibration(); | 43 void cancelVibration(); |
43 void timerStartFired(Timer<NavigatorVibration>*); | 44 void timerStartFired(Timer<NavigatorVibration>*); |
44 void timerStopFired(Timer<NavigatorVibration>*); | 45 void timerStopFired(Timer<NavigatorVibration>*); |
45 | 46 |
46 // Inherited from PageLifecycleObserver | 47 // Inherited from PageLifecycleObserver |
47 virtual void pageVisibilityChanged() OVERRIDE; | 48 virtual void pageVisibilityChanged() OVERRIDE; |
| 49 virtual void didCommitLoad(Frame*) OVERRIDE; |
48 | 50 |
49 static bool vibrate(Navigator*, unsigned time); | 51 static bool vibrate(Navigator*, unsigned time); |
50 static bool vibrate(Navigator*, const VibrationPattern&); | 52 static bool vibrate(Navigator*, const VibrationPattern&); |
51 static NavigatorVibration* from(Page*); | 53 static NavigatorVibration* from(Page*); |
52 | 54 |
53 private: | 55 private: |
54 explicit NavigatorVibration(Page*); | 56 explicit NavigatorVibration(Page*); |
55 static const char* supplementName(); | 57 static const char* supplementName(); |
56 | 58 |
57 Timer<NavigatorVibration> m_timerStart; | 59 Timer<NavigatorVibration> m_timerStart; |
58 Timer<NavigatorVibration> m_timerStop; | 60 Timer<NavigatorVibration> m_timerStop; |
59 bool m_isVibrating; | 61 bool m_isVibrating; |
60 VibrationPattern m_pattern; | 62 VibrationPattern m_pattern; |
61 }; | 63 }; |
62 | 64 |
63 } // namespace WebCore | 65 } // namespace WebCore |
64 | 66 |
65 #endif // NavigatorVibration_h | 67 #endif // NavigatorVibration_h |
OLD | NEW |