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