| OLD | NEW |
| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 void WebMediaPlayerClientImpl::durationChanged() | 99 void WebMediaPlayerClientImpl::durationChanged() |
| 100 { | 100 { |
| 101 m_client->mediaPlayerDurationChanged(); | 101 m_client->mediaPlayerDurationChanged(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void WebMediaPlayerClientImpl::sizeChanged() | 104 void WebMediaPlayerClientImpl::sizeChanged() |
| 105 { | 105 { |
| 106 m_client->mediaPlayerSizeChanged(); | 106 m_client->mediaPlayerSizeChanged(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 double WebMediaPlayerClientImpl::volume() const | |
| 110 { | |
| 111 return mediaElement().effectiveMediaVolume(); | |
| 112 } | |
| 113 | |
| 114 void WebMediaPlayerClientImpl::playbackStateChanged() | 109 void WebMediaPlayerClientImpl::playbackStateChanged() |
| 115 { | 110 { |
| 116 m_client->mediaPlayerPlaybackStateChanged(); | 111 m_client->mediaPlayerPlaybackStateChanged(); |
| 117 } | 112 } |
| 118 | 113 |
| 119 WebMediaPlayer::Preload WebMediaPlayerClientImpl::preload() const | |
| 120 { | |
| 121 return static_cast<WebMediaPlayer::Preload>(m_preload); | |
| 122 } | |
| 123 | |
| 124 void WebMediaPlayerClientImpl::keyAdded(const WebString& keySystem, const WebStr
ing& sessionId) | 114 void WebMediaPlayerClientImpl::keyAdded(const WebString& keySystem, const WebStr
ing& sessionId) |
| 125 { | 115 { |
| 126 HTMLMediaElementEncryptedMedia::keyAdded(mediaElement(), keySystem, sessionI
d); | 116 HTMLMediaElementEncryptedMedia::keyAdded(mediaElement(), keySystem, sessionI
d); |
| 127 } | 117 } |
| 128 | 118 |
| 129 void WebMediaPlayerClientImpl::keyError(const WebString& keySystem, const WebStr
ing& sessionId, MediaKeyErrorCode errorCode, unsigned short systemCode) | 119 void WebMediaPlayerClientImpl::keyError(const WebString& keySystem, const WebStr
ing& sessionId, MediaKeyErrorCode errorCode, unsigned short systemCode) |
| 130 { | 120 { |
| 131 HTMLMediaElementEncryptedMedia::keyError(mediaElement(), keySystem, sessionI
d, errorCode, systemCode); | 121 HTMLMediaElementEncryptedMedia::keyError(mediaElement(), keySystem, sessionI
d, errorCode, systemCode); |
| 132 } | 122 } |
| 133 | 123 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 206 |
| 217 m_webMediaPlayer->setPoster(poster); | 207 m_webMediaPlayer->setPoster(poster); |
| 218 | 208 |
| 219 // Tell WebMediaPlayer about any connected CDM (may be null). | 209 // Tell WebMediaPlayer about any connected CDM (may be null). |
| 220 m_webMediaPlayer->setContentDecryptionModule(HTMLMediaElementEncryptedMedia:
:contentDecryptionModule(mediaElement())); | 210 m_webMediaPlayer->setContentDecryptionModule(HTMLMediaElementEncryptedMedia:
:contentDecryptionModule(mediaElement())); |
| 221 m_webMediaPlayer->load(loadType, kurl, corsMode); | 211 m_webMediaPlayer->load(loadType, kurl, corsMode); |
| 222 } | 212 } |
| 223 | 213 |
| 224 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload) | 214 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload) |
| 225 { | 215 { |
| 226 m_preload = preload; | |
| 227 | |
| 228 if (m_webMediaPlayer) | 216 if (m_webMediaPlayer) |
| 229 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa
d)); | 217 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa
d)); |
| 230 } | 218 } |
| 231 | 219 |
| 232 #if ENABLE(WEB_AUDIO) | 220 #if ENABLE(WEB_AUDIO) |
| 233 AudioSourceProvider* WebMediaPlayerClientImpl::audioSourceProvider() | 221 AudioSourceProvider* WebMediaPlayerClientImpl::audioSourceProvider() |
| 234 { | 222 { |
| 235 return &m_audioSourceProvider; | 223 return &m_audioSourceProvider; |
| 236 } | 224 } |
| 237 #endif | 225 #endif |
| 238 | 226 |
| 239 PassOwnPtr<MediaPlayer> WebMediaPlayerClientImpl::create(MediaPlayerClient* clie
nt) | 227 PassOwnPtr<MediaPlayer> WebMediaPlayerClientImpl::create(MediaPlayerClient* clie
nt) |
| 240 { | 228 { |
| 241 return adoptPtr(new WebMediaPlayerClientImpl(client)); | 229 return adoptPtr(new WebMediaPlayerClientImpl(client)); |
| 242 } | 230 } |
| 243 | 231 |
| 244 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl(MediaPlayerClient* client) | 232 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl(MediaPlayerClient* client) |
| 245 : m_client(client) | 233 : m_client(client) |
| 246 , m_preload(MediaPlayer::Auto) | |
| 247 { | 234 { |
| 248 ASSERT(m_client); | 235 ASSERT(m_client); |
| 249 } | 236 } |
| 250 | 237 |
| 251 blink::HTMLMediaElement& WebMediaPlayerClientImpl::mediaElement() const | 238 blink::HTMLMediaElement& WebMediaPlayerClientImpl::mediaElement() const |
| 252 { | 239 { |
| 253 return *static_cast<HTMLMediaElement*>(m_client); | 240 return *static_cast<HTMLMediaElement*>(m_client); |
| 254 } | 241 } |
| 255 | 242 |
| 256 #if ENABLE(WEB_AUDIO) | 243 #if ENABLE(WEB_AUDIO) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 } | 294 } |
| 308 | 295 |
| 309 void WebMediaPlayerClientImpl::AudioClientImpl::trace(Visitor* visitor) | 296 void WebMediaPlayerClientImpl::AudioClientImpl::trace(Visitor* visitor) |
| 310 { | 297 { |
| 311 visitor->trace(m_client); | 298 visitor->trace(m_client); |
| 312 } | 299 } |
| 313 | 300 |
| 314 #endif | 301 #endif |
| 315 | 302 |
| 316 } // namespace blink | 303 } // namespace blink |
| OLD | NEW |