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

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: Remove cast text message element. Not assuming remoting interstitial is media control. 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..384511ff59559af11cecbac85de529d779a341fa 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,10 @@ enum VideoPersistenceControlsType {
} // anonymous namespace
inline HTMLVideoElement::HTMLVideoElement(Document& document)
- : HTMLMediaElement(videoTag, document) {
+ : HTMLMediaElement(videoTag, document),
+ m_mediaRemotingDisabled(false),
+ m_mediaRemotingStarted(false),
+ m_remotingInterstitial(nullptr) {
if (document.settings()) {
m_defaultPosterURL =
AtomicString(document.settings()->getDefaultVideoPosterURL());
@@ -88,6 +92,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 +184,8 @@ void HTMLVideoElement::parseAttribute(
// Notify the player when the poster image URL changes.
if (webMediaPlayer())
webMediaPlayer()->setPoster(posterImageURL());
+ if (m_remotingInterstitial)
+ m_remotingInterstitial->onPosterImageChanged();
} else {
HTMLMediaElement::parseAttribute(params);
}
@@ -478,4 +485,31 @@ ScriptPromise HTMLVideoElement::createImageBitmap(
eventTarget.toLocalDOMWindow()->document(), options));
}
+void HTMLVideoElement::mediaRemotingStarted() {
+ m_mediaRemotingStarted = true;
+ 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() {
+ m_mediaRemotingStarted = false;
+ if (m_remotingInterstitial)
+ m_remotingInterstitial->hide();
+}
+
+void HTMLVideoElement::disableMediaRemoting() {
+ if (webMediaPlayer())
+ webMediaPlayer()->requestRemotePlaybackDisabled(true);
+ m_mediaRemotingDisabled = true;
+ m_mediaRemotingStarted = false;
+ if (m_remotingInterstitial)
+ m_remotingInterstitial->hide();
mlamouri (slow - plz ping) 2017/04/07 13:18:32 Maybe you should call `mediaRemotingStopped()`.
xjz 2017/04/07 23:07:01 Done.
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698