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/HTMLImageElement.h" |
| 8 #include "core/html/HTMLVideoElement.h" |
| 9 #include "core/html/shadow/MediaRemotingElements.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 MediaRemotingInterstitial::MediaRemotingInterstitial( |
| 14 HTMLVideoElement& videoElement) |
| 15 : HTMLDivElement(videoElement.GetDocument()), |
| 16 video_element_(&videoElement) { |
| 17 SetShadowPseudoId(AtomicString("-internal-media-remoting-interstitial")); |
| 18 background_image_ = HTMLImageElement::Create(videoElement.GetDocument()); |
| 19 background_image_->SetShadowPseudoId( |
| 20 AtomicString("-internal-media-remoting-background-image")); |
| 21 background_image_->SetSrc(videoElement.getAttribute(HTMLNames::posterAttr)); |
| 22 AppendChild(background_image_); |
| 23 |
| 24 cast_icon_ = new MediaRemotingCastIconElement(*this); |
| 25 AppendChild(cast_icon_); |
| 26 |
| 27 cast_text_message_ = new MediaRemotingCastMessageElement(*this); |
| 28 AppendChild(cast_text_message_); |
| 29 |
| 30 exit_button_ = new MediaRemotingExitButtonElement(*this); |
| 31 AppendChild(exit_button_); |
| 32 } |
| 33 |
| 34 void MediaRemotingInterstitial::Show() { |
| 35 RemoveInlineStyleProperty(CSSPropertyDisplay); |
| 36 exit_button_->OnShown(); |
| 37 } |
| 38 |
| 39 void MediaRemotingInterstitial::Hide() { |
| 40 SetInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
| 41 exit_button_->OnHidden(); |
| 42 } |
| 43 |
| 44 void MediaRemotingInterstitial::OnPosterImageChanged() { |
| 45 background_image_->SetSrc( |
| 46 GetVideoElement().getAttribute(HTMLNames::posterAttr)); |
| 47 } |
| 48 |
| 49 DEFINE_TRACE(MediaRemotingInterstitial) { |
| 50 visitor->Trace(video_element_); |
| 51 visitor->Trace(background_image_); |
| 52 visitor->Trace(exit_button_); |
| 53 visitor->Trace(cast_icon_); |
| 54 visitor->Trace(cast_text_message_); |
| 55 HTMLDivElement::Trace(visitor); |
| 56 } |
| 57 |
| 58 } // namespace blink |
OLD | NEW |