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

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

Issue 2943983003: chrome/blink: Add functionality for in-product help for media elements. (Closed)
Patch Set: mounir's comments. 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 #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
11 #include "public/platform/media_download_in_product_help.mojom-blink.h"
12
10 namespace blink { 13 namespace blink {
11 14
12 class Event; 15 class Event;
13 class MediaControlsImpl; 16 class MediaControlsImpl;
14 17
15 class MediaControlDownloadButtonElement final 18 class MODULES_EXPORT MediaControlDownloadButtonElement final
16 : public MediaControlInputElement { 19 : public MediaControlInputElement {
17 public: 20 public:
18 explicit MediaControlDownloadButtonElement(MediaControlsImpl&); 21 explicit MediaControlDownloadButtonElement(MediaControlsImpl&);
19 22
20 // Returns true if the download button should be shown. We should 23 // 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. 24 // show the button for only non-MSE, non-EME, and non-MediaStream content.
22 bool ShouldDisplayDownloadButton(); 25 bool ShouldDisplayDownloadButton();
23 26
27 void DismissInProductHelp();
28 void MaybeDispatchInProductHelpTrigger();
29 bool IsShowingInProductHelp() const;
30
24 // MediaControlInputElement overrides. 31 // MediaControlInputElement overrides.
25 // TODO(mlamouri): add WillRespondToMouseClickEvents 32 // TODO(mlamouri): add WillRespondToMouseClickEvents
26 WebLocalizedString::Name GetOverflowStringName() const override; 33 WebLocalizedString::Name GetOverflowStringName() const override;
27 bool HasOverflowButton() const override; 34 bool HasOverflowButton() const override;
28 void SetIsWanted(bool) override; 35 void SetIsWanted(bool) override;
29 36
30 DECLARE_VIRTUAL_TRACE(); 37 DECLARE_VIRTUAL_TRACE();
31 38
32 private: 39 private:
33 // This is used for UMA histogram (Media.Controls.Download). New values should 40 // This is used for UMA histogram (Media.Controls.Download). New values should
34 // be appended only and must be added before |Count|. 41 // be appended only and must be added before |Count|.
35 enum class DownloadActionMetrics { 42 enum class DownloadActionMetrics {
36 kShown = 0, 43 kShown = 0,
37 kClicked, 44 kClicked,
38 kCount // Keep last. 45 kCount // Keep last.
39 }; 46 };
40 47
41 void DefaultEventHandler(Event*) override; 48 void DefaultEventHandler(Event*) override;
42 49
43 void RecordMetrics(DownloadActionMetrics); 50 void RecordMetrics(DownloadActionMetrics);
44 51
45 // Points to an anchor element that contains the URL of the media file. 52 // Points to an anchor element that contains the URL of the media file.
46 Member<HTMLAnchorElement> anchor_; 53 Member<HTMLAnchorElement> anchor_;
47 54
48 // UMA related boolean. They are used to prevent counting something twice 55 // UMA related boolean. They are used to prevent counting something twice
49 // for the same media element. 56 // for the same media element.
50 bool click_use_counted_ = false; 57 bool click_use_counted_ = false;
51 bool show_use_counted_ = false; 58 bool show_use_counted_ = false;
59
60 std::unique_ptr<mojom::blink::MediaDownloadInProductHelpPtr>
61 media_in_product_help_;
62 bool media_download_in_product_trigger_observed_ = false;
52 }; 63 };
53 64
54 } // namespace blink 65 } // namespace blink
55 66
56 #endif // MediaControlDownloadButtonElement_h 67 #endif // MediaControlDownloadButtonElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698