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

Side by Side Diff: third_party/WebKit/Source/modules/media_controls/elements/MediaControlDownloadButtonElement.cpp

Issue 2943983003: chrome/blink: Add functionality for in-product help for media elements. (Closed)
Patch Set: tests Created 3 years, 5 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"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 bool MediaControlDownloadButtonElement::HasOverflowButton() { 84 bool MediaControlDownloadButtonElement::HasOverflowButton() {
85 return true; 85 return true;
86 } 86 }
87 87
88 void MediaControlDownloadButtonElement::SetIsWanted(bool wanted) { 88 void MediaControlDownloadButtonElement::SetIsWanted(bool wanted) {
89 MediaControlElement::SetIsWanted(wanted); 89 MediaControlElement::SetIsWanted(wanted);
90 90
91 if (!IsWanted()) 91 if (!IsWanted())
92 return; 92 return;
93 93
94 DCHECK(IsWanted());
95 if (!show_use_counted_) { 94 if (!show_use_counted_) {
96 show_use_counted_ = true; 95 show_use_counted_ = true;
97 RecordMetrics(DownloadActionMetrics::kShown); 96 RecordMetrics(DownloadActionMetrics::kShown);
98 } 97 }
98
99 // If the button is wanted, show IPH if possible.
100 static_cast<MediaControlsImpl&>(GetMediaControls())
101 .MaybeDispatchDownloadIPHTrigger();
99 } 102 }
100 103
101 DEFINE_TRACE(MediaControlDownloadButtonElement) { 104 DEFINE_TRACE(MediaControlDownloadButtonElement) {
102 visitor->Trace(anchor_); 105 visitor->Trace(anchor_);
103 MediaControlInputElement::Trace(visitor); 106 MediaControlInputElement::Trace(visitor);
104 } 107 }
105 108
106 void MediaControlDownloadButtonElement::DefaultEventHandler(Event* event) { 109 void MediaControlDownloadButtonElement::DefaultEventHandler(Event* event) {
107 const KURL& url = MediaElement().currentSrc(); 110 const KURL& url = MediaElement().currentSrc();
108 if (event->type() == EventTypeNames::click && 111 if (event->type() == EventTypeNames::click &&
(...skipping 17 matching lines...) Expand all
126 129
127 void MediaControlDownloadButtonElement::RecordMetrics( 130 void MediaControlDownloadButtonElement::RecordMetrics(
128 DownloadActionMetrics metric) { 131 DownloadActionMetrics metric) {
129 DEFINE_STATIC_LOCAL(EnumerationHistogram, download_action_histogram, 132 DEFINE_STATIC_LOCAL(EnumerationHistogram, download_action_histogram,
130 ("Media.Controls.Download", 133 ("Media.Controls.Download",
131 static_cast<int>(DownloadActionMetrics::kCount))); 134 static_cast<int>(DownloadActionMetrics::kCount)));
132 download_action_histogram.Count(static_cast<int>(metric)); 135 download_action_histogram.Count(static_cast<int>(metric));
133 } 136 }
134 137
135 } // namespace blink 138 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698