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

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

Issue 298093004: Eliminate MediaPlayer & MediaPlayerClient abstractions(play/pause, other APIs) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixed review comments 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
« no previous file with comments | « Source/web/WebMediaPlayerClientImpl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 #if OS(ANDROID) 199 #if OS(ANDROID)
200 m_usePaintOnAndroid = (loadType != WebMediaPlayer::LoadTypeMediaStream); 200 m_usePaintOnAndroid = (loadType != WebMediaPlayer::LoadTypeMediaStream);
201 #endif 201 #endif
202 202
203 // Tell WebMediaPlayer about any connected CDM (may be null). 203 // Tell WebMediaPlayer about any connected CDM (may be null).
204 m_webMediaPlayer->setContentDecryptionModule(HTMLMediaElementEncryptedMedia: :contentDecryptionModule(mediaElement())); 204 m_webMediaPlayer->setContentDecryptionModule(HTMLMediaElementEncryptedMedia: :contentDecryptionModule(mediaElement()));
205 m_webMediaPlayer->load(loadType, kurl, corsMode); 205 m_webMediaPlayer->load(loadType, kurl, corsMode);
206 } 206 }
207 207
208 void WebMediaPlayerClientImpl::play()
209 {
210 if (m_webMediaPlayer)
211 m_webMediaPlayer->play();
212 }
213
214 void WebMediaPlayerClientImpl::pause()
215 {
216 if (m_webMediaPlayer)
217 m_webMediaPlayer->pause();
218 }
219
220 double WebMediaPlayerClientImpl::duration() const 208 double WebMediaPlayerClientImpl::duration() const
221 { 209 {
222 if (m_webMediaPlayer) 210 if (m_webMediaPlayer)
223 return m_webMediaPlayer->duration(); 211 return m_webMediaPlayer->duration();
224 return 0.0; 212 return 0.0;
225 } 213 }
226 214
227 double WebMediaPlayerClientImpl::currentTime() const 215 double WebMediaPlayerClientImpl::currentTime() const
228 { 216 {
229 if (m_webMediaPlayer) 217 if (m_webMediaPlayer)
(...skipping 19 matching lines...) Expand all
249 return m_rate; 237 return m_rate;
250 } 238 }
251 239
252 void WebMediaPlayerClientImpl::setRate(double rate) 240 void WebMediaPlayerClientImpl::setRate(double rate)
253 { 241 {
254 m_rate = rate; 242 m_rate = rate;
255 if (m_webMediaPlayer) 243 if (m_webMediaPlayer)
256 m_webMediaPlayer->setRate(rate); 244 m_webMediaPlayer->setRate(rate);
257 } 245 }
258 246
259 bool WebMediaPlayerClientImpl::paused() const
260 {
261 if (m_webMediaPlayer)
262 return m_webMediaPlayer->paused();
263 return false;
264 }
265
266 bool WebMediaPlayerClientImpl::supportsSave() const
267 {
268 if (m_webMediaPlayer)
269 return m_webMediaPlayer->supportsSave();
270 return false;
271 }
272
273 void WebMediaPlayerClientImpl::setPoster(const KURL& poster) 247 void WebMediaPlayerClientImpl::setPoster(const KURL& poster)
274 { 248 {
275 if (m_webMediaPlayer) 249 if (m_webMediaPlayer)
276 m_webMediaPlayer->setPoster(WebURL(poster)); 250 m_webMediaPlayer->setPoster(WebURL(poster));
277 } 251 }
278 252
279 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const 253 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const
280 { 254 {
281 if (m_webMediaPlayer) 255 if (m_webMediaPlayer)
282 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkS tate()); 256 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkS tate());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 313 }
340 314
341 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload) 315 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload)
342 { 316 {
343 m_preload = preload; 317 m_preload = preload;
344 318
345 if (m_webMediaPlayer) 319 if (m_webMediaPlayer)
346 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa d)); 320 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa d));
347 } 321 }
348 322
349 bool WebMediaPlayerClientImpl::hasSingleSecurityOrigin() const
350 {
351 if (m_webMediaPlayer)
352 return m_webMediaPlayer->hasSingleSecurityOrigin();
353 return false;
354 }
355
356 double WebMediaPlayerClientImpl::mediaTimeForTimeValue(double timeValue) const
357 {
358 if (m_webMediaPlayer)
359 return m_webMediaPlayer->mediaTimeForTimeValue(timeValue);
360 return timeValue;
361 }
362
363 #if ENABLE(WEB_AUDIO) 323 #if ENABLE(WEB_AUDIO)
364 AudioSourceProvider* WebMediaPlayerClientImpl::audioSourceProvider() 324 AudioSourceProvider* WebMediaPlayerClientImpl::audioSourceProvider()
365 { 325 {
366 return &m_audioSourceProvider; 326 return &m_audioSourceProvider;
367 } 327 }
368 #endif 328 #endif
369 329
370 PassOwnPtr<MediaPlayer> WebMediaPlayerClientImpl::create(MediaPlayerClient* clie nt) 330 PassOwnPtr<MediaPlayer> WebMediaPlayerClientImpl::create(MediaPlayerClient* clie nt)
371 { 331 {
372 return adoptPtr(new WebMediaPlayerClientImpl(client)); 332 return adoptPtr(new WebMediaPlayerClientImpl(client));
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 434
475 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate) 435 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate)
476 { 436 {
477 if (m_client) 437 if (m_client)
478 m_client->setFormat(numberOfChannels, sampleRate); 438 m_client->setFormat(numberOfChannels, sampleRate);
479 } 439 }
480 440
481 #endif 441 #endif
482 442
483 } // namespace blink 443 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebMediaPlayerClientImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698