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 ScreenOrientation_h | 5 #ifndef ScreenOrientation_h |
6 #define ScreenOrientation_h | 6 #define ScreenOrientation_h |
7 | 7 |
| 8 #include "core/dom/FullscreenObserver.h" |
8 #include "core/frame/DOMWindowProperty.h" | 9 #include "core/frame/DOMWindowProperty.h" |
9 #include "platform/Supplementable.h" | 10 #include "platform/Supplementable.h" |
10 #include "platform/Timer.h" | 11 #include "platform/Timer.h" |
11 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
12 #include "public/platform/WebScreenOrientationLockType.h" | 13 #include "public/platform/WebScreenOrientationLockType.h" |
13 #include "wtf/text/AtomicString.h" | 14 #include "wtf/text/AtomicString.h" |
14 #include "wtf/text/WTFString.h" | 15 #include "wtf/text/WTFString.h" |
15 | 16 |
16 namespace WebCore { | 17 namespace WebCore { |
17 | 18 |
18 class Document; | 19 class Document; |
19 class Screen; | 20 class Screen; |
20 | 21 |
21 class ScreenOrientation FINAL : public NoBaseWillBeGarbageCollectedFinalized<Scr
eenOrientation>, public WillBeHeapSupplement<Screen>, DOMWindowProperty { | 22 class ScreenOrientation FINAL : public NoBaseWillBeGarbageCollectedFinalized<Scr
eenOrientation>, public WillBeHeapSupplement<Screen>, public DOMWindowProperty,
public FullscreenObserver { |
22 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientation); | 23 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientation); |
23 public: | 24 public: |
24 static ScreenOrientation& from(Screen&); | 25 static ScreenOrientation& from(Screen&); |
25 virtual ~ScreenOrientation(); | 26 virtual ~ScreenOrientation(); |
26 | 27 |
27 static const AtomicString& orientation(Screen&); | 28 static const AtomicString& orientation(Screen&); |
28 static bool lockOrientation(Screen&, const AtomicString& orientation); | 29 static bool lockOrientation(Screen&, const AtomicString& orientation); |
29 static void unlockOrientation(Screen&); | 30 static void unlockOrientation(Screen&); |
30 | 31 |
31 virtual void trace(Visitor* visitor) OVERRIDE { WillBeHeapSupplement<Screen>
::trace(visitor); } | 32 virtual void trace(Visitor* visitor) OVERRIDE { WillBeHeapSupplement<Screen>
::trace(visitor); } |
32 | 33 |
33 private: | 34 private: |
34 explicit ScreenOrientation(Screen&); | 35 explicit ScreenOrientation(Screen&); |
| 36 bool isOrientationLockingAllowed(Document&) const; |
35 | 37 |
36 void lockOrientationAsync(blink::WebScreenOrientationLockType); | 38 void lockOrientationAsync(blink::WebScreenOrientationLockType); |
37 void orientationLockTimerFired(Timer<ScreenOrientation>*); | 39 void orientationLockTimerFired(Timer<ScreenOrientation>*); |
38 | 40 |
| 41 void startListeningForFullscreenExit(); |
| 42 void stopListeningForFullscreenExit(); |
| 43 |
| 44 // FullscreenObserver API. |
| 45 virtual void didFullyExitFullscreen() OVERRIDE; |
| 46 |
39 static const char* supplementName(); | 47 static const char* supplementName(); |
40 Document* document() const; | 48 Document* document() const; |
41 | 49 |
42 Timer<ScreenOrientation> m_orientationLockTimer; | 50 Timer<ScreenOrientation> m_orientationLockTimer; |
43 blink::WebScreenOrientationLockType m_prospectiveLock; | 51 blink::WebScreenOrientationLockType m_prospectiveLock; |
44 }; | 52 }; |
45 | 53 |
46 } // namespace WebCore | 54 } // namespace WebCore |
47 | 55 |
48 #endif // ScreenOrientation_h | 56 #endif // ScreenOrientation_h |
OLD | NEW |