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

Side by Side Diff: Source/core/html/shadow/MediaControls.h

Issue 1156993013: New media playback UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixed some tests from previous CL. Created 5 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 /* 1 /*
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 void changedClosedCaptionsVisibility(); 60 void changedClosedCaptionsVisibility();
61 void refreshClosedCaptionsButtonVisibility(); 61 void refreshClosedCaptionsButtonVisibility();
62 62
63 void enteredFullscreen(); 63 void enteredFullscreen();
64 void exitedFullscreen(); 64 void exitedFullscreen();
65 65
66 void startedCasting(); 66 void startedCasting();
67 void stoppedCasting(); 67 void stoppedCasting();
68 void refreshCastButtonVisibility(); 68 void refreshCastButtonVisibility();
69 void showOverlayCastButton(); 69 void showOverlayCastButton();
70 void hideCastButtons();
philipj_slow 2015/07/09 08:56:11 Ought this not be equivalent to refreshCastButtonV
liberato (no reviews please) 2015/07/09 22:35:35 i originally had it that way, but decided that it
philipj_slow 2015/07/10 14:51:58 Acknowledged.
70 71
71 void mediaElementFocused(); 72 void mediaElementFocused();
72 73
73 // Returns the layout object for the part of the controls that should be 74 // Returns the layout object for the part of the controls that should be
74 // used for overlap checking during text track layout. May be null. 75 // used for overlap checking during text track layout. May be null.
75 LayoutObject* layoutObjectForTextTrackLayout(); 76 LayoutObject* layoutObjectForTextTrackLayout();
76 77
78 // Notify us that our controls enclosure has changed width.
79 void notifyPanelWidthChanged(int panelWidth);
80
77 DECLARE_VIRTUAL_TRACE(); 81 DECLARE_VIRTUAL_TRACE();
78 82
79 private: 83 private:
80 explicit MediaControls(HTMLMediaElement&); 84 explicit MediaControls(HTMLMediaElement&);
81 85
82 void initializeControls(); 86 void initializeControls();
83 87
84 void makeOpaque(); 88 void makeOpaque();
85 void makeTransparent(); 89 void makeTransparent();
86 90
87 void updatePlayState(); 91 void updatePlayState();
88 92
89 enum HideBehaviorFlags { 93 enum HideBehaviorFlags {
90 IgnoreNone = 0, 94 IgnoreNone = 0,
91 IgnoreVideoHover = 1 << 0, 95 IgnoreVideoHover = 1 << 0,
92 IgnoreFocus = 1 << 1, 96 IgnoreFocus = 1 << 1,
93 IgnoreControlsHover = 1 << 2 97 IgnoreControlsHover = 1 << 2
94 }; 98 };
95 99
96 bool shouldHideMediaControls(unsigned behaviorFlags = 0) const; 100 bool shouldHideMediaControls(unsigned behaviorFlags = 0) const;
97 void hideMediaControlsTimerFired(Timer<MediaControls>*); 101 void hideMediaControlsTimerFired(Timer<MediaControls>*);
98 void startHideMediaControlsTimer(); 102 void startHideMediaControlsTimer();
99 void stopHideMediaControlsTimer(); 103 void stopHideMediaControlsTimer();
100 void resetHideMediaControlsTimer(); 104 void resetHideMediaControlsTimer();
101 105
102 // Attempts to show the overlay cast button. If it is covered by another 106 // Attempts to show the overlay cast button. If it is covered by another
103 // element in the page, it will be hidden. 107 // element in the page, it will be hidden.
104 void tryShowOverlayCastButton(); 108 void tryShowOverlayCastButton();
105 109
110 // After changing the want / don't want state of one or more controls,
111 // call this to recompute what's visible.
112 void changedControlSelections();
113
114 void panelWidthChangedTimerFired(Timer<MediaControls>*);
115
116 // For the new UI, hide elements that don't fit, and show those things
philipj_slow 2015/07/09 08:56:11 Remove "For the new UI" or it's sure to be left in
liberato (no reviews please) 2015/07/09 22:35:35 Done.
117 // that we want that do fit.
118 void computeWhichControlsFit(int panelWidth);
119
120 // Update cast button visibility, but don't try to update our panel
121 // button visibility for space.
122 void refreshCastButtonVisibilityWithoutUpdate();
123
106 // Node 124 // Node
107 bool isMediaControls() const override { return true; } 125 bool isMediaControls() const override { return true; }
108 bool willRespondToMouseMoveEvents() override { return true; } 126 bool willRespondToMouseMoveEvents() override { return true; }
109 void defaultEventHandler(Event*) override; 127 void defaultEventHandler(Event*) override;
110 bool containsRelatedTarget(Event*); 128 bool containsRelatedTarget(Event*);
111 129
112 RawPtrWillBeMember<HTMLMediaElement> m_mediaElement; 130 RawPtrWillBeMember<HTMLMediaElement> m_mediaElement;
113 131
114 // Media control elements. 132 // Media control elements.
115 RawPtrWillBeMember<MediaControlOverlayEnclosureElement> m_overlayEnclosure; 133 RawPtrWillBeMember<MediaControlOverlayEnclosureElement> m_overlayEnclosure;
116 RawPtrWillBeMember<MediaControlOverlayPlayButtonElement> m_overlayPlayButton ; 134 RawPtrWillBeMember<MediaControlOverlayPlayButtonElement> m_overlayPlayButton ;
117 RawPtrWillBeMember<MediaControlCastButtonElement> m_overlayCastButton; 135 RawPtrWillBeMember<MediaControlCastButtonElement> m_overlayCastButton;
118 RawPtrWillBeMember<MediaControlPanelEnclosureElement> m_enclosure; 136 RawPtrWillBeMember<MediaControlPanelEnclosureElement> m_enclosure;
119 RawPtrWillBeMember<MediaControlPanelElement> m_panel; 137 RawPtrWillBeMember<MediaControlPanelElement> m_panel;
120 RawPtrWillBeMember<MediaControlPlayButtonElement> m_playButton; 138 RawPtrWillBeMember<MediaControlPlayButtonElement> m_playButton;
121 RawPtrWillBeMember<MediaControlTimelineElement> m_timeline; 139 RawPtrWillBeMember<MediaControlTimelineElement> m_timeline;
122 RawPtrWillBeMember<MediaControlCurrentTimeDisplayElement> m_currentTimeDispl ay; 140 RawPtrWillBeMember<MediaControlCurrentTimeDisplayElement> m_currentTimeDispl ay;
123 RawPtrWillBeMember<MediaControlTimeRemainingDisplayElement> m_durationDispla y; 141 RawPtrWillBeMember<MediaControlTimeRemainingDisplayElement> m_durationDispla y;
124 RawPtrWillBeMember<MediaControlMuteButtonElement> m_muteButton; 142 RawPtrWillBeMember<MediaControlMuteButtonElement> m_muteButton;
125 RawPtrWillBeMember<MediaControlVolumeSliderElement> m_volumeSlider; 143 RawPtrWillBeMember<MediaControlVolumeSliderElement> m_volumeSlider;
126 RawPtrWillBeMember<MediaControlToggleClosedCaptionsButtonElement> m_toggleCl osedCaptionsButton; 144 RawPtrWillBeMember<MediaControlToggleClosedCaptionsButtonElement> m_toggleCl osedCaptionsButton;
127 RawPtrWillBeMember<MediaControlCastButtonElement> m_castButton; 145 RawPtrWillBeMember<MediaControlCastButtonElement> m_castButton;
128 RawPtrWillBeMember<MediaControlFullscreenButtonElement> m_fullScreenButton; 146 RawPtrWillBeMember<MediaControlFullscreenButtonElement> m_fullScreenButton;
129 147
130 Timer<MediaControls> m_hideMediaControlsTimer; 148 Timer<MediaControls> m_hideMediaControlsTimer;
131 unsigned m_hideTimerBehaviorFlags; 149 unsigned m_hideTimerBehaviorFlags;
132 bool m_isMouseOverControls : 1; 150 bool m_isMouseOverControls : 1;
133 bool m_isPausedForScrubbing : 1; 151 bool m_isPausedForScrubbing : 1;
152
153 Timer<MediaControls> m_panelWidthChangedTimer;
154 int m_panelWidth;
134 }; 155 };
135 156
136 DEFINE_ELEMENT_TYPE_CASTS(MediaControls, isMediaControls()); 157 DEFINE_ELEMENT_TYPE_CASTS(MediaControls, isMediaControls());
137 158
138 } 159 }
139 160
140 #endif 161 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698