OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ScreenOrientationController_h | 5 #ifndef ScreenOrientationController_h |
6 #define ScreenOrientationController_h | 6 #define ScreenOrientationController_h |
7 | 7 |
8 #include "core/frame/LocalFrameLifecycleObserver.h" | 8 #include "core/frame/LocalFrameLifecycleObserver.h" |
9 #include "core/frame/PlatformEventController.h" | 9 #include "core/frame/PlatformEventController.h" |
10 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 class WebScreenOrientationClient; | 21 class WebScreenOrientationClient; |
22 | 22 |
23 class MODULES_EXPORT ScreenOrientationController final | 23 class MODULES_EXPORT ScreenOrientationController final |
24 : public NoBaseWillBeGarbageCollectedFinalized<ScreenOrientationController> | 24 : public NoBaseWillBeGarbageCollectedFinalized<ScreenOrientationController> |
25 , public WillBeHeapSupplement<LocalFrame> | 25 , public WillBeHeapSupplement<LocalFrame> |
26 , public LocalFrameLifecycleObserver | 26 , public LocalFrameLifecycleObserver |
27 , public PlatformEventController { | 27 , public PlatformEventController { |
28 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationController); | 28 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationController); |
29 WTF_MAKE_NONCOPYABLE(ScreenOrientationController); | 29 WTF_MAKE_NONCOPYABLE(ScreenOrientationController); |
30 public: | 30 public: |
31 virtual ~ScreenOrientationController(); | 31 ~ScreenOrientationController() override; |
32 | 32 |
33 void setOrientation(ScreenOrientation*); | 33 void setOrientation(ScreenOrientation*); |
34 void notifyOrientationChanged(); | 34 void notifyOrientationChanged(); |
35 | 35 |
36 void lock(WebScreenOrientationLockType, WebLockOrientationCallback*); | 36 void lock(WebScreenOrientationLockType, WebLockOrientationCallback*); |
37 void unlock(); | 37 void unlock(); |
38 | 38 |
39 void setOverride(WebScreenOrientationType, unsigned short angle); | 39 void setOverride(WebScreenOrientationType, unsigned short angle); |
40 void clearOverride(); | 40 void clearOverride(); |
41 | 41 |
42 static void provideTo(LocalFrame&, WebScreenOrientationClient*); | 42 static void provideTo(LocalFrame&, WebScreenOrientationClient*); |
43 static ScreenOrientationController* from(LocalFrame&); | 43 static ScreenOrientationController* from(LocalFrame&); |
44 static const char* supplementName(); | 44 static const char* supplementName(); |
45 | 45 |
46 DECLARE_VIRTUAL_TRACE(); | 46 DECLARE_VIRTUAL_TRACE(); |
47 | 47 |
48 private: | 48 private: |
49 ScreenOrientationController(LocalFrame&, WebScreenOrientationClient*); | 49 ScreenOrientationController(LocalFrame&, WebScreenOrientationClient*); |
50 | 50 |
51 static WebScreenOrientationType computeOrientation(const IntRect&, uint16_t)
; | 51 static WebScreenOrientationType computeOrientation(const IntRect&, uint16_t)
; |
52 | 52 |
53 // Inherited from PlatformEventController. | 53 // Inherited from PlatformEventController. |
54 virtual void didUpdateData() override; | 54 void didUpdateData() override; |
55 virtual void registerWithDispatcher() override; | 55 void registerWithDispatcher() override; |
56 virtual void unregisterWithDispatcher() override; | 56 void unregisterWithDispatcher() override; |
57 virtual bool hasLastData() override; | 57 bool hasLastData() override; |
58 virtual void pageVisibilityChanged() override; | 58 void pageVisibilityChanged() override; |
59 | 59 |
60 // Inherited from LocalFrameLifecycleObserver. | 60 // Inherited from LocalFrameLifecycleObserver. |
61 virtual void willDetachFrameHost() override; | 61 void willDetachFrameHost() override; |
62 | 62 |
63 unsigned short effectiveAngle(ChromeClient&); | 63 unsigned short effectiveAngle(ChromeClient&); |
64 WebScreenOrientationType effectiveType(ChromeClient&); | 64 WebScreenOrientationType effectiveType(ChromeClient&); |
65 | 65 |
66 void notifyDispatcher(); | 66 void notifyDispatcher(); |
67 | 67 |
68 void updateOrientation(); | 68 void updateOrientation(); |
69 | 69 |
70 void dispatchEventTimerFired(Timer<ScreenOrientationController>*); | 70 void dispatchEventTimerFired(Timer<ScreenOrientationController>*); |
71 | 71 |
72 bool isActiveAndVisible() const; | 72 bool isActiveAndVisible() const; |
73 | 73 |
74 PersistentWillBeMember<ScreenOrientation> m_orientation; | 74 PersistentWillBeMember<ScreenOrientation> m_orientation; |
75 WebScreenOrientationClient* m_client; | 75 WebScreenOrientationClient* m_client; |
76 Timer<ScreenOrientationController> m_dispatchEventTimer; | 76 Timer<ScreenOrientationController> m_dispatchEventTimer; |
77 bool m_override; | 77 bool m_override; |
78 WebScreenOrientationType m_overrideType; | 78 WebScreenOrientationType m_overrideType; |
79 unsigned short m_overrideAngle; | 79 unsigned short m_overrideAngle; |
80 }; | 80 }; |
81 | 81 |
82 } // namespace blink | 82 } // namespace blink |
83 | 83 |
84 #endif // ScreenOrientationController_h | 84 #endif // ScreenOrientationController_h |
OLD | NEW |