Chromium Code Reviews| Index: webkit/media/android/webmediaplayer_android.cc |
| diff --git a/webkit/media/android/webmediaplayer_android.cc b/webkit/media/android/webmediaplayer_android.cc |
| index 5a49c907449c0aad24794c57163aa7d047e5bdcc..3d4c09c265ac6dd276f6bc5d48c41c22d49cbb97 100644 |
| --- a/webkit/media/android/webmediaplayer_android.cc |
| +++ b/webkit/media/android/webmediaplayer_android.cc |
| @@ -101,34 +101,56 @@ void WebMediaPlayerAndroid::load(const WebURL& url, CORSMode cors_mode) { |
| void WebMediaPlayerAndroid::load(const WebURL& url, |
| WebMediaSource* media_source, |
| CORSMode cors_mode) { |
| - if (cors_mode != CORSModeUnspecified) |
| - NOTIMPLEMENTED() << "No CORS support"; |
| - |
| if (media_source) { |
| media_source_delegate_.reset( |
| new MediaSourceDelegate( |
| frame_, client_, proxy_, player_id_, media_log_)); |
| + } |
| + |
| + url_ = url; |
| + pending_media_source_.reset(media_source); |
|
qinmin
2013/06/03 16:55:59
if you split MSE/non-MSE load() call, you don't ne
Sami
2013/06/03 17:12:56
Sorry, I don't know what MSE stands for :) Do you
|
| + |
| + info_loader_.reset( |
|
qinmin
2013/06/03 16:55:59
I don't think CORS is needed for MSE.
You might w
Sami
2013/06/03 17:12:56
Done.
|
| + new MediaInfoLoaderAndroid( |
| + url_, |
| + cors_mode, |
| + base::Bind(&WebMediaPlayerAndroid::DidLoadMediaInfo, |
| + base::Unretained(this)))); |
|
qinmin
2013/06/03 16:55:59
nit: indent
Sami
2013/06/03 17:12:56
Done.
|
| + info_loader_->Start(frame_); |
| + |
| + UpdateNetworkState(WebMediaPlayer::NetworkStateLoading); |
| + UpdateReadyState(WebMediaPlayer::ReadyStateHaveNothing); |
| +} |
| + |
| +void WebMediaPlayerAndroid::DidLoadMediaInfo( |
| + MediaInfoLoaderAndroid::Status status) { |
| + if (status == MediaInfoLoaderAndroid::kFailed) { |
| + info_loader_.reset(); |
| + media_source_delegate_.reset(); |
| + pending_media_source_.reset(); |
| + return; |
| + } |
| + |
| + bool is_media_source = pending_media_source_; |
| + if (pending_media_source_) { |
| // |media_source_delegate_| is owned, so Unretained() is safe here. |
| media_source_delegate_->Initialize( |
| - media_source, |
| + pending_media_source_.release(), |
| base::Bind(&WebMediaPlayerAndroid::UpdateNetworkState, |
| base::Unretained(this))); |
| } |
| - url_ = url; |
| GURL first_party_url = frame_->document().firstPartyForCookies(); |
| if (proxy_) { |
| - proxy_->Initialize(player_id_, url_, media_source != NULL, first_party_url); |
| + proxy_->Initialize(player_id_, url_, is_media_source, first_party_url); |
| if (manager_->IsInFullscreen(frame_)) |
| proxy_->EnterFullscreen(player_id_); |
| } |
| - |
| - UpdateNetworkState(WebMediaPlayer::NetworkStateLoading); |
| - UpdateReadyState(WebMediaPlayer::ReadyStateHaveNothing); |
| } |
| void WebMediaPlayerAndroid::cancelLoad() { |
| - NOTIMPLEMENTED(); |
| + pending_media_source_.reset(); |
| + info_loader_.reset(); |
| } |
| void WebMediaPlayerAndroid::play() { |
| @@ -322,14 +344,14 @@ bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture( |
| } |
| bool WebMediaPlayerAndroid::hasSingleSecurityOrigin() const { |
| - // TODO(qinmin): fix this for urls that are not file. |
| - // https://code.google.com/p/chromium/issues/detail?id=234710 |
| - if (url_.SchemeIsFile()) |
| - return true; |
| + if (info_loader_) |
| + return info_loader_->HasSingleOrigin(); |
| return false; |
| } |
| bool WebMediaPlayerAndroid::didPassCORSAccessCheck() const { |
| + if (info_loader_) |
| + return info_loader_->DidPassCORSAccessCheck(); |
| return false; |
| } |