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

Side by Side Diff: Source/modules/screen_orientation/ScreenOrientationController.h

Issue 595783003: Make ScreenOrientationController a FrameDestructionObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rename predicate to isActiveAndVisible() Created 6 years, 3 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 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/PlatformEventController.h" 9 #include "core/frame/PlatformEventController.h"
9 #include "platform/Supplementable.h" 10 #include "platform/Supplementable.h"
10 #include "platform/Timer.h" 11 #include "platform/Timer.h"
11 #include "public/platform/WebLockOrientationCallback.h" 12 #include "public/platform/WebLockOrientationCallback.h"
12 #include "public/platform/WebScreenOrientationLockType.h" 13 #include "public/platform/WebScreenOrientationLockType.h"
13 #include "public/platform/WebScreenOrientationType.h" 14 #include "public/platform/WebScreenOrientationType.h"
14 15
15 namespace blink { 16 namespace blink {
16 17
17 class FrameView; 18 class FrameView;
18 class ScreenOrientation; 19 class ScreenOrientation;
19 class WebScreenOrientationClient; 20 class WebScreenOrientationClient;
20 21
21 class ScreenOrientationController FINAL 22 class ScreenOrientationController FINAL
22 : public NoBaseWillBeGarbageCollectedFinalized<ScreenOrientationController> 23 : public NoBaseWillBeGarbageCollectedFinalized<ScreenOrientationController>
23 , public WillBeHeapSupplement<LocalFrame> 24 , public WillBeHeapSupplement<LocalFrame>
25 , public FrameDestructionObserver
24 , public PlatformEventController { 26 , public PlatformEventController {
25 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationController); 27 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientationController);
26 WTF_MAKE_NONCOPYABLE(ScreenOrientationController); 28 WTF_MAKE_NONCOPYABLE(ScreenOrientationController);
27 public: 29 public:
28 virtual ~ScreenOrientationController(); 30 virtual ~ScreenOrientationController();
29 31
30 void setOrientation(ScreenOrientation*); 32 void setOrientation(ScreenOrientation*);
31 void notifyOrientationChanged(); 33 void notifyOrientationChanged();
32 34
33 void lock(WebScreenOrientationLockType, WebLockOrientationCallback*); 35 void lock(WebScreenOrientationLockType, WebLockOrientationCallback*);
34 void unlock(); 36 void unlock();
35 37
36 const LocalFrame& frame() const;
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*); 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;
62
61 PersistentWillBeMember<ScreenOrientation> m_orientation; 63 PersistentWillBeMember<ScreenOrientation> m_orientation;
62 WebScreenOrientationClient* m_client; 64 WebScreenOrientationClient* m_client;
63 LocalFrame& m_frame;
64 Timer<ScreenOrientationController> m_dispatchEventTimer; 65 Timer<ScreenOrientationController> m_dispatchEventTimer;
65 }; 66 };
66 67
67 } // namespace blink 68 } // namespace blink
68 69
69 #endif // ScreenOrientationController_h 70 #endif // ScreenOrientationController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698