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

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

Issue 2782373002: Remove MediaControls methods needed for the Cast button (Closed)
Patch Set: Fixed MediaControlsImplTest 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 /* 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 // MediaControls implementation. 78 // MediaControls implementation.
79 void Show() override; 79 void Show() override;
80 void Hide() override; 80 void Hide() override;
81 void Reset() override; 81 void Reset() override;
82 void OnControlsListUpdated() override; 82 void OnControlsListUpdated() override;
83 // TODO(mlamouri): this is temporary to notify the controls that an 83 // TODO(mlamouri): this is temporary to notify the controls that an
84 // HTMLTrackElement failed to load because there is no web exposed way to 84 // HTMLTrackElement failed to load because there is no web exposed way to
85 // be notified on the TextTrack object. See https://crbug.com/669977 85 // be notified on the TextTrack object. See https://crbug.com/669977
86 void OnTrackElementFailedToLoad() override { OnTextTracksAddedOrRemoved(); } 86 void OnTrackElementFailedToLoad() override { OnTextTracksAddedOrRemoved(); }
87 // TODO(mlamouri): the following methods will be able to become private when
88 // the controls have to modules/ and have access to RemotePlayback.
89 void OnRemotePlaybackAvailabilityChanged() override {
90 RefreshCastButtonVisibility();
91 }
92 void OnRemotePlaybackConnecting() override { StartedCasting(); }
93 void OnRemotePlaybackDisconnected() override { StoppedCasting(); }
94 // TODO(mlamouri): this method is needed in order to notify the controls that
95 // the attribute have changed.
96 void OnDisableRemotePlaybackAttributeChanged() override {
97 RefreshCastButtonVisibility();
98 }
99 // Notify us that the media element's network state has changed. 87 // Notify us that the media element's network state has changed.
100 void NetworkStateChanged() override; 88 void NetworkStateChanged() override;
101 LayoutObject* PanelLayoutObject() override; 89 LayoutObject* PanelLayoutObject() override;
102 LayoutObject* ContainerLayoutObject() override; 90 LayoutObject* ContainerLayoutObject() override;
103 // Return the internal elements, which is used by registering clicking 91 // Return the internal elements, which is used by registering clicking
104 // EventHandlers from MediaControlsWindowEventListener. 92 // EventHandlers from MediaControlsWindowEventListener.
105 HTMLDivElement* PanelElement() override; 93 HTMLDivElement* PanelElement() override;
106 // TODO(mlamouri): this method is needed in order to notify the controls that 94 // TODO(mlamouri): this method is needed in order to notify the controls that
107 // the `MediaControlsEnabled` setting has changed. 95 // the `MediaControlsEnabled` setting has changed.
108 void OnMediaControlsEnabledChange() override { 96 void OnMediaControlsEnabledChange() override {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // with, allowing MediaControlsImpl to not have the boilerplate. 132 // with, allowing MediaControlsImpl to not have the boilerplate.
145 friend class MediaControlsWindowEventListener; 133 friend class MediaControlsWindowEventListener;
146 134
147 // For tests. 135 // For tests.
148 friend class MediaControlsOrientationLockDelegateTest; 136 friend class MediaControlsOrientationLockDelegateTest;
149 friend class MediaControlsImplTest; 137 friend class MediaControlsImplTest;
150 138
151 // Need to be members of MediaControls for private member access. 139 // Need to be members of MediaControls for private member access.
152 class BatchedControlUpdate; 140 class BatchedControlUpdate;
153 class MediaControlsResizeObserverCallback; 141 class MediaControlsResizeObserverCallback;
142 class MediaElementMutationCallback;
154 143
155 static MediaControlsImpl* Create(HTMLMediaElement&, ShadowRoot&); 144 static MediaControlsImpl* Create(HTMLMediaElement&, ShadowRoot&);
156 145
157 void Invalidate(Element*); 146 void Invalidate(Element*);
158 147
159 // Notify us that our controls enclosure has changed size. 148 // Notify us that our controls enclosure has changed size.
160 void NotifyElementSizeChanged(ClientRect* new_size); 149 void NotifyElementSizeChanged(ClientRect* new_size);
161 150
162 explicit MediaControlsImpl(HTMLMediaElement&); 151 explicit MediaControlsImpl(HTMLMediaElement&);
163 152
(...skipping 28 matching lines...) Expand all
192 // current. 181 // current.
193 void ComputeWhichControlsFit(); 182 void ComputeWhichControlsFit();
194 183
195 // Node 184 // Node
196 bool IsMediaControls() const override { return true; } 185 bool IsMediaControls() const override { return true; }
197 bool WillRespondToMouseMoveEvents() override { return true; } 186 bool WillRespondToMouseMoveEvents() override { return true; }
198 void DefaultEventHandler(Event*) override; 187 void DefaultEventHandler(Event*) override;
199 bool ContainsRelatedTarget(Event*); 188 bool ContainsRelatedTarget(Event*);
200 189
201 // Internal cast related methods. 190 // Internal cast related methods.
202 void StartedCasting(); 191 void RemotePlaybackStateChanged();
203 void StoppedCasting();
204 void RefreshCastButtonVisibility(); 192 void RefreshCastButtonVisibility();
205 void RefreshCastButtonVisibilityWithoutUpdate(); 193 void RefreshCastButtonVisibilityWithoutUpdate();
206 194
207 // Methods called by MediaControlsMediaEventListener. 195 // Methods called by MediaControlsMediaEventListener.
208 void OnVolumeChange(); 196 void OnVolumeChange();
209 void OnFocusIn(); 197 void OnFocusIn();
210 void OnTimeUpdate(); 198 void OnTimeUpdate();
211 void OnDurationChange(); 199 void OnDurationChange();
212 void OnPlay(); 200 void OnPlay();
213 void OnPlaying(); 201 void OnPlaying();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 236
249 TaskRunnerTimer<MediaControlsImpl> hide_media_controls_timer_; 237 TaskRunnerTimer<MediaControlsImpl> hide_media_controls_timer_;
250 unsigned hide_timer_behavior_flags_; 238 unsigned hide_timer_behavior_flags_;
251 bool is_mouse_over_controls_ : 1; 239 bool is_mouse_over_controls_ : 1;
252 bool is_paused_for_scrubbing_ : 1; 240 bool is_paused_for_scrubbing_ : 1;
253 241
254 // Watches the video element for resize and updates media controls as 242 // Watches the video element for resize and updates media controls as
255 // necessary. 243 // necessary.
256 Member<ResizeObserver> resize_observer_; 244 Member<ResizeObserver> resize_observer_;
257 245
246 // Watches the media element for attribute changes and updates media controls
247 // as necessary.
248 Member<MediaElementMutationCallback> element_mutation_callback_;
249
258 TaskRunnerTimer<MediaControlsImpl> element_size_changed_timer_; 250 TaskRunnerTimer<MediaControlsImpl> element_size_changed_timer_;
259 IntSize size_; 251 IntSize size_;
260 252
261 bool keep_showing_until_timer_fires_ : 1; 253 bool keep_showing_until_timer_fires_ : 1;
262 }; 254 };
263 255
264 DEFINE_ELEMENT_TYPE_CASTS(MediaControlsImpl, IsMediaControls()); 256 DEFINE_ELEMENT_TYPE_CASTS(MediaControlsImpl, IsMediaControls());
265 257
266 } // namespace blink 258 } // namespace blink
267 259
268 #endif 260 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698