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..ab8bb03f448e1691af42edd6f849042f4d0a4cef |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/html/shadow/MediaRemotingInterstitial.cpp |
@@ -0,0 +1,77 @@ |
+// 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/HTMLVideoElement.h" |
+#include "core/html/shadow/MediaRemotingElements.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); |
+ appendChild(m_MediaRemotingCastIcon); |
+ appendChild(m_mediaRemotingDisableButton); |
+} |
+ |
+void MediaRemotingInterstitialElements::onShown() { |
+ m_mediaRemotingDisableButton->onShown(); |
+} |
+ |
+void MediaRemotingInterstitialElements::onHidden() { |
+ m_mediaRemotingDisableButton->onHidden(); |
+} |
+ |
+HTMLVideoElement& MediaRemotingInterstitialElements::videoElement() const { |
+ return m_interstitial->videoElement(); |
+} |
+ |
+DEFINE_TRACE(MediaRemotingInterstitialElements) { |
+ visitor->trace(m_interstitial); |
+ visitor->trace(m_mediaRemotingDisableButton); |
+ visitor->trace(m_MediaRemotingCastIcon); |
+ HTMLDivElement::trace(visitor); |
+} |
+ |
+MediaRemotingInterstitial::MediaRemotingInterstitial( |
+ HTMLVideoElement& videoElement) |
+ : HTMLDivElement(videoElement.document()), m_videoElement(&videoElement) { |
+ 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() { |
+ removeInlineStyleProperty(CSSPropertyDisplay); |
+ m_shown = true; |
+ m_interstitialElements->onShown(); |
+} |
+ |
+void MediaRemotingInterstitial::hide() { |
+ setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
+ m_shown = false; |
+ m_interstitialElements->onHidden(); |
+} |
+ |
+void MediaRemotingInterstitial::onPosterImageChanged() { |
+ if (m_mediaRemotingBackgroundImage) |
+ m_mediaRemotingBackgroundImage->onPosterImageChanged(); |
+} |
+ |
+DEFINE_TRACE(MediaRemotingInterstitial) { |
+ visitor->trace(m_videoElement); |
+ visitor->trace(m_interstitialElements); |
+ visitor->trace(m_mediaRemotingBackgroundImage); |
+ HTMLDivElement::trace(visitor); |
+} |
+ |
+} // namespace blink |