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

Unified Diff: third_party/WebKit/Source/core/html/shadow/MediaRemotingInterstitial.cpp

Issue 2767823002: Media Remoting: Add interstitial elements to media element shadow dom. (Closed)
Patch Set: Modified disable button. Added cast icon and message. 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/shadow/MediaRemotingInterstitial.cpp
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaRemotingInterstitial.cpp b/third_party/WebKit/Source/core/html/shadow/MediaRemotingInterstitial.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c95d845027935f0ebaa95ff3c8cb4da641581999
--- /dev/null
+++ b/third_party/WebKit/Source/core/html/shadow/MediaRemotingInterstitial.cpp
@@ -0,0 +1,86 @@
+// 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.
+
+#include "core/html/shadow/MediaRemotingInterstitial.h"
+
+#include "core/html/HTMLMediaElement.h"
+#include "core/html/shadow/MediaControlElements.h"
+
+namespace blink {
+
+MediaRemotingInterstitialElements::MediaRemotingInterstitialElements(
+ MediaRemotingInterstitial& interstitial)
+ : HTMLDivElement(interstitial.document()), m_interstitial(interstitial) {
+ setShadowPseudoId(
+ AtomicString("-internal-media-remoting-interstitial-elements"));
+ m_mediaRemotingDisableButton = new MediaRemotingDisableButtonElement(*this);
+ m_MediaRemotingCastIcon = new MediaRemotingCastIconElement(*this);
+ m_mediaRemotingCastMessage = new MediaRemotingCastMessageElement(*this);
+ appendChild(m_MediaRemotingCastIcon);
+ appendChild(m_mediaRemotingCastMessage);
+ appendChild(m_mediaRemotingDisableButton);
+}
+
+void MediaRemotingInterstitialElements::show() {
+ m_mediaRemotingDisableButton->show();
+ m_MediaRemotingCastIcon->show();
+ m_mediaRemotingCastMessage->show();
+}
+
+void MediaRemotingInterstitialElements::hide() {
+ m_mediaRemotingDisableButton->hide();
+ m_MediaRemotingCastIcon->hide();
+ m_mediaRemotingCastMessage->hide();
+}
+
+HTMLMediaElement& MediaRemotingInterstitialElements::mediaElement() const {
+ return m_interstitial->mediaElement();
+}
+
+DEFINE_TRACE(MediaRemotingInterstitialElements) {
+ visitor->trace(m_interstitial);
+ visitor->trace(m_mediaRemotingDisableButton);
+ visitor->trace(m_MediaRemotingCastIcon);
+ visitor->trace(m_mediaRemotingCastMessage);
+ HTMLDivElement::trace(visitor);
+}
+
+MediaRemotingInterstitial::MediaRemotingInterstitial(
+ HTMLMediaElement& mediaElement)
+ : HTMLDivElement(mediaElement.document()), m_mediaElement(&mediaElement) {
+ setShadowPseudoId(AtomicString("-internal-media-remoting-interstitial"));
+ m_interstitialElements = new MediaRemotingInterstitialElements(*this);
+ m_mediaRemotingBackgroundImage =
+ new MediaRemotingBackgroundImageElement(*this);
+ appendChild(m_mediaRemotingBackgroundImage);
+ appendChild(m_interstitialElements);
+}
+
+void MediaRemotingInterstitial::show() {
+ m_shown = true;
+ m_mediaRemotingBackgroundImage->show();
+ m_interstitialElements->show();
+}
+
+void MediaRemotingInterstitial::hide() {
+ m_shown = false;
+ m_mediaRemotingBackgroundImage->hide();
+ m_interstitialElements->hide();
+}
+
+void MediaRemotingInterstitial::onPosterImageChanged() {
+ if (m_shown) {
+ hide();
+ show();
+ }
+}
+
+DEFINE_TRACE(MediaRemotingInterstitial) {
+ visitor->trace(m_mediaElement);
+ visitor->trace(m_interstitialElements);
+ visitor->trace(m_mediaRemotingBackgroundImage);
+ HTMLDivElement::trace(visitor);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698