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 MediaControlCastButtonElement_h | 5 #ifndef MediaControlCastButtonElement_h |
6 #define MediaControlCastButtonElement_h | 6 #define MediaControlCastButtonElement_h |
7 | 7 |
8 #include "core/html/shadow/MediaControlElementTypes.h" | 8 #include "core/html/shadow/MediaControlElementTypes.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 class Event; | 12 class Event; |
13 class MediaControlsImpl; | 13 class MediaControlsImpl; |
14 | 14 |
15 class MediaControlCastButtonElement final : public MediaControlInputElement { | 15 class MediaControlCastButtonElement final : public MediaControlInputElement { |
16 public: | 16 public: |
17 MediaControlCastButtonElement(MediaControlsImpl&, bool is_overlay_button); | 17 MediaControlCastButtonElement(MediaControlsImpl&, bool is_overlay_button); |
18 | 18 |
19 // This will show a cast button if it is not covered by another element. | 19 // This will show a cast button if it is not covered by another element. |
20 // This MUST be called for cast button elements that are overlay elements. | 20 // This MUST be called for cast button elements that are overlay elements. |
21 void TryShowOverlay(); | 21 void TryShowOverlay(); |
22 | 22 |
23 void SetIsPlayingRemotely(bool); | 23 // TODO(avayvod): replace with the button listening to the state change |
| 24 // events. |
| 25 void UpdateDisplayType(); |
24 | 26 |
25 // MediaControlInputElement overrides. | 27 // MediaControlInputElement overrides. |
26 bool WillRespondToMouseClickEvents() override; | 28 bool WillRespondToMouseClickEvents() override; |
27 WebLocalizedString::Name GetOverflowStringName() override; | 29 WebLocalizedString::Name GetOverflowStringName() override; |
28 bool HasOverflowButton() override; | 30 bool HasOverflowButton() override; |
29 | 31 |
30 private: | 32 private: |
31 // This is used for UMA histogram (Cast.Sender.Overlay). New values should | 33 // This is used for UMA histogram (Cast.Sender.Overlay). New values should |
32 // be appended only and must be added before |Count|. | 34 // be appended only and must be added before |Count|. |
33 enum class CastOverlayMetrics { | 35 enum class CastOverlayMetrics { |
34 kCreated = 0, | 36 kCreated = 0, |
35 kShown, | 37 kShown, |
36 kClicked, | 38 kClicked, |
37 kCount // Keep last. | 39 kCount // Keep last. |
38 }; | 40 }; |
39 | 41 |
40 void DefaultEventHandler(Event*) override; | 42 void DefaultEventHandler(Event*) override; |
41 bool KeepEventInNode(Event*) override; | 43 bool KeepEventInNode(Event*) override; |
42 | 44 |
43 void RecordMetrics(CastOverlayMetrics); | 45 void RecordMetrics(CastOverlayMetrics); |
44 | 46 |
| 47 bool IsPlayingRemotely() const; |
| 48 |
45 bool is_overlay_button_; | 49 bool is_overlay_button_; |
46 | 50 |
47 // UMA related boolean. They are used to prevent counting something twice | 51 // UMA related boolean. They are used to prevent counting something twice |
48 // for the same media element. | 52 // for the same media element. |
49 bool click_use_counted_ = false; | 53 bool click_use_counted_ = false; |
50 bool show_use_counted_ = false; | 54 bool show_use_counted_ = false; |
51 }; | 55 }; |
52 | 56 |
53 } // namespace blink | 57 } // namespace blink |
54 | 58 |
55 #endif // MediaControlCastButtonElement_h | 59 #endif // MediaControlCastButtonElement_h |
OLD | NEW |