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/page/PageLifecycleObserver.h" | 8 #include "core/page/PageLifecycleObserver.h" |
9 #include "platform/Supplementable.h" | 9 #include "platform/Supplementable.h" |
10 #include "public/platform/WebLockOrientationCallback.h" | 10 #include "public/platform/WebLockOrientationCallback.h" |
11 #include "public/platform/WebScreenOrientationLockType.h" | 11 #include "public/platform/WebScreenOrientationLockType.h" |
12 #include "public/platform/WebScreenOrientationType.h" | 12 #include "public/platform/WebScreenOrientationType.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 class WebScreenOrientationClient; | 15 class WebScreenOrientationClient; |
16 } | 16 } |
17 | 17 |
18 namespace WebCore { | 18 namespace WebCore { |
19 | 19 |
20 class FrameView; | 20 class FrameView; |
21 class OrientationInformation; | |
22 | 21 |
23 class ScreenOrientationController FINAL : public NoBaseWillBeGarbageCollectedFin
alized<ScreenOrientationController>, public WillBeHeapSupplement<LocalFrame>, pu
blic PageLifecycleObserver { | 22 class ScreenOrientationController FINAL : public NoBaseWillBeGarbageCollectedFin
alized<ScreenOrientationController>, public WillBeHeapSupplement<LocalFrame>, pu
blic PageLifecycleObserver { |
24 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationController); | 23 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationController); |
25 WTF_MAKE_NONCOPYABLE(ScreenOrientationController); | 24 WTF_MAKE_NONCOPYABLE(ScreenOrientationController); |
26 public: | 25 public: |
27 virtual ~ScreenOrientationController(); | 26 virtual ~ScreenOrientationController(); |
28 | 27 |
29 virtual void persistentHostHasBeenDestroyed() OVERRIDE; | 28 virtual void persistentHostHasBeenDestroyed() OVERRIDE; |
30 | 29 |
31 OrientationInformation* orientation(); | 30 blink::WebScreenOrientationType orientation() const; |
32 void notifyOrientationChanged(); | |
33 | |
34 void lockOrientation(blink::WebScreenOrientationLockType, blink::WebLockOrie
ntationCallback*); | |
35 void unlockOrientation(); | |
36 | 31 |
37 static void provideTo(LocalFrame&, blink::WebScreenOrientationClient*); | 32 static void provideTo(LocalFrame&, blink::WebScreenOrientationClient*); |
38 static ScreenOrientationController& from(LocalFrame&); | 33 static ScreenOrientationController& from(LocalFrame&); |
39 static const char* supplementName(); | 34 static const char* supplementName(); |
40 | 35 |
41 virtual void trace(Visitor*); | 36 void lockOrientation(blink::WebScreenOrientationLockType, blink::WebLockOrie
ntationCallback*); |
| 37 void unlockOrientation(); |
42 | 38 |
43 private: | 39 private: |
44 explicit ScreenOrientationController(LocalFrame&, blink::WebScreenOrientatio
nClient*); | 40 explicit ScreenOrientationController(LocalFrame&, blink::WebScreenOrientatio
nClient*); |
45 static blink::WebScreenOrientationType computeOrientation(FrameView*); | 41 static blink::WebScreenOrientationType computeOrientation(FrameView*); |
46 | 42 |
47 // Inherited from PageLifecycleObserver. | 43 // Inherited from PageLifecycleObserver. |
48 virtual void pageVisibilityChanged() OVERRIDE; | 44 virtual void pageVisibilityChanged() OVERRIDE; |
49 | 45 |
50 void updateOrientation(); | 46 blink::WebScreenOrientationType m_overrideOrientation; |
51 | |
52 PersistentWillBeMember<OrientationInformation> m_orientation; | |
53 blink::WebScreenOrientationClient* m_client; | 47 blink::WebScreenOrientationClient* m_client; |
54 LocalFrame& m_frame; | 48 LocalFrame& m_frame; |
55 }; | 49 }; |
56 | 50 |
57 } // namespace WebCore | 51 } // namespace WebCore |
58 | 52 |
59 #endif // ScreenOrientationController_h | 53 #endif // ScreenOrientationController_h |
OLD | NEW |