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

Unified Diff: third_party/WebKit/Source/modules/media_controls/elements/MediaControlButtonPromoElements.cpp

Issue 2898543002: media_controls: Add UI for showing a promo bubble on a control button. (Closed)
Patch Set: make animation work Created 3 years, 7 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/modules/media_controls/elements/MediaControlButtonPromoElements.cpp
diff --git a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlButtonPromoElements.cpp b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlButtonPromoElements.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2f3166fcb8a2a71ee1f8884b70cbf1276308e630
--- /dev/null
+++ b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlButtonPromoElements.cpp
@@ -0,0 +1,74 @@
+// 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 "modules/media_controls/elements/MediaControlButtonPromoElements.h"
+
+#include "core/html/HTMLStyleElement.h"
+#include "modules/media_controls/MediaControlsImpl.h"
+#include "platform/text/PlatformLocale.h"
+
+namespace blink {
+
+MediaControlButtonPromoAnimation::MediaControlButtonPromoAnimation(
+ MediaControlsImpl& controls)
+ : MediaControlDivElement(controls, kMediaButtonPromoAnimation) {
+ SetIdAttribute(AtomicString("button-promo-animation"));
+}
+
+MediaControlButtonPromoArrow::MediaControlButtonPromoArrow(
+ MediaControlsImpl& controls)
+ : MediaControlDivElement(controls, kMediaButtonPromoArrow) {
+ SetShadowPseudoId(AtomicString("-internal-media-controls-promo-arrow"));
+}
+
+MediaControlButtonPromoText::MediaControlButtonPromoText(
+ MediaControlsImpl& controls,
+ MediaControlElementType type,
+ WebLocalizedString::Name name)
+ : MediaControlDivElement(controls, type) {
+ SetShadowPseudoId(AtomicString("-internal-media-controls-promo-text"));
+ setTextContent(GetDocument()
+ .GetCachedLocale(GetDocument().ContentLanguage())
+ .QueryString(name));
+}
+
+MediaControlButtonPromoContainer::MediaControlButtonPromoContainer(
+ MediaControlsImpl& controls,
+ MediaControlElementType button_type,
+ WebLocalizedString::Name promo_text)
+ : MediaControlDivElement(controls, kMediaButtonPromoContainer) {
+ SetShadowPseudoId(AtomicString("-internal-media-controls-promo-container"));
+
+ style_ = HTMLStyleElement::Create(controls.OwnerDocument(), false);
+ style_->setTextContent(
+ "@keyframes promo-throbbing {"
+ "0% {transform: scale(0.5, 0.5);}"
+ "50% {transform: scale(1.0, 1.0);}"
+ "100% {transform: scale(0.5, 0.5);}}"
+ "#button-promo-animation { display: flex;"
+ "flex: none; box-sizing: border-box;"
+ "width: inherit; height: inherit;"
+ "border-radius: 50%; background-color: #4285f4;"
+ "color: blue; opacity: 0.4;"
+ "animation: promo-throbbing 2s infinite;}");
+ AppendChild(style_);
+
+ animation_ = new MediaControlButtonPromoAnimation(controls);
+ AppendChild(animation_);
+
+ arrow_ = new MediaControlButtonPromoArrow(controls);
+ AppendChild(arrow_);
+ text_ = new MediaControlButtonPromoText(controls, button_type, promo_text);
+ AppendChild(text_);
+}
+
+DEFINE_TRACE(MediaControlButtonPromoContainer) {
+ visitor->Trace(animation_);
+ visitor->Trace(arrow_);
+ visitor->Trace(text_);
+ visitor->Trace(style_);
+ MediaControlDivElement::Trace(visitor);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698