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

Side by Side Diff: Source/web/WebMediaPlayerClientImpl.cpp

Issue 306123003: Eliminate MediaPlayer & MediaPlayerClient abstractions(seek, duration, poster APIs) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include "config.h" 5 #include "config.h"
6 #include "web/WebMediaPlayerClientImpl.h" 6 #include "web/WebMediaPlayerClientImpl.h"
7 7
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "core/html/HTMLMediaElement.h" 9 #include "core/html/HTMLMediaElement.h"
10 #include "core/html/TimeRanges.h" 10 #include "core/html/TimeRanges.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 if (m_webMediaPlayer) 210 if (m_webMediaPlayer)
211 m_webMediaPlayer->play(); 211 m_webMediaPlayer->play();
212 } 212 }
213 213
214 void WebMediaPlayerClientImpl::pause() 214 void WebMediaPlayerClientImpl::pause()
215 { 215 {
216 if (m_webMediaPlayer) 216 if (m_webMediaPlayer)
217 m_webMediaPlayer->pause(); 217 m_webMediaPlayer->pause();
218 } 218 }
219 219
220 double WebMediaPlayerClientImpl::duration() const
221 {
222 if (m_webMediaPlayer)
223 return m_webMediaPlayer->duration();
224 return 0.0;
225 }
226
227 double WebMediaPlayerClientImpl::currentTime() const
228 {
229 if (m_webMediaPlayer)
230 return m_webMediaPlayer->currentTime();
231 return 0.0;
232 }
233
234 void WebMediaPlayerClientImpl::seek(double time)
235 {
236 if (m_webMediaPlayer)
237 m_webMediaPlayer->seek(time);
238 }
239
240 bool WebMediaPlayerClientImpl::seeking() const
241 {
242 if (m_webMediaPlayer)
243 return m_webMediaPlayer->seeking();
244 return false;
245 }
246
247 double WebMediaPlayerClientImpl::rate() const 220 double WebMediaPlayerClientImpl::rate() const
248 { 221 {
249 return m_rate; 222 return m_rate;
250 } 223 }
251 224
252 void WebMediaPlayerClientImpl::setRate(double rate) 225 void WebMediaPlayerClientImpl::setRate(double rate)
253 { 226 {
254 m_rate = rate; 227 m_rate = rate;
255 if (m_webMediaPlayer) 228 if (m_webMediaPlayer)
256 m_webMediaPlayer->setRate(rate); 229 m_webMediaPlayer->setRate(rate);
257 } 230 }
258 231
259 bool WebMediaPlayerClientImpl::paused() const 232 bool WebMediaPlayerClientImpl::paused() const
260 { 233 {
261 if (m_webMediaPlayer) 234 if (m_webMediaPlayer)
262 return m_webMediaPlayer->paused(); 235 return m_webMediaPlayer->paused();
263 return false; 236 return false;
264 } 237 }
265 238
266 bool WebMediaPlayerClientImpl::supportsSave() const 239 bool WebMediaPlayerClientImpl::supportsSave() const
267 { 240 {
268 if (m_webMediaPlayer) 241 if (m_webMediaPlayer)
269 return m_webMediaPlayer->supportsSave(); 242 return m_webMediaPlayer->supportsSave();
270 return false; 243 return false;
271 } 244 }
272 245
273 void WebMediaPlayerClientImpl::setPoster(const KURL& poster)
274 {
275 if (m_webMediaPlayer)
276 m_webMediaPlayer->setPoster(WebURL(poster));
277 }
278
279 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const 246 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const
280 { 247 {
281 if (m_webMediaPlayer) 248 if (m_webMediaPlayer)
282 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkS tate()); 249 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkS tate());
283 return MediaPlayer::Empty; 250 return MediaPlayer::Empty;
284 } 251 }
285 252
286 MediaPlayer::ReadyState WebMediaPlayerClientImpl::readyState() const 253 MediaPlayer::ReadyState WebMediaPlayerClientImpl::readyState() const
287 { 254 {
288 if (m_webMediaPlayer) 255 if (m_webMediaPlayer)
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 441
475 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate) 442 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate)
476 { 443 {
477 if (m_client) 444 if (m_client)
478 m_client->setFormat(numberOfChannels, sampleRate); 445 m_client->setFormat(numberOfChannels, sampleRate);
479 } 446 }
480 447
481 #endif 448 #endif
482 449
483 } // namespace blink 450 } // namespace blink
OLDNEW
« Source/core/html/HTMLMediaElement.cpp ('K') | « Source/web/WebMediaPlayerClientImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698