| OLD | NEW |
| (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 #ifndef MediaControlDownloadButtonElement_h |
| 6 #define MediaControlDownloadButtonElement_h |
| 7 |
| 8 #include "core/html/shadow/MediaControlElementTypes.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 class Event; |
| 13 class MediaControlsImpl; |
| 14 |
| 15 class MediaControlDownloadButtonElement final |
| 16 : public MediaControlInputElement { |
| 17 public: |
| 18 explicit MediaControlDownloadButtonElement(MediaControlsImpl&); |
| 19 |
| 20 // Returns true if the download button should be shown. We should |
| 21 // show the button for only non-MSE, non-EME, and non-MediaStream content. |
| 22 bool ShouldDisplayDownloadButton(); |
| 23 |
| 24 // MediaControlInputElement overrides. |
| 25 // TODO(mlamouri): add WillRespondToMouseClickEvents |
| 26 WebLocalizedString::Name GetOverflowStringName() override; |
| 27 bool HasOverflowButton() override; |
| 28 void SetIsWanted(bool) override; |
| 29 |
| 30 DECLARE_VIRTUAL_TRACE(); |
| 31 |
| 32 private: |
| 33 // This is used for UMA histogram (Media.Controls.Download). New values should |
| 34 // be appended only and must be added before |Count|. |
| 35 enum class DownloadActionMetrics { |
| 36 kShown = 0, |
| 37 kClicked, |
| 38 kCount // Keep last. |
| 39 }; |
| 40 |
| 41 void DefaultEventHandler(Event*) override; |
| 42 |
| 43 void RecordMetrics(DownloadActionMetrics); |
| 44 |
| 45 // Points to an anchor element that contains the URL of the media file. |
| 46 Member<HTMLAnchorElement> anchor_; |
| 47 |
| 48 // UMA related boolean. They are used to prevent counting something twice |
| 49 // for the same media element. |
| 50 bool click_use_counted_ = false; |
| 51 bool show_use_counted_ = false; |
| 52 }; |
| 53 |
| 54 } // namespace blink |
| 55 |
| 56 #endif // MediaControlDownloadButtonElement_h |
| OLD | NEW |