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

Side by Side 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, 6 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 unified diff | Download patch
OLDNEW
(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 "modules/media_controls/elements/MediaControlButtonPromoElements.h"
6
7 #include "core/html/HTMLStyleElement.h"
8 #include "modules/media_controls/MediaControlsImpl.h"
9 #include "platform/text/PlatformLocale.h"
10
11 namespace blink {
12
13 MediaControlButtonPromoAnimation::MediaControlButtonPromoAnimation(
14 MediaControlsImpl& controls)
15 : MediaControlDivElement(controls, kMediaButtonPromoAnimation) {
16 SetIdAttribute(AtomicString("button-promo-animation"));
17 }
18
19 MediaControlButtonPromoArrow::MediaControlButtonPromoArrow(
20 MediaControlsImpl& controls)
21 : MediaControlDivElement(controls, kMediaButtonPromoArrow) {
22 SetShadowPseudoId(AtomicString("-internal-media-controls-promo-arrow"));
23 }
24
25 MediaControlButtonPromoText::MediaControlButtonPromoText(
26 MediaControlsImpl& controls,
27 MediaControlElementType type,
28 WebLocalizedString::Name name)
29 : MediaControlDivElement(controls, type) {
30 SetShadowPseudoId(AtomicString("-internal-media-controls-promo-text"));
31 setTextContent(GetDocument()
32 .GetCachedLocale(GetDocument().ContentLanguage())
33 .QueryString(name));
34 }
35
36 MediaControlButtonPromoContainer::MediaControlButtonPromoContainer(
37 MediaControlsImpl& controls,
38 MediaControlElementType button_type,
39 WebLocalizedString::Name promo_text)
40 : MediaControlDivElement(controls, kMediaButtonPromoContainer) {
41 SetShadowPseudoId(AtomicString("-internal-media-controls-promo-container"));
42
43 style_ = HTMLStyleElement::Create(controls.OwnerDocument(), false);
44 style_->setTextContent(
45 "@keyframes promo-throbbing {"
46 "0% {transform: scale(0.5, 0.5);}"
47 "50% {transform: scale(1.0, 1.0);}"
48 "100% {transform: scale(0.5, 0.5);}}"
49 "#button-promo-animation { display: flex;"
50 "flex: none; box-sizing: border-box;"
51 "width: inherit; height: inherit;"
52 "border-radius: 50%; background-color: #4285f4;"
53 "color: blue; opacity: 0.4;"
54 "animation: promo-throbbing 2s infinite;}");
55 AppendChild(style_);
56
57 animation_ = new MediaControlButtonPromoAnimation(controls);
58 AppendChild(animation_);
59
60 arrow_ = new MediaControlButtonPromoArrow(controls);
61 AppendChild(arrow_);
62 text_ = new MediaControlButtonPromoText(controls, button_type, promo_text);
63 AppendChild(text_);
64 }
65
66 DEFINE_TRACE(MediaControlButtonPromoContainer) {
67 visitor->Trace(animation_);
68 visitor->Trace(arrow_);
69 visitor->Trace(text_);
70 visitor->Trace(style_);
71 MediaControlDivElement::Trace(visitor);
72 }
73
74 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698