OLD | NEW |
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 class MediaControlOverlayEnclosureElement; | 49 class MediaControlOverlayEnclosureElement; |
50 class MediaControlOverlayPlayButtonElement; | 50 class MediaControlOverlayPlayButtonElement; |
51 class MediaControlPanelElement; | 51 class MediaControlPanelElement; |
52 class MediaControlPanelEnclosureElement; | 52 class MediaControlPanelEnclosureElement; |
53 class MediaControlPlayButtonElement; | 53 class MediaControlPlayButtonElement; |
54 class MediaControlRemainingTimeDisplayElement; | 54 class MediaControlRemainingTimeDisplayElement; |
55 class MediaControlTextTrackListElement; | 55 class MediaControlTextTrackListElement; |
56 class MediaControlTimelineElement; | 56 class MediaControlTimelineElement; |
57 class MediaControlToggleClosedCaptionsButtonElement; | 57 class MediaControlToggleClosedCaptionsButtonElement; |
58 class MediaControlVolumeSliderElement; | 58 class MediaControlVolumeSliderElement; |
| 59 class MediaDownloadInProductHelpManager; |
59 class ShadowRoot; | 60 class ShadowRoot; |
60 | 61 |
61 // Default implementation of the core/ MediaControls interface used by | 62 // Default implementation of the core/ MediaControls interface used by |
62 // HTMLMediaElement. | 63 // HTMLMediaElement. |
63 class MODULES_EXPORT MediaControlsImpl final : public HTMLDivElement, | 64 class MODULES_EXPORT MediaControlsImpl final : public HTMLDivElement, |
64 public MediaControls { | 65 public MediaControls { |
65 USING_GARBAGE_COLLECTED_MIXIN(MediaControlsImpl); | 66 USING_GARBAGE_COLLECTED_MIXIN(MediaControlsImpl); |
66 WTF_MAKE_NONCOPYABLE(MediaControlsImpl); | 67 WTF_MAKE_NONCOPYABLE(MediaControlsImpl); |
67 | 68 |
68 public: | 69 public: |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 void ToggleOverflowMenu(); | 110 void ToggleOverflowMenu(); |
110 bool OverflowMenuVisible(); | 111 bool OverflowMenuVisible(); |
111 | 112 |
112 void ShowOverlayCastButtonIfNeeded(); | 113 void ShowOverlayCastButtonIfNeeded(); |
113 | 114 |
114 // Methods call by the scrubber. | 115 // Methods call by the scrubber. |
115 void BeginScrubbing(); | 116 void BeginScrubbing(); |
116 void EndScrubbing(); | 117 void EndScrubbing(); |
117 void UpdateCurrentTimeDisplay(); | 118 void UpdateCurrentTimeDisplay(); |
118 | 119 |
| 120 // Methods used for Download In-product help. |
| 121 const MediaControlDownloadButtonElement& DownloadButton() const; |
| 122 void DidDismissDownloadInProductHelp(); |
| 123 MediaDownloadInProductHelpManager* DownloadInProductHelp(); |
| 124 |
119 DECLARE_VIRTUAL_TRACE(); | 125 DECLARE_VIRTUAL_TRACE(); |
120 | 126 |
121 private: | 127 private: |
122 // MediaControlsMediaEventListener is a component that is listening to events | 128 // MediaControlsMediaEventListener is a component that is listening to events |
123 // and calling the appropriate callback on MediaControlsImpl. The object is | 129 // and calling the appropriate callback on MediaControlsImpl. The object is |
124 // split from MedaiControlsImpl to reduce boilerplate and ease reading. In | 130 // split from MedaiControlsImpl to reduce boilerplate and ease reading. In |
125 // order to not expose accessors only for this component, a friendship is | 131 // order to not expose accessors only for this component, a friendship is |
126 // declared. | 132 // declared. |
127 friend class MediaControlsMediaEventListener; | 133 friend class MediaControlsMediaEventListener; |
128 // Same as above but handles the menus hiding when the window is interacted | 134 // Same as above but handles the menus hiding when the window is interacted |
129 // with, allowing MediaControlsImpl to not have the boilerplate. | 135 // with, allowing MediaControlsImpl to not have the boilerplate. |
130 friend class MediaControlsWindowEventListener; | 136 friend class MediaControlsWindowEventListener; |
131 | 137 |
132 // For tests. | 138 // For tests. |
133 friend class MediaControlsOrientationLockDelegateTest; | 139 friend class MediaControlsOrientationLockDelegateTest; |
134 friend class MediaControlsOrientationLockAndRotateToFullscreenDelegateTest; | 140 friend class MediaControlsOrientationLockAndRotateToFullscreenDelegateTest; |
135 friend class MediaControlsRotateToFullscreenDelegateTest; | 141 friend class MediaControlsRotateToFullscreenDelegateTest; |
136 friend class MediaControlsImplTest; | 142 friend class MediaControlsImplTest; |
| 143 friend class MediaControlsImplInProductHelpTest; |
137 | 144 |
138 // Need to be members of MediaControls for private member access. | 145 // Need to be members of MediaControls for private member access. |
139 class BatchedControlUpdate; | 146 class BatchedControlUpdate; |
140 class MediaControlsResizeObserverDelegate; | 147 class MediaControlsResizeObserverDelegate; |
141 class MediaElementMutationCallback; | 148 class MediaElementMutationCallback; |
142 | 149 |
143 void Invalidate(Element*); | 150 void Invalidate(Element*); |
144 | 151 |
145 // Notify us that our controls enclosure has changed size. | 152 // Notify us that our controls enclosure has changed size. |
146 void NotifyElementSizeChanged(DOMRectReadOnly* new_size); | 153 void NotifyElementSizeChanged(DOMRectReadOnly* new_size); |
(...skipping 11 matching lines...) Expand all Loading... |
158 enum HideBehaviorFlags { | 165 enum HideBehaviorFlags { |
159 kIgnoreNone = 0, | 166 kIgnoreNone = 0, |
160 kIgnoreVideoHover = 1 << 0, | 167 kIgnoreVideoHover = 1 << 0, |
161 kIgnoreFocus = 1 << 1, | 168 kIgnoreFocus = 1 << 1, |
162 kIgnoreControlsHover = 1 << 2, | 169 kIgnoreControlsHover = 1 << 2, |
163 kIgnoreWaitForTimer = 1 << 3, | 170 kIgnoreWaitForTimer = 1 << 3, |
164 }; | 171 }; |
165 | 172 |
166 bool ShouldHideMediaControls(unsigned behavior_flags = 0) const; | 173 bool ShouldHideMediaControls(unsigned behavior_flags = 0) const; |
167 void HideMediaControlsTimerFired(TimerBase*); | 174 void HideMediaControlsTimerFired(TimerBase*); |
| 175 void StartHideMediaControlsIfNecessary(); |
168 void StartHideMediaControlsTimer(); | 176 void StartHideMediaControlsTimer(); |
169 void StopHideMediaControlsTimer(); | 177 void StopHideMediaControlsTimer(); |
170 void ResetHideMediaControlsTimer(); | 178 void ResetHideMediaControlsTimer(); |
171 | 179 |
172 void ElementSizeChangedTimerFired(TimerBase*); | 180 void ElementSizeChangedTimerFired(TimerBase*); |
173 | 181 |
174 void HideAllMenus(); | 182 void HideAllMenus(); |
175 | 183 |
176 // Hide elements that don't fit, and show those things that we want which | 184 // Hide elements that don't fit, and show those things that we want which |
177 // do fit. This requires that m_effectiveWidth and m_effectiveHeight are | 185 // do fit. This requires that m_effectiveWidth and m_effectiveHeight are |
(...skipping 21 matching lines...) Expand all Loading... |
199 void OnPause(); | 207 void OnPause(); |
200 void OnTextTracksAddedOrRemoved(); | 208 void OnTextTracksAddedOrRemoved(); |
201 void OnTextTracksChanged(); | 209 void OnTextTracksChanged(); |
202 void OnError(); | 210 void OnError(); |
203 void OnLoadedMetadata(); | 211 void OnLoadedMetadata(); |
204 void OnEnteredFullscreen(); | 212 void OnEnteredFullscreen(); |
205 void OnExitedFullscreen(); | 213 void OnExitedFullscreen(); |
206 void OnPanelKeypress(); | 214 void OnPanelKeypress(); |
207 void OnMediaKeyboardEvent(Event* event) { DefaultEventHandler(event); } | 215 void OnMediaKeyboardEvent(Event* event) { DefaultEventHandler(event); } |
208 | 216 |
| 217 void CreateDownloadInProductHelp(); |
| 218 |
209 // Media control elements. | 219 // Media control elements. |
210 Member<MediaControlOverlayEnclosureElement> overlay_enclosure_; | 220 Member<MediaControlOverlayEnclosureElement> overlay_enclosure_; |
211 Member<MediaControlOverlayPlayButtonElement> overlay_play_button_; | 221 Member<MediaControlOverlayPlayButtonElement> overlay_play_button_; |
212 Member<MediaControlCastButtonElement> overlay_cast_button_; | 222 Member<MediaControlCastButtonElement> overlay_cast_button_; |
213 Member<MediaControlPanelEnclosureElement> enclosure_; | 223 Member<MediaControlPanelEnclosureElement> enclosure_; |
214 Member<MediaControlPanelElement> panel_; | 224 Member<MediaControlPanelElement> panel_; |
215 Member<MediaControlPlayButtonElement> play_button_; | 225 Member<MediaControlPlayButtonElement> play_button_; |
216 Member<MediaControlTimelineElement> timeline_; | 226 Member<MediaControlTimelineElement> timeline_; |
217 Member<MediaControlCurrentTimeDisplayElement> current_time_display_; | 227 Member<MediaControlCurrentTimeDisplayElement> current_time_display_; |
218 Member<MediaControlRemainingTimeDisplayElement> duration_display_; | 228 Member<MediaControlRemainingTimeDisplayElement> duration_display_; |
(...skipping 25 matching lines...) Expand all Loading... |
244 Member<ResizeObserver> resize_observer_; | 254 Member<ResizeObserver> resize_observer_; |
245 | 255 |
246 // Watches the media element for attribute changes and updates media controls | 256 // Watches the media element for attribute changes and updates media controls |
247 // as necessary. | 257 // as necessary. |
248 Member<MediaElementMutationCallback> element_mutation_callback_; | 258 Member<MediaElementMutationCallback> element_mutation_callback_; |
249 | 259 |
250 TaskRunnerTimer<MediaControlsImpl> element_size_changed_timer_; | 260 TaskRunnerTimer<MediaControlsImpl> element_size_changed_timer_; |
251 IntSize size_; | 261 IntSize size_; |
252 | 262 |
253 bool keep_showing_until_timer_fires_ : 1; | 263 bool keep_showing_until_timer_fires_ : 1; |
| 264 |
| 265 Member<MediaDownloadInProductHelpManager> download_iph_manager_; |
254 }; | 266 }; |
255 | 267 |
256 DEFINE_ELEMENT_TYPE_CASTS(MediaControlsImpl, IsMediaControls()); | 268 DEFINE_ELEMENT_TYPE_CASTS(MediaControlsImpl, IsMediaControls()); |
257 | 269 |
258 } // namespace blink | 270 } // namespace blink |
259 | 271 |
260 #endif | 272 #endif |
OLD | NEW |