Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.h

Issue 2688383002: [ScreenOrientation] Merge mojo interface ScreenOrientationListener into ScreenOrientation
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 ScreenOrientationControllerImpl_h 5 #ifndef ScreenOrientationControllerImpl_h
6 #define ScreenOrientationControllerImpl_h 6 #define ScreenOrientationControllerImpl_h
7 7
8 #include <memory>
8 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
9 #include "core/frame/PlatformEventController.h"
10 #include "core/frame/ScreenOrientationController.h" 10 #include "core/frame/ScreenOrientationController.h"
11 #include "core/page/PageVisibilityObserver.h"
11 #include "modules/ModulesExport.h" 12 #include "modules/ModulesExport.h"
12 #include "public/platform/modules/screen_orientation/WebLockOrientationCallback. h" 13 #include "public/platform/modules/screen_orientation/WebLockOrientationCallback. h"
13 #include "public/platform/modules/screen_orientation/WebScreenOrientationLockTyp e.h" 14 #include "public/platform/modules/screen_orientation/WebScreenOrientationLockTyp e.h"
14 #include "public/platform/modules/screen_orientation/WebScreenOrientationType.h" 15 #include "public/platform/modules/screen_orientation/WebScreenOrientationType.h"
15 #include <memory>
16 16
17 namespace blink { 17 namespace blink {
18 18
19 class ScreenOrientation; 19 class ScreenOrientation;
20 class WebScreenOrientationClient; 20 class WebScreenOrientationClient;
21 21
22 class MODULES_EXPORT ScreenOrientationControllerImpl final 22 class MODULES_EXPORT ScreenOrientationControllerImpl final
23 : public ScreenOrientationController, 23 : public ScreenOrientationController,
24 public ContextLifecycleObserver, 24 public ContextLifecycleObserver,
25 public PlatformEventController { 25 public PageVisibilityObserver {
26 USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationControllerImpl); 26 USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationControllerImpl);
27 WTF_MAKE_NONCOPYABLE(ScreenOrientationControllerImpl); 27 WTF_MAKE_NONCOPYABLE(ScreenOrientationControllerImpl);
28 28
29 public: 29 public:
30 ~ScreenOrientationControllerImpl() override; 30 ~ScreenOrientationControllerImpl() override;
31 31
32 void setOrientation(ScreenOrientation*); 32 void setOrientation(ScreenOrientation*);
33 void notifyOrientationChanged(); 33 void notifyOrientationChanged();
34 34
35 // Implementation of ScreenOrientationController. 35 // Implementation of ScreenOrientationController.
36 void lock(WebScreenOrientationLockType, 36 void lock(WebScreenOrientationLockType,
37 std::unique_ptr<WebLockOrientationCallback>) override; 37 std::unique_ptr<WebLockOrientationCallback>) override;
38 void unlock() override; 38 void unlock() override;
39 bool maybeHasActiveLock() const override; 39 bool maybeHasActiveLock() const override;
40 40
41 static void provideTo(LocalFrame&, WebScreenOrientationClient*); 41 static void provideTo(LocalFrame&, WebScreenOrientationClient*);
42 static ScreenOrientationControllerImpl* from(LocalFrame&); 42 static ScreenOrientationControllerImpl* from(LocalFrame&);
43 43
44 DECLARE_VIRTUAL_TRACE(); 44 DECLARE_VIRTUAL_TRACE();
45 45
46 private: 46 private:
47 ScreenOrientationControllerImpl(LocalFrame&, WebScreenOrientationClient*); 47 ScreenOrientationControllerImpl(LocalFrame&, WebScreenOrientationClient*);
48 48
49 static WebScreenOrientationType computeOrientation(const IntRect&, uint16_t); 49 static WebScreenOrientationType computeOrientation(const IntRect&, uint16_t);
50 50
51 // Inherited from PlatformEventController. 51 // Inherited from ContextLifecycleObserver.
52 void didUpdateData() override;
53 void registerWithDispatcher() override;
54 void unregisterWithDispatcher() override;
55 bool hasLastData() override;
56
57 // Inherited from ContextLifecycleObserver and PageVisibilityObserver.
58 void contextDestroyed(ExecutionContext*) override; 52 void contextDestroyed(ExecutionContext*) override;
53 // Inherited from PageVisibilityObserver.
59 void pageVisibilityChanged() override; 54 void pageVisibilityChanged() override;
60 55
61 void notifyDispatcher(); 56 void notifyAccurateListen();
62 57
63 void updateOrientation(); 58 void updateOrientation();
64 59
65 void dispatchEventTimerFired(TimerBase*); 60 void dispatchEventTimerFired(TimerBase*);
66 61
67 bool isActive() const; 62 bool isActive() const;
68 bool isVisible() const; 63 bool isVisible() const;
69 bool isActiveAndVisible() const; 64 bool isActiveAndVisible() const;
70 65
71 Member<ScreenOrientation> m_orientation; 66 Member<ScreenOrientation> m_orientation;
72 WebScreenOrientationClient* m_client; 67 WebScreenOrientationClient* m_client;
73 TaskRunnerTimer<ScreenOrientationControllerImpl> m_dispatchEventTimer; 68 TaskRunnerTimer<ScreenOrientationControllerImpl> m_dispatchEventTimer;
74 bool m_activeLock = false; 69 bool m_activeLock = false;
70 bool m_startedAccurateListen = false;
75 }; 71 };
76 72
77 } // namespace blink 73 } // namespace blink
78 74
79 #endif // ScreenOrientationControllerImpl_h 75 #endif // ScreenOrientationControllerImpl_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698