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 | 21 |
22 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 { |
23 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationController); | 23 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationController); |
24 WTF_MAKE_NONCOPYABLE(ScreenOrientationController); | 24 WTF_MAKE_NONCOPYABLE(ScreenOrientationController); |
25 public: | 25 public: |
26 virtual ~ScreenOrientationController(); | 26 virtual ~ScreenOrientationController(); |
27 | 27 |
| 28 virtual void persistentHostHasBeenDestroyed() OVERRIDE; |
| 29 |
28 blink::WebScreenOrientationType orientation() const; | 30 blink::WebScreenOrientationType orientation() const; |
29 | 31 |
30 static void provideTo(LocalFrame&, blink::WebScreenOrientationClient*); | 32 static void provideTo(LocalFrame&, blink::WebScreenOrientationClient*); |
31 static ScreenOrientationController& from(LocalFrame&); | 33 static ScreenOrientationController& from(LocalFrame&); |
32 static const char* supplementName(); | 34 static const char* supplementName(); |
33 | 35 |
34 void lockOrientation(blink::WebScreenOrientationLockType, blink::WebLockOrie
ntationCallback*); | 36 void lockOrientation(blink::WebScreenOrientationLockType, blink::WebLockOrie
ntationCallback*); |
35 void unlockOrientation(); | 37 void unlockOrientation(); |
36 | 38 |
37 private: | 39 private: |
38 explicit ScreenOrientationController(LocalFrame&, blink::WebScreenOrientatio
nClient*); | 40 explicit ScreenOrientationController(LocalFrame&, blink::WebScreenOrientatio
nClient*); |
39 static blink::WebScreenOrientationType computeOrientation(FrameView*); | 41 static blink::WebScreenOrientationType computeOrientation(FrameView*); |
40 | 42 |
41 // Inherited from PageLifecycleObserver. | 43 // Inherited from PageLifecycleObserver. |
42 virtual void pageVisibilityChanged() OVERRIDE; | 44 virtual void pageVisibilityChanged() OVERRIDE; |
43 | 45 |
44 blink::WebScreenOrientationType m_overrideOrientation; | 46 blink::WebScreenOrientationType m_overrideOrientation; |
45 blink::WebScreenOrientationClient* m_client; | 47 blink::WebScreenOrientationClient* m_client; |
46 LocalFrame& m_frame; | 48 LocalFrame& m_frame; |
47 }; | 49 }; |
48 | 50 |
49 } // namespace WebCore | 51 } // namespace WebCore |
50 | 52 |
51 #endif // ScreenOrientationController_h | 53 #endif // ScreenOrientationController_h |
OLD | NEW |