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

Side by Side Diff: third_party/WebKit/Source/core/html/MediaCustomControlsFullscreenDetector.h

Issue 2758233003: Fix the conditions when fullscreen detector listeners are registered (Closed)
Patch Set: addressed mlamouri's comments Created 3 years, 9 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 MediaCustomControlsFullscreenDetector_h 5 #ifndef MediaCustomControlsFullscreenDetector_h
6 #define MediaCustomControlsFullscreenDetector_h 6 #define MediaCustomControlsFullscreenDetector_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/events/EventListener.h" 9 #include "core/events/EventListener.h"
10 #include "platform/Timer.h" 10 #include "platform/Timer.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 class HTMLVideoElement; 14 class HTMLVideoElement;
15 class IntRect; 15 class IntRect;
16 class TimerBase; 16 class TimerBase;
17 17
18 class CORE_EXPORT MediaCustomControlsFullscreenDetector final 18 class CORE_EXPORT MediaCustomControlsFullscreenDetector final
19 : public EventListener { 19 : public EventListener {
20 WTF_MAKE_NONCOPYABLE(MediaCustomControlsFullscreenDetector); 20 WTF_MAKE_NONCOPYABLE(MediaCustomControlsFullscreenDetector);
21 21
22 public: 22 public:
23 explicit MediaCustomControlsFullscreenDetector(HTMLVideoElement&); 23 explicit MediaCustomControlsFullscreenDetector(HTMLVideoElement&);
24 24
25 // EventListener implementation. 25 // EventListener implementation.
26 bool operator==(const EventListener&) const override; 26 bool operator==(const EventListener&) const override;
27 27
28 void attach();
29 void detach();
28 void contextDestroyed(); 30 void contextDestroyed();
29 31
30 DECLARE_VIRTUAL_TRACE(); 32 DECLARE_VIRTUAL_TRACE();
31 33
32 private: 34 private:
33 friend class MediaCustomControlsFullscreenDetectorTest; 35 friend class MediaCustomControlsFullscreenDetectorTest;
34 friend class HTMLMediaElementEventListenersTest; 36 friend class HTMLMediaElementEventListenersTest;
35 37
36 // EventListener implementation. 38 // EventListener implementation.
37 void handleEvent(ExecutionContext*, Event*) override; 39 void handleEvent(ExecutionContext*, Event*) override;
38 40
39 void attach();
40 void detach();
41
42 HTMLVideoElement& videoElement() { return *m_videoElement; } 41 HTMLVideoElement& videoElement() { return *m_videoElement; }
43 42
44 void onCheckViewportIntersectionTimerFired(TimerBase*); 43 void onCheckViewportIntersectionTimerFired(TimerBase*);
45 44
46 bool isVideoOrParentFullscreen(); 45 bool isVideoOrParentFullscreen();
47 46
48 static bool computeIsDominantVideoForTests(const IntRect& targetRect, 47 static bool computeIsDominantVideoForTests(const IntRect& targetRect,
49 const IntRect& rootRect, 48 const IntRect& rootRect,
50 const IntRect& intersectionRect); 49 const IntRect& intersectionRect);
51 50
52 // `m_videoElement` owns |this|. 51 // `m_videoElement` owns |this|.
53 Member<HTMLVideoElement> m_videoElement; 52 Member<HTMLVideoElement> m_videoElement;
54 TaskRunnerTimer<MediaCustomControlsFullscreenDetector> 53 TaskRunnerTimer<MediaCustomControlsFullscreenDetector>
55 m_checkViewportIntersectionTimer; 54 m_checkViewportIntersectionTimer;
56 }; 55 };
57 56
58 } // namespace blink 57 } // namespace blink
59 58
60 #endif // MediaCustomControlsFullscreenDetector_h 59 #endif // MediaCustomControlsFullscreenDetector_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698