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

Unified Diff: third_party/WebKit/Source/core/html/MediaCustomControlsFullscreenDetector.h

Issue 2696893002: [Blink>Media] Add heuristic for dominant video detection for Android (Closed)
Patch Set: nits 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/MediaCustomControlsFullscreenDetector.h
diff --git a/third_party/WebKit/Source/core/html/MediaCustomControlsFullscreenDetector.h b/third_party/WebKit/Source/core/html/MediaCustomControlsFullscreenDetector.h
new file mode 100644
index 0000000000000000000000000000000000000000..bf976182e8cbc5be37a8bcac1101f2c49640f576
--- /dev/null
+++ b/third_party/WebKit/Source/core/html/MediaCustomControlsFullscreenDetector.h
@@ -0,0 +1,57 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MediaCustomControlsFullscreenDetector_h
+#define MediaCustomControlsFullscreenDetector_h
+
+#include "core/CoreExport.h"
+#include "core/events/EventListener.h"
+#include "platform/Timer.h"
+
+namespace blink {
+
+class HTMLVideoElement;
+class IntRect;
+class TimerBase;
+
+class CORE_EXPORT MediaCustomControlsFullscreenDetector final
+ : public EventListener {
+ WTF_MAKE_NONCOPYABLE(MediaCustomControlsFullscreenDetector);
+
+ public:
+ explicit MediaCustomControlsFullscreenDetector(HTMLVideoElement&);
+
+ // EventListener implementation.
+ bool operator==(const EventListener&) const override;
+
+ DECLARE_VIRTUAL_TRACE();
+
+ private:
+ friend class MediaCustomControlsFullscreenDetectorTest;
+
+ // EventListener implementation.
+ void handleEvent(ExecutionContext*, Event*) override;
+
+ void attach();
+ void detach();
+
+ HTMLVideoElement& videoElement() { return *m_videoElement; }
+
+ void onCheckViewportIntersectionTimerFired(TimerBase*);
+
+ bool isVideoOrParentFullscreen();
+
+ static bool computeIsDominantVideoForTests(const IntRect& targetRect,
+ const IntRect& rootRect,
+ const IntRect& intersectionRect);
+
+ // `m_videoElement` owns |this|.
+ Member<HTMLVideoElement> m_videoElement;
+ TaskRunnerTimer<MediaCustomControlsFullscreenDetector>
+ m_checkViewportIntersectionTimer;
+};
+
+} // namespace blink
+
+#endif // MediaCustomControlsFullscreenDetector_h

Powered by Google App Engine
This is Rietveld 408576698