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

Unified Diff: third_party/WebKit/Source/modules/media_controls/elements/MediaControlDownloadButtonElement.h

Issue 2813103006: Media Controls: move last buttons to modules/. (Closed)
Patch Set: 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/modules/media_controls/elements/MediaControlDownloadButtonElement.h
diff --git a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlDownloadButtonElement.h b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlDownloadButtonElement.h
new file mode 100644
index 0000000000000000000000000000000000000000..da1f7e08f9f7f6a3100155d5584ace7ce67f5ca9
--- /dev/null
+++ b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlDownloadButtonElement.h
@@ -0,0 +1,56 @@
+// 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.
+
+#ifndef MediaControlDownloadButtonElement_h
+#define MediaControlDownloadButtonElement_h
+
+#include "core/html/shadow/MediaControlElementTypes.h"
+
+namespace blink {
+
+class Event;
+class MediaControlsImpl;
+
+class MediaControlDownloadButtonElement final
+ : public MediaControlInputElement {
+ public:
+ explicit MediaControlDownloadButtonElement(MediaControlsImpl&);
+
+ // Returns true if the download button should be shown. We should
+ // show the button for only non-MSE, non-EME, and non-MediaStream content.
+ bool ShouldDisplayDownloadButton();
+
+ // MediaControlInputElement overrides.
+ // TODO(mlamouri): add WillRespondToMouseClickEvents
+ WebLocalizedString::Name GetOverflowStringName() override;
+ bool HasOverflowButton() override;
+ void SetIsWanted(bool) override;
+
+ DECLARE_VIRTUAL_TRACE();
+
+ private:
+ // This is used for UMA histogram (Media.Controls.Download). New values should
+ // be appended only and must be added before |Count|.
+ enum class DownloadActionMetrics {
+ kShown = 0,
+ kClicked,
+ kCount // Keep last.
+ };
+
+ void DefaultEventHandler(Event*) override;
+
+ void RecordMetrics(DownloadActionMetrics);
+
+ // Points to an anchor element that contains the URL of the media file.
+ Member<HTMLAnchorElement> anchor_;
+
+ // UMA related boolean. They are used to prevent counting something twice
+ // for the same media element.
+ bool click_use_counted_ = false;
+ bool show_use_counted_ = false;
+};
+
+} // namespace blink
+
+#endif // MediaControlDownloadButtonElement_h

Powered by Google App Engine
This is Rietveld 408576698