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 ScreenOrientation; |
21 | 22 |
22 class ScreenOrientationController FINAL : public NoBaseWillBeGarbageCollectedFin
alized<ScreenOrientationController>, public WillBeHeapSupplement<LocalFrame>, pu
blic PageLifecycleObserver { | 23 class ScreenOrientationController FINAL : |
| 24 public NoBaseWillBeGarbageCollectedFinalized<ScreenOrientationController>, |
| 25 public WillBeHeapSupplement<LocalFrame>, |
| 26 public PageLifecycleObserver { |
23 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationController); | 27 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationController); |
24 WTF_MAKE_NONCOPYABLE(ScreenOrientationController); | 28 WTF_MAKE_NONCOPYABLE(ScreenOrientationController); |
25 public: | 29 public: |
26 virtual ~ScreenOrientationController(); | 30 virtual ~ScreenOrientationController(); |
27 | 31 |
28 virtual void persistentHostHasBeenDestroyed() OVERRIDE; | 32 virtual void persistentHostHasBeenDestroyed() OVERRIDE; |
29 | 33 |
30 blink::WebScreenOrientationType orientation() const; | 34 void setOrientation(ScreenOrientation*); |
| 35 void notifyOrientationChanged(); |
| 36 |
| 37 void lock(blink::WebScreenOrientationLockType, blink::WebLockOrientationCall
back*); |
| 38 void unlock(); |
| 39 |
| 40 const LocalFrame& frame() const; |
31 | 41 |
32 static void provideTo(LocalFrame&, blink::WebScreenOrientationClient*); | 42 static void provideTo(LocalFrame&, blink::WebScreenOrientationClient*); |
33 static ScreenOrientationController& from(LocalFrame&); | 43 static ScreenOrientationController* from(LocalFrame&); |
34 static const char* supplementName(); | 44 static const char* supplementName(); |
35 | 45 |
36 void lockOrientation(blink::WebScreenOrientationLockType, blink::WebLockOrie
ntationCallback*); | 46 virtual void trace(Visitor*); |
37 void unlockOrientation(); | |
38 | 47 |
39 private: | 48 private: |
40 explicit ScreenOrientationController(LocalFrame&, blink::WebScreenOrientatio
nClient*); | 49 explicit ScreenOrientationController(LocalFrame&, blink::WebScreenOrientatio
nClient*); |
41 static blink::WebScreenOrientationType computeOrientation(FrameView*); | 50 static blink::WebScreenOrientationType computeOrientation(FrameView*); |
42 | 51 |
43 // Inherited from PageLifecycleObserver. | 52 // Inherited from PageLifecycleObserver. |
44 virtual void pageVisibilityChanged() OVERRIDE; | 53 virtual void pageVisibilityChanged() OVERRIDE; |
45 | 54 |
46 blink::WebScreenOrientationType m_overrideOrientation; | 55 void updateOrientation(); |
| 56 |
| 57 PersistentWillBeMember<ScreenOrientation> m_orientation; |
47 blink::WebScreenOrientationClient* m_client; | 58 blink::WebScreenOrientationClient* m_client; |
48 LocalFrame& m_frame; | 59 LocalFrame& m_frame; |
49 }; | 60 }; |
50 | 61 |
51 } // namespace WebCore | 62 } // namespace WebCore |
52 | 63 |
53 #endif // ScreenOrientationController_h | 64 #endif // ScreenOrientationController_h |
OLD | NEW |