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/PlatformEventController.h" | 8 #include "core/frame/PlatformEventController.h" |
9 #include "platform/Supplementable.h" | 9 #include "platform/Supplementable.h" |
10 #include "platform/Timer.h" | 10 #include "platform/Timer.h" |
11 #include "public/platform/WebLockOrientationCallback.h" | 11 #include "public/platform/WebLockOrientationCallback.h" |
12 #include "public/platform/WebScreenOrientationLockType.h" | 12 #include "public/platform/WebScreenOrientationLockType.h" |
13 #include "public/platform/WebScreenOrientationType.h" | 13 #include "public/platform/WebScreenOrientationType.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 class WebScreenOrientationClient; | |
17 } | |
18 | |
19 namespace blink { | |
20 | 16 |
21 class FrameView; | 17 class FrameView; |
22 class ScreenOrientation; | 18 class ScreenOrientation; |
| 19 class WebScreenOrientationClient; |
23 | 20 |
24 class ScreenOrientationController FINAL | 21 class ScreenOrientationController FINAL |
25 : public NoBaseWillBeGarbageCollectedFinalized<ScreenOrientationController> | 22 : public NoBaseWillBeGarbageCollectedFinalized<ScreenOrientationController> |
26 , public WillBeHeapSupplement<LocalFrame> | 23 , public WillBeHeapSupplement<LocalFrame> |
27 , public PlatformEventController { | 24 , public PlatformEventController { |
28 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationController); | 25 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationController); |
29 WTF_MAKE_NONCOPYABLE(ScreenOrientationController); | 26 WTF_MAKE_NONCOPYABLE(ScreenOrientationController); |
30 public: | 27 public: |
31 virtual ~ScreenOrientationController(); | 28 virtual ~ScreenOrientationController(); |
32 | 29 |
33 virtual void persistentHostHasBeenDestroyed() OVERRIDE; | 30 virtual void persistentHostHasBeenDestroyed() OVERRIDE; |
34 | 31 |
35 void setOrientation(ScreenOrientation*); | 32 void setOrientation(ScreenOrientation*); |
36 void notifyOrientationChanged(); | 33 void notifyOrientationChanged(); |
37 | 34 |
38 void lock(blink::WebScreenOrientationLockType, blink::WebLockOrientationCall
back*); | 35 void lock(WebScreenOrientationLockType, WebLockOrientationCallback*); |
39 void unlock(); | 36 void unlock(); |
40 | 37 |
41 const LocalFrame& frame() const; | 38 const LocalFrame& frame() const; |
42 | 39 |
43 static void provideTo(LocalFrame&, blink::WebScreenOrientationClient*); | 40 static void provideTo(LocalFrame&, WebScreenOrientationClient*); |
44 static ScreenOrientationController* from(LocalFrame&); | 41 static ScreenOrientationController* from(LocalFrame&); |
45 static const char* supplementName(); | 42 static const char* supplementName(); |
46 | 43 |
47 virtual void trace(Visitor*); | 44 virtual void trace(Visitor*); |
48 | 45 |
49 private: | 46 private: |
50 explicit ScreenOrientationController(LocalFrame&, blink::WebScreenOrientatio
nClient*); | 47 explicit ScreenOrientationController(LocalFrame&, WebScreenOrientationClient
*); |
51 static blink::WebScreenOrientationType computeOrientation(FrameView*); | 48 static WebScreenOrientationType computeOrientation(FrameView*); |
52 | 49 |
53 // Inherited from PlatformEventController. | 50 // Inherited from PlatformEventController. |
54 virtual void didUpdateData() OVERRIDE; | 51 virtual void didUpdateData() OVERRIDE; |
55 virtual void registerWithDispatcher() OVERRIDE; | 52 virtual void registerWithDispatcher() OVERRIDE; |
56 virtual void unregisterWithDispatcher() OVERRIDE; | 53 virtual void unregisterWithDispatcher() OVERRIDE; |
57 virtual bool hasLastData() OVERRIDE; | 54 virtual bool hasLastData() OVERRIDE; |
58 virtual void pageVisibilityChanged() OVERRIDE; | 55 virtual void pageVisibilityChanged() OVERRIDE; |
59 | 56 |
60 void notifyDispatcher(); | 57 void notifyDispatcher(); |
61 | 58 |
62 void updateOrientation(); | 59 void updateOrientation(); |
63 | 60 |
64 void dispatchEventTimerFired(Timer<ScreenOrientationController>*); | 61 void dispatchEventTimerFired(Timer<ScreenOrientationController>*); |
65 | 62 |
66 PersistentWillBeMember<ScreenOrientation> m_orientation; | 63 PersistentWillBeMember<ScreenOrientation> m_orientation; |
67 blink::WebScreenOrientationClient* m_client; | 64 WebScreenOrientationClient* m_client; |
68 LocalFrame& m_frame; | 65 LocalFrame& m_frame; |
69 Timer<ScreenOrientationController> m_dispatchEventTimer; | 66 Timer<ScreenOrientationController> m_dispatchEventTimer; |
70 }; | 67 }; |
71 | 68 |
72 } // namespace blink | 69 } // namespace blink |
73 | 70 |
74 #endif // ScreenOrientationController_h | 71 #endif // ScreenOrientationController_h |
OLD | NEW |