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

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: Rebased. Created 3 years, 8 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..e183d8e59310f7094da408fae10d9a88b3cb8dd3
--- /dev/null
+++ b/third_party/WebKit/Source/core/html/shadow/MediaRemotingInterstitial.cpp
@@ -0,0 +1,58 @@
+// 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/HTMLImageElement.h"
+#include "core/html/HTMLVideoElement.h"
+#include "core/html/shadow/MediaRemotingElements.h"
+
+namespace blink {
+
+MediaRemotingInterstitial::MediaRemotingInterstitial(
+ HTMLVideoElement& videoElement)
+ : HTMLDivElement(videoElement.GetDocument()),
+ video_element_(&videoElement) {
+ SetShadowPseudoId(AtomicString("-internal-media-remoting-interstitial"));
+ background_image_ = HTMLImageElement::Create(videoElement.GetDocument());
+ background_image_->SetShadowPseudoId(
+ AtomicString("-internal-media-remoting-background-image"));
+ background_image_->SetSrc(videoElement.getAttribute(HTMLNames::posterAttr));
+ AppendChild(background_image_);
+
+ cast_icon_ = new MediaRemotingCastIconElement(*this);
+ AppendChild(cast_icon_);
+
+ cast_text_message_ = new MediaRemotingCastMessageElement(*this);
+ AppendChild(cast_text_message_);
+
+ exit_button_ = new MediaRemotingExitButtonElement(*this);
+ AppendChild(exit_button_);
+}
+
+void MediaRemotingInterstitial::Show() {
+ RemoveInlineStyleProperty(CSSPropertyDisplay);
+ exit_button_->OnShown();
+}
+
+void MediaRemotingInterstitial::Hide() {
+ SetInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
+ exit_button_->OnHidden();
+}
+
+void MediaRemotingInterstitial::OnPosterImageChanged() {
+ background_image_->SetSrc(
+ GetVideoElement().getAttribute(HTMLNames::posterAttr));
+}
+
+DEFINE_TRACE(MediaRemotingInterstitial) {
+ visitor->Trace(video_element_);
+ visitor->Trace(background_image_);
+ visitor->Trace(exit_button_);
+ visitor->Trace(cast_icon_);
+ visitor->Trace(cast_text_message_);
+ HTMLDivElement::Trace(visitor);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698