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

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

Issue 2782373002: Remove MediaControls methods needed for the Cast button (Closed)
Patch Set: Fixed more tests Created 3 years, 7 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 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 // Shows/hides the button. Overridden for UMA tracking.
20 // This MUST be called for cast button elements that are overlay elements. 20 void SetIsWanted(bool) override;
21 void TryShowOverlay();
22
23 void SetIsPlayingRemotely(bool);
24 21
25 // MediaControlInputElement overrides. 22 // MediaControlInputElement overrides.
26 bool WillRespondToMouseClickEvents() override; 23 bool WillRespondToMouseClickEvents() override;
27 WebLocalizedString::Name GetOverflowStringName() override; 24 WebLocalizedString::Name GetOverflowStringName() override;
28 bool HasOverflowButton() override; 25 bool HasOverflowButton() override;
29 26
30 private: 27 private:
28 friend class MediaControlsImpl;
29
31 // This is used for UMA histogram (Cast.Sender.Overlay). New values should 30 // This is used for UMA histogram (Cast.Sender.Overlay). New values should
32 // be appended only and must be added before |Count|. 31 // be appended only and must be added before |Count|.
33 enum class CastOverlayMetrics { 32 enum class CastOverlayMetrics {
34 kCreated = 0, 33 kCreated = 0,
35 kShown, 34 kShown,
36 kClicked, 35 kClicked,
37 kCount // Keep last. 36 kCount // Keep last.
38 }; 37 };
39 38
40 void DefaultEventHandler(Event*) override; 39 void DefaultEventHandler(Event*) override;
41 bool KeepEventInNode(Event*) override; 40 bool KeepEventInNode(Event*) override;
42 41
42 // Whether the media element is being played remotely at the moment.
43 bool IsPlayingRemotely() const;
44
45 // Returns the element currently layed out under the center of the button.
46 Element* UnderlyingElement();
47
48 // Updates the way the button is displayed (connected or not, overlay or not).
49 void UpdateDisplayType();
50
51 // Returns true if the button can be shown at the moment it's called.
52 // Not const for implementation reasons.
53 bool ShouldShow();
54
43 void RecordMetrics(CastOverlayMetrics); 55 void RecordMetrics(CastOverlayMetrics);
44 56
45 bool is_overlay_button_; 57 bool is_overlay_button_;
46 58
47 // UMA related boolean. They are used to prevent counting something twice 59 // UMA related boolean. They are used to prevent counting something twice
48 // for the same media element. 60 // for the same media element.
49 bool click_use_counted_ = false; 61 bool click_use_counted_ = false;
50 bool show_use_counted_ = false; 62 bool show_use_counted_ = false;
51 }; 63 };
52 64
53 } // namespace blink 65 } // namespace blink
54 66
55 #endif // MediaControlCastButtonElement_h 67 #endif // MediaControlCastButtonElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698