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

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: Updated with new UX design. 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..0da3f466957a0a441beb65ce95d3478ac4bcdaad
--- /dev/null
+++ b/third_party/WebKit/Source/core/html/shadow/MediaRemotingInterstitial.cpp
@@ -0,0 +1,95 @@
+// 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/InputTypeNames.h"
+#include "core/html/HTMLImageElement.h"
+#include "core/html/HTMLVideoElement.h"
+#include "core/html/shadow/MediaRemotingElements.h"
+#include "platform/text/PlatformLocale.h"
+
+namespace blink {
+
+MediaRemotingInterstitialElements::MediaRemotingInterstitialElements(
+ MediaRemotingInterstitial& interstitial)
+ : HTMLDivElement(interstitial.GetDocument()), interstitial_(interstitial) {
+ SetShadowPseudoId(
+ AtomicString("-internal-media-remoting-interstitial-elements"));
+
+ cast_icon_ = HTMLInputElement::Create(interstitial.GetDocument(), false);
+ cast_icon_->setType(InputTypeNames::button);
+ cast_icon_->SetShadowPseudoId(
+ AtomicString("-internal-media-remoting-cast-icon"));
+ AppendChild(cast_icon_);
+
+ cast_text_message_ =
+ HTMLInputElement::Create(interstitial.GetDocument(), false);
+ cast_text_message_->setType(InputTypeNames::text);
+ cast_text_message_->setValue(VideoElement().GetLocale().QueryString(
+ WebLocalizedString::kMediaRemotingCastText));
+ cast_text_message_->SetShadowPseudoId(
+ AtomicString("-internal-media-remoting-cast-text-message"));
+ AppendChild(cast_text_message_);
+
+ disable_button_ = new MediaRemotingDisableButtonElement(*this);
+ AppendChild(disable_button_);
+}
+
+void MediaRemotingInterstitialElements::OnShown() {
+ disable_button_->OnShown();
+}
+
+void MediaRemotingInterstitialElements::OnHidden() {
+ disable_button_->OnHidden();
+}
+
+HTMLVideoElement& MediaRemotingInterstitialElements::VideoElement() const {
+ return interstitial_->VideoElement();
+}
+
+DEFINE_TRACE(MediaRemotingInterstitialElements) {
+ visitor->Trace(interstitial_);
+ visitor->Trace(disable_button_);
+ visitor->Trace(cast_icon_);
+ visitor->Trace(cast_text_message_);
+ HTMLDivElement::Trace(visitor);
+}
+
+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_);
+ interstitial_elements_ = new MediaRemotingInterstitialElements(*this);
+ AppendChild(interstitial_elements_);
+}
+
+void MediaRemotingInterstitial::Show() {
+ RemoveInlineStyleProperty(CSSPropertyDisplay);
+ interstitial_elements_->OnShown();
+}
+
+void MediaRemotingInterstitial::Hide() {
+ SetInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
+ interstitial_elements_->OnHidden();
+}
+
+void MediaRemotingInterstitial::OnPosterImageChanged() {
+ background_image_->SetSrc(VideoElement().getAttribute(HTMLNames::posterAttr));
+}
+
+DEFINE_TRACE(MediaRemotingInterstitial) {
+ visitor->Trace(video_element_);
+ visitor->Trace(interstitial_elements_);
+ visitor->Trace(background_image_);
+ HTMLDivElement::Trace(visitor);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698