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

Side by Side Diff: third_party/WebKit/Source/modules/media_controls/elements/MediaControlDownloadButtonElement.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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/media_controls/elements/MediaControlDownloadButtonElement.h" 5 #include "modules/media_controls/elements/MediaControlDownloadButtonElement.h"
6 6
7 #include "core/InputTypeNames.h" 7 #include "core/InputTypeNames.h"
8 #include "core/events/Event.h" 8 #include "core/events/Event.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/html/HTMLAnchorElement.h" 10 #include "core/html/HTMLAnchorElement.h"
11 #include "core/html/HTMLMediaElement.h" 11 #include "core/html/HTMLMediaElement.h"
12 #include "core/html/media/HTMLMediaElementControlsList.h" 12 #include "core/html/media/HTMLMediaElementControlsList.h"
13 #include "core/html/media/HTMLMediaSource.h" 13 #include "core/html/media/HTMLMediaSource.h"
14 #include "core/page/Page.h" 14 #include "core/page/Page.h"
15 #include "modules/media_controls/MediaControlsImpl.h" 15 #include "modules/media_controls/MediaControlsImpl.h"
16 #include "platform/Histogram.h" 16 #include "platform/Histogram.h"
17 #include "public/platform/Platform.h" 17 #include "public/platform/Platform.h"
18 18
19 namespace blink { 19 namespace blink {
20 20
21 MediaControlDownloadButtonContainer::MediaControlDownloadButtonContainer(
22 MediaControlsImpl& controls)
23 : MediaControlDivElement(controls, kMediaDownloadButtonContainer) {
24 SetShadowPseudoId(
25 AtomicString("-internal-media-controls-download-button-container"));
26 }
27
28 bool MediaControlDownloadButtonContainer::KeepEventInNode(Event* event) {
29 return MediaControlElementsHelper::IsUserInteractionEvent(event);
30 }
31
21 MediaControlDownloadButtonElement::MediaControlDownloadButtonElement( 32 MediaControlDownloadButtonElement::MediaControlDownloadButtonElement(
22 MediaControlsImpl& media_controls) 33 MediaControlsImpl& media_controls)
23 : MediaControlInputElement(media_controls, kMediaDownloadButton) { 34 : MediaControlInputElement(media_controls, kMediaDownloadButton) {
24 EnsureUserAgentShadowRoot(); 35 EnsureUserAgentShadowRoot();
25 setType(InputTypeNames::button); 36 setType(InputTypeNames::button);
26 SetShadowPseudoId(AtomicString("-internal-media-controls-download-button")); 37 SetShadowPseudoId(AtomicString("-internal-media-controls-download-button"));
27 SetIsWanted(false); 38 SetIsWanted(false);
28 } 39 }
29 40
30 bool MediaControlDownloadButtonElement::ShouldDisplayDownloadButton() { 41 bool MediaControlDownloadButtonElement::ShouldDisplayDownloadButton() {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 137
127 void MediaControlDownloadButtonElement::RecordMetrics( 138 void MediaControlDownloadButtonElement::RecordMetrics(
128 DownloadActionMetrics metric) { 139 DownloadActionMetrics metric) {
129 DEFINE_STATIC_LOCAL(EnumerationHistogram, download_action_histogram, 140 DEFINE_STATIC_LOCAL(EnumerationHistogram, download_action_histogram,
130 ("Media.Controls.Download", 141 ("Media.Controls.Download",
131 static_cast<int>(DownloadActionMetrics::kCount))); 142 static_cast<int>(DownloadActionMetrics::kCount)));
132 download_action_histogram.Count(static_cast<int>(metric)); 143 download_action_histogram.Count(static_cast<int>(metric));
133 } 144 }
134 145
135 } // namespace blink 146 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698