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