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