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/HTMLMediaElement.h" |
| 8 #include "core/html/shadow/MediaControlElements.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 m_mediaRemotingCastMessage = new MediaRemotingCastMessageElement(*this); |
| 20 appendChild(m_MediaRemotingCastIcon); |
| 21 appendChild(m_mediaRemotingCastMessage); |
| 22 appendChild(m_mediaRemotingDisableButton); |
| 23 } |
| 24 |
| 25 void MediaRemotingInterstitialElements::show() { |
| 26 m_mediaRemotingDisableButton->show(); |
| 27 m_MediaRemotingCastIcon->show(); |
| 28 m_mediaRemotingCastMessage->show(); |
| 29 } |
| 30 |
| 31 void MediaRemotingInterstitialElements::hide() { |
| 32 m_mediaRemotingDisableButton->hide(); |
| 33 m_MediaRemotingCastIcon->hide(); |
| 34 m_mediaRemotingCastMessage->hide(); |
| 35 } |
| 36 |
| 37 HTMLMediaElement& MediaRemotingInterstitialElements::mediaElement() const { |
| 38 return m_interstitial->mediaElement(); |
| 39 } |
| 40 |
| 41 DEFINE_TRACE(MediaRemotingInterstitialElements) { |
| 42 visitor->trace(m_interstitial); |
| 43 visitor->trace(m_mediaRemotingDisableButton); |
| 44 visitor->trace(m_MediaRemotingCastIcon); |
| 45 visitor->trace(m_mediaRemotingCastMessage); |
| 46 HTMLDivElement::trace(visitor); |
| 47 } |
| 48 |
| 49 MediaRemotingInterstitial::MediaRemotingInterstitial( |
| 50 HTMLMediaElement& mediaElement) |
| 51 : HTMLDivElement(mediaElement.document()), m_mediaElement(&mediaElement) { |
| 52 setShadowPseudoId(AtomicString("-internal-media-remoting-interstitial")); |
| 53 m_interstitialElements = new MediaRemotingInterstitialElements(*this); |
| 54 m_mediaRemotingBackgroundImage = |
| 55 new MediaRemotingBackgroundImageElement(*this); |
| 56 appendChild(m_mediaRemotingBackgroundImage); |
| 57 appendChild(m_interstitialElements); |
| 58 } |
| 59 |
| 60 void MediaRemotingInterstitial::show() { |
| 61 m_shown = true; |
| 62 m_mediaRemotingBackgroundImage->show(); |
| 63 m_interstitialElements->show(); |
| 64 } |
| 65 |
| 66 void MediaRemotingInterstitial::hide() { |
| 67 m_shown = false; |
| 68 m_mediaRemotingBackgroundImage->hide(); |
| 69 m_interstitialElements->hide(); |
| 70 } |
| 71 |
| 72 void MediaRemotingInterstitial::onPosterImageChanged() { |
| 73 if (m_shown) { |
| 74 hide(); |
| 75 show(); |
| 76 } |
| 77 } |
| 78 |
| 79 DEFINE_TRACE(MediaRemotingInterstitial) { |
| 80 visitor->trace(m_mediaElement); |
| 81 visitor->trace(m_interstitialElements); |
| 82 visitor->trace(m_mediaRemotingBackgroundImage); |
| 83 HTMLDivElement::trace(visitor); |
| 84 } |
| 85 |
| 86 } // namespace blink |
OLD | NEW |