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

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

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

Powered by Google App Engine
This is Rietveld 408576698