OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MediaCustomControlsFullscreenDetector_h | |
6 #define MediaCustomControlsFullscreenDetector_h | |
7 | |
8 #include "core/CoreExport.h" | |
9 #include "core/events/EventListener.h" | |
10 #include "platform/Timer.h" | |
11 | |
12 namespace blink { | |
13 | |
14 class HTMLVideoElement; | |
15 class IntRect; | |
16 class TimerBase; | |
17 | |
18 class CORE_EXPORT MediaCustomControlsFullscreenDetector final | |
19 : public EventListener { | |
20 WTF_MAKE_NONCOPYABLE(MediaCustomControlsFullscreenDetector); | |
21 | |
22 public: | |
23 explicit MediaCustomControlsFullscreenDetector(HTMLVideoElement&); | |
24 | |
25 // EventListener implementation. | |
26 bool operator==(const EventListener&) const override; | |
27 | |
28 void attach(); | |
29 void detach(); | |
30 void contextDestroyed(); | |
31 | |
32 DECLARE_VIRTUAL_TRACE(); | |
33 | |
34 private: | |
35 friend class MediaCustomControlsFullscreenDetectorTest; | |
36 friend class HTMLMediaElementEventListenersTest; | |
37 | |
38 // EventListener implementation. | |
39 void handleEvent(ExecutionContext*, Event*) override; | |
40 | |
41 HTMLVideoElement& videoElement() { return *m_videoElement; } | |
42 | |
43 void onCheckViewportIntersectionTimerFired(TimerBase*); | |
44 | |
45 bool isVideoOrParentFullscreen(); | |
46 | |
47 static bool computeIsDominantVideoForTests(const IntRect& targetRect, | |
48 const IntRect& rootRect, | |
49 const IntRect& intersectionRect); | |
50 | |
51 // `m_videoElement` owns |this|. | |
52 Member<HTMLVideoElement> m_videoElement; | |
53 TaskRunnerTimer<MediaCustomControlsFullscreenDetector> | |
54 m_checkViewportIntersectionTimer; | |
55 }; | |
56 | |
57 } // namespace blink | |
58 | |
59 #endif // MediaCustomControlsFullscreenDetector_h | |
OLD | NEW |