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 "core/html/shadow/MediaControlElementTypes.h" | 8 #include "core/html/shadow/MediaControlElementTypes.h" |
| 9 #include "public/platform/media_in_product_help.mojom-blink.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 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 |
| 25 void UpdateInProductHelpState(); |
| 26 void MaybeDispatchInProductHelpTrigger(); |
| 27 bool IsShowingInProductHelp() const; |
| 28 |
24 // MediaControlInputElement overrides. | 29 // MediaControlInputElement overrides. |
25 // TODO(mlamouri): add WillRespondToMouseClickEvents | 30 // TODO(mlamouri): add WillRespondToMouseClickEvents |
26 WebLocalizedString::Name GetOverflowStringName() override; | 31 WebLocalizedString::Name GetOverflowStringName() override; |
27 bool HasOverflowButton() override; | 32 bool HasOverflowButton() override; |
28 void SetIsWanted(bool) override; | 33 void SetIsWanted(bool) override; |
29 | 34 |
30 DECLARE_VIRTUAL_TRACE(); | 35 DECLARE_VIRTUAL_TRACE(); |
31 | 36 |
32 private: | 37 private: |
33 // This is used for UMA histogram (Media.Controls.Download). New values should | 38 // This is used for UMA histogram (Media.Controls.Download). New values should |
34 // be appended only and must be added before |Count|. | 39 // be appended only and must be added before |Count|. |
35 enum class DownloadActionMetrics { | 40 enum class DownloadActionMetrics { |
36 kShown = 0, | 41 kShown = 0, |
37 kClicked, | 42 kClicked, |
38 kCount // Keep last. | 43 kCount // Keep last. |
39 }; | 44 }; |
40 | 45 |
41 void DefaultEventHandler(Event*) override; | 46 void DefaultEventHandler(Event*) override; |
42 | 47 |
43 void RecordMetrics(DownloadActionMetrics); | 48 void RecordMetrics(DownloadActionMetrics); |
| 49 void DismissDownloadInProductHelp(); |
44 | 50 |
45 // Points to an anchor element that contains the URL of the media file. | 51 // Points to an anchor element that contains the URL of the media file. |
46 Member<HTMLAnchorElement> anchor_; | 52 Member<HTMLAnchorElement> anchor_; |
47 | 53 |
48 // UMA related boolean. They are used to prevent counting something twice | 54 // UMA related boolean. They are used to prevent counting something twice |
49 // for the same media element. | 55 // for the same media element. |
50 bool click_use_counted_ = false; | 56 bool click_use_counted_ = false; |
51 bool show_use_counted_ = false; | 57 bool show_use_counted_ = false; |
| 58 |
| 59 std::unique_ptr<mojom::blink::MediaInProductHelpPtr> media_in_product_help_; |
| 60 bool media_download_in_product_trigger_observed_ = false; |
52 }; | 61 }; |
53 | 62 |
54 } // namespace blink | 63 } // namespace blink |
55 | 64 |
56 #endif // MediaControlDownloadButtonElement_h | 65 #endif // MediaControlDownloadButtonElement_h |
OLD | NEW |