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