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

Unified Diff: third_party/WebKit/Source/core/html/HTMLVideoElement.cpp

Issue 2767823002: Media Remoting: Add interstitial elements to media element shadow dom. (Closed)
Patch Set: Addressed mlamouri's comments. Created 3 years, 8 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/HTMLVideoElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp b/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp
index 49375b0942e8390506bb741c7e62c5883218759a..692ed57edad6b9ec5db59a9d7e2a0f76414fffc8 100644
--- a/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp
@@ -39,6 +39,7 @@
#include "core/frame/Settings.h"
#include "core/html/media/MediaCustomControlsFullscreenDetector.h"
#include "core/html/parser/HTMLParserIdioms.h"
+#include "core/html/shadow/MediaRemotingInterstitial.h"
#include "core/imagebitmap/ImageBitmapOptions.h"
#include "core/layout/LayoutImage.h"
#include "core/layout/LayoutVideo.h"
@@ -66,7 +67,9 @@ enum VideoPersistenceControlsType {
} // anonymous namespace
inline HTMLVideoElement::HTMLVideoElement(Document& document)
- : HTMLMediaElement(videoTag, document) {
+ : HTMLMediaElement(videoTag, document),
+ m_mediaRemotingStatus(NotStarted),
+ m_remotingInterstitial(nullptr) {
if (document.settings()) {
m_defaultPosterURL =
AtomicString(document.settings()->getDefaultVideoPosterURL());
@@ -88,6 +91,7 @@ HTMLVideoElement* HTMLVideoElement::create(Document& document) {
DEFINE_TRACE(HTMLVideoElement) {
visitor->trace(m_imageLoader);
visitor->trace(m_customControlsFullscreenDetector);
+ visitor->trace(m_remotingInterstitial);
HTMLMediaElement::trace(visitor);
}
@@ -179,6 +183,8 @@ void HTMLVideoElement::parseAttribute(
// Notify the player when the poster image URL changes.
if (webMediaPlayer())
webMediaPlayer()->setPoster(posterImageURL());
+ if (m_remotingInterstitial)
mlamouri (slow - plz ping) 2017/04/10 13:44:22 Can you add a TODO explaining that ideally, the or
xjz 2017/04/11 04:29:44 Add comment. It's not TODO, but by design, we need
+ m_remotingInterstitial->onPosterImageChanged();
} else {
HTMLMediaElement::parseAttribute(params);
}
@@ -478,4 +484,31 @@ ScriptPromise HTMLVideoElement::createImageBitmap(
eventTarget.toLocalDOMWindow()->document(), options));
}
+void HTMLVideoElement::mediaRemotingStarted() {
+ DCHECK_EQ(m_mediaRemotingStatus, NotStarted);
+ m_mediaRemotingStatus = Started;
+ if (!m_remotingInterstitial) {
+ m_remotingInterstitial = new MediaRemotingInterstitial(*this);
+ ShadowRoot& shadowRoot = ensureUserAgentShadowRoot();
+ shadowRoot.insertBefore(m_remotingInterstitial, shadowRoot.firstChild());
+ HTMLMediaElement::assertShadowRootChildren(shadowRoot);
+ }
+ if (m_remotingInterstitial)
+ m_remotingInterstitial->show();
+}
+
+void HTMLVideoElement::mediaRemotingStopped() {
+ if (m_mediaRemotingStatus != Disabled)
+ m_mediaRemotingStatus = NotStarted;
+ if (m_remotingInterstitial)
+ m_remotingInterstitial->hide();
+}
+
+void HTMLVideoElement::disableMediaRemoting() {
+ if (webMediaPlayer())
+ webMediaPlayer()->requestRemotePlaybackDisabled(true);
+ m_mediaRemotingStatus = Disabled;
+ mediaRemotingStopped();
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698