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 ExecutionContext; | |
20 class FrameView; | 21 class FrameView; |
22 class ScreenOrientation; | |
21 | 23 |
22 class ScreenOrientationController FINAL : public NoBaseWillBeGarbageCollectedFin alized<ScreenOrientationController>, public WillBeHeapSupplement<LocalFrame>, pu blic PageLifecycleObserver { | 24 class ScreenOrientationController FINAL : public NoBaseWillBeGarbageCollectedFin alized<ScreenOrientationController>, public WillBeHeapSupplement<LocalFrame>, pu blic PageLifecycleObserver { |
23 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationController); | 25 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationController); |
24 WTF_MAKE_NONCOPYABLE(ScreenOrientationController); | 26 WTF_MAKE_NONCOPYABLE(ScreenOrientationController); |
25 public: | 27 public: |
26 virtual ~ScreenOrientationController(); | 28 virtual ~ScreenOrientationController(); |
27 | 29 |
28 virtual void persistentHostHasBeenDestroyed() OVERRIDE; | 30 virtual void persistentHostHasBeenDestroyed() OVERRIDE; |
29 | 31 |
30 blink::WebScreenOrientationType orientation() const; | 32 void setOrientation(ScreenOrientation*); |
33 void notifyOrientationChanged(); | |
34 | |
35 void lock(blink::WebScreenOrientationLockType, blink::WebLockOrientationCall back*); | |
36 void unlock(); | |
37 | |
38 const LocalFrame& frame() const; | |
31 | 39 |
32 static void provideTo(LocalFrame&, blink::WebScreenOrientationClient*); | 40 static void provideTo(LocalFrame&, blink::WebScreenOrientationClient*); |
33 static ScreenOrientationController& from(LocalFrame&); | 41 static ScreenOrientationController* from(LocalFrame&); |
34 static const char* supplementName(); | 42 static const char* supplementName(); |
35 | 43 |
36 void lockOrientation(blink::WebScreenOrientationLockType, blink::WebLockOrie ntationCallback*); | 44 virtual void trace(Visitor*); |
37 void unlockOrientation(); | |
38 | 45 |
39 private: | 46 private: |
40 explicit ScreenOrientationController(LocalFrame&, blink::WebScreenOrientatio nClient*); | 47 explicit ScreenOrientationController(LocalFrame&, blink::WebScreenOrientatio nClient*); |
41 static blink::WebScreenOrientationType computeOrientation(FrameView*); | 48 static blink::WebScreenOrientationType computeOrientation(FrameView*); |
42 | 49 |
43 // Inherited from PageLifecycleObserver. | 50 // Inherited from PageLifecycleObserver. |
44 virtual void pageVisibilityChanged() OVERRIDE; | 51 virtual void pageVisibilityChanged() OVERRIDE; |
45 | 52 |
46 blink::WebScreenOrientationType m_overrideOrientation; | 53 void updateOrientation(); |
54 | |
55 PersistentWillBeMember<ScreenOrientation> m_orientation; | |
abarth-chromium
2014/07/07 17:29:33
This pointer is cleared in ~ScreenOrientation, whi
mlamouri (slow - plz ping)
2014/07/08 14:07:59
I should have looked into that a bit more before u
| |
47 blink::WebScreenOrientationClient* m_client; | 56 blink::WebScreenOrientationClient* m_client; |
48 LocalFrame& m_frame; | 57 LocalFrame& m_frame; |
49 }; | 58 }; |
50 | 59 |
51 } // namespace WebCore | 60 } // namespace WebCore |
52 | 61 |
53 #endif // ScreenOrientationController_h | 62 #endif // ScreenOrientationController_h |
OLD | NEW |