OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/html/shadow/MediaRemotingInterstitial.h" |
| 6 |
| 7 #include "core/html/HTMLVideoElement.h" |
| 8 #include "core/html/shadow/MediaRemotingElements.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 MediaRemotingInterstitialElements::MediaRemotingInterstitialElements( |
| 13 MediaRemotingInterstitial& interstitial) |
| 14 : HTMLDivElement(interstitial.document()), m_interstitial(interstitial) { |
| 15 setShadowPseudoId( |
| 16 AtomicString("-internal-media-remoting-interstitial-elements")); |
| 17 m_mediaRemotingDisableButton = new MediaRemotingDisableButtonElement(*this); |
| 18 m_MediaRemotingCastIcon = new MediaRemotingCastIconElement(*this); |
| 19 appendChild(m_MediaRemotingCastIcon); |
| 20 appendChild(m_mediaRemotingDisableButton); |
| 21 } |
| 22 |
| 23 void MediaRemotingInterstitialElements::onShown() { |
| 24 m_mediaRemotingDisableButton->onShown(); |
| 25 } |
| 26 |
| 27 void MediaRemotingInterstitialElements::onHidden() { |
| 28 m_mediaRemotingDisableButton->onHidden(); |
| 29 } |
| 30 |
| 31 HTMLVideoElement& MediaRemotingInterstitialElements::videoElement() const { |
| 32 return m_interstitial->videoElement(); |
| 33 } |
| 34 |
| 35 DEFINE_TRACE(MediaRemotingInterstitialElements) { |
| 36 visitor->trace(m_interstitial); |
| 37 visitor->trace(m_mediaRemotingDisableButton); |
| 38 visitor->trace(m_MediaRemotingCastIcon); |
| 39 HTMLDivElement::trace(visitor); |
| 40 } |
| 41 |
| 42 MediaRemotingInterstitial::MediaRemotingInterstitial( |
| 43 HTMLVideoElement& videoElement) |
| 44 : HTMLDivElement(videoElement.document()), m_videoElement(&videoElement) { |
| 45 setShadowPseudoId(AtomicString("-internal-media-remoting-interstitial")); |
| 46 m_interstitialElements = new MediaRemotingInterstitialElements(*this); |
| 47 m_mediaRemotingBackgroundImage = |
| 48 new MediaRemotingBackgroundImageElement(*this); |
| 49 appendChild(m_mediaRemotingBackgroundImage); |
| 50 appendChild(m_interstitialElements); |
| 51 } |
| 52 |
| 53 void MediaRemotingInterstitial::show() { |
| 54 removeInlineStyleProperty(CSSPropertyDisplay); |
| 55 m_shown = true; |
| 56 m_interstitialElements->onShown(); |
| 57 } |
| 58 |
| 59 void MediaRemotingInterstitial::hide() { |
| 60 setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
| 61 m_shown = false; |
| 62 m_interstitialElements->onHidden(); |
| 63 } |
| 64 |
| 65 void MediaRemotingInterstitial::onPosterImageChanged() { |
| 66 if (m_mediaRemotingBackgroundImage) |
| 67 m_mediaRemotingBackgroundImage->onPosterImageChanged(); |
| 68 } |
| 69 |
| 70 DEFINE_TRACE(MediaRemotingInterstitial) { |
| 71 visitor->trace(m_videoElement); |
| 72 visitor->trace(m_interstitialElements); |
| 73 visitor->trace(m_mediaRemotingBackgroundImage); |
| 74 HTMLDivElement::trace(visitor); |
| 75 } |
| 76 |
| 77 } // namespace blink |
OLD | NEW |