| 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 15 matching lines...) Expand all Loading... |
| 26 #include "platform/heap/GarbageCollected.h" | 26 #include "platform/heap/GarbageCollected.h" |
| 27 #include "platform/heap/Handle.h" | 27 #include "platform/heap/Handle.h" |
| 28 #include "wtf/Noncopyable.h" | 28 #include "wtf/Noncopyable.h" |
| 29 #include "wtf/Vector.h" | 29 #include "wtf/Vector.h" |
| 30 | 30 |
| 31 namespace blink { | 31 namespace blink { |
| 32 | 32 |
| 33 class Navigator; | 33 class Navigator; |
| 34 class VibrationController; | 34 class VibrationController; |
| 35 | 35 |
| 36 enum NavigatorVibrationType { |
| 37 MainFrameNoUserGesture = 0, |
| 38 MainFrameWithUserGesture = 1, |
| 39 SameOriginSubFrameNoUserGesture = 2, |
| 40 SameOriginSubFrameWithUserGesture = 3, |
| 41 CrossOriginSubFrameNoUserGesture = 4, |
| 42 CrossOriginSubFrameWithUserGesture = 5, |
| 43 EnumMax = 6 |
| 44 }; |
| 45 |
| 36 class MODULES_EXPORT NavigatorVibration final | 46 class MODULES_EXPORT NavigatorVibration final |
| 37 : public GarbageCollectedFinalized<NavigatorVibration> | 47 : public GarbageCollectedFinalized<NavigatorVibration> |
| 38 , public Supplement<Navigator> | 48 , public Supplement<Navigator> |
| 39 , public DOMWindowProperty { | 49 , public DOMWindowProperty { |
| 40 USING_GARBAGE_COLLECTED_MIXIN(NavigatorVibration); | 50 USING_GARBAGE_COLLECTED_MIXIN(NavigatorVibration); |
| 41 WTF_MAKE_NONCOPYABLE(NavigatorVibration); | 51 WTF_MAKE_NONCOPYABLE(NavigatorVibration); |
| 42 public: | 52 public: |
| 43 using VibrationPattern = Vector<unsigned>; | 53 using VibrationPattern = Vector<unsigned>; |
| 44 | 54 |
| 45 virtual ~NavigatorVibration(); | 55 virtual ~NavigatorVibration(); |
| 46 | 56 |
| 47 static NavigatorVibration& from(Navigator&); | 57 static NavigatorVibration& from(Navigator&); |
| 48 | 58 |
| 49 static bool vibrate(Navigator&, unsigned time); | 59 static bool vibrate(Navigator&, unsigned time); |
| 50 static bool vibrate(Navigator&, const VibrationPattern&); | 60 static bool vibrate(Navigator&, const VibrationPattern&); |
| 51 | 61 |
| 52 VibrationController* controller(); | 62 VibrationController* controller(); |
| 53 | 63 |
| 54 DECLARE_VIRTUAL_TRACE(); | 64 DECLARE_VIRTUAL_TRACE(); |
| 55 | 65 |
| 56 private: | 66 private: |
| 57 static const char* supplementName(); | 67 static const char* supplementName(); |
| 58 | 68 |
| 59 explicit NavigatorVibration(Navigator&); | 69 explicit NavigatorVibration(Navigator&); |
| 60 | 70 |
| 61 // Inherited from DOMWindowProperty. | 71 // Inherited from DOMWindowProperty. |
| 62 void willDetachGlobalObjectFromFrame() override; | 72 void willDetachGlobalObjectFromFrame() override; |
| 63 | 73 |
| 74 static void collectHistogramMetrics(const LocalFrame&); |
| 75 |
| 64 Member<VibrationController> m_controller; | 76 Member<VibrationController> m_controller; |
| 65 }; | 77 }; |
| 66 | 78 |
| 67 } // namespace blink | 79 } // namespace blink |
| 68 | 80 |
| 69 #endif // NavigatorVibration_h | 81 #endif // NavigatorVibration_h |
| OLD | NEW |