| 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/frame/FrameDestructionObserver.h" | 8 #include "core/frame/FrameDestructionObserver.h" |
| 9 #include "core/frame/PlatformEventController.h" | 9 #include "core/frame/PlatformEventController.h" |
| 10 #include "platform/Supplementable.h" | 10 #include "platform/Supplementable.h" |
| 11 #include "platform/Timer.h" | 11 #include "platform/Timer.h" |
| 12 #include "public/platform/WebLockOrientationCallback.h" | 12 #include "public/platform/WebLockOrientationCallback.h" |
| 13 #include "public/platform/WebScreenOrientationLockType.h" | 13 #include "public/platform/WebScreenOrientationLockType.h" |
| 14 #include "public/platform/WebScreenOrientationType.h" | 14 #include "public/platform/WebScreenOrientationType.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 class FrameView; | 18 class FrameView; |
| 19 class ScreenOrientation; | 19 class ScreenOrientation; |
| 20 class WebScreenOrientationClient; | 20 class WebScreenOrientationClient; |
| 21 | 21 |
| 22 class ScreenOrientationController FINAL | 22 class ScreenOrientationController final |
| 23 : public NoBaseWillBeGarbageCollectedFinalized<ScreenOrientationController> | 23 : public NoBaseWillBeGarbageCollectedFinalized<ScreenOrientationController> |
| 24 , public WillBeHeapSupplement<LocalFrame> | 24 , public WillBeHeapSupplement<LocalFrame> |
| 25 , public FrameDestructionObserver | 25 , public FrameDestructionObserver |
| 26 , public PlatformEventController { | 26 , public PlatformEventController { |
| 27 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationController); | 27 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationController); |
| 28 WTF_MAKE_NONCOPYABLE(ScreenOrientationController); | 28 WTF_MAKE_NONCOPYABLE(ScreenOrientationController); |
| 29 public: | 29 public: |
| 30 virtual ~ScreenOrientationController(); | 30 virtual ~ScreenOrientationController(); |
| 31 | 31 |
| 32 void setOrientation(ScreenOrientation*); | 32 void setOrientation(ScreenOrientation*); |
| 33 void notifyOrientationChanged(); | 33 void notifyOrientationChanged(); |
| 34 | 34 |
| 35 void lock(WebScreenOrientationLockType, WebLockOrientationCallback*); | 35 void lock(WebScreenOrientationLockType, WebLockOrientationCallback*); |
| 36 void unlock(); | 36 void unlock(); |
| 37 | 37 |
| 38 static void provideTo(LocalFrame&, WebScreenOrientationClient*); | 38 static void provideTo(LocalFrame&, WebScreenOrientationClient*); |
| 39 static ScreenOrientationController* from(LocalFrame&); | 39 static ScreenOrientationController* from(LocalFrame&); |
| 40 static const char* supplementName(); | 40 static const char* supplementName(); |
| 41 | 41 |
| 42 virtual void trace(Visitor*) OVERRIDE; | 42 virtual void trace(Visitor*) override; |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 explicit ScreenOrientationController(LocalFrame&, WebScreenOrientationClient
*); | 45 explicit ScreenOrientationController(LocalFrame&, WebScreenOrientationClient
*); |
| 46 static WebScreenOrientationType computeOrientation(FrameView*); | 46 static WebScreenOrientationType computeOrientation(FrameView*); |
| 47 | 47 |
| 48 // Inherited from PlatformEventController. | 48 // Inherited from PlatformEventController. |
| 49 virtual void didUpdateData() OVERRIDE; | 49 virtual void didUpdateData() override; |
| 50 virtual void registerWithDispatcher() OVERRIDE; | 50 virtual void registerWithDispatcher() override; |
| 51 virtual void unregisterWithDispatcher() OVERRIDE; | 51 virtual void unregisterWithDispatcher() override; |
| 52 virtual bool hasLastData() OVERRIDE; | 52 virtual bool hasLastData() override; |
| 53 virtual void pageVisibilityChanged() OVERRIDE; | 53 virtual void pageVisibilityChanged() override; |
| 54 | 54 |
| 55 void notifyDispatcher(); | 55 void notifyDispatcher(); |
| 56 | 56 |
| 57 void updateOrientation(); | 57 void updateOrientation(); |
| 58 | 58 |
| 59 void dispatchEventTimerFired(Timer<ScreenOrientationController>*); | 59 void dispatchEventTimerFired(Timer<ScreenOrientationController>*); |
| 60 | 60 |
| 61 bool isActiveAndVisible() const; | 61 bool isActiveAndVisible() const; |
| 62 | 62 |
| 63 PersistentWillBeMember<ScreenOrientation> m_orientation; | 63 PersistentWillBeMember<ScreenOrientation> m_orientation; |
| 64 WebScreenOrientationClient* m_client; | 64 WebScreenOrientationClient* m_client; |
| 65 Timer<ScreenOrientationController> m_dispatchEventTimer; | 65 Timer<ScreenOrientationController> m_dispatchEventTimer; |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 } // namespace blink | 68 } // namespace blink |
| 69 | 69 |
| 70 #endif // ScreenOrientationController_h | 70 #endif // ScreenOrientationController_h |
| OLD | NEW |