Chromium Code Reviews| Index: media/blink/encrypted_media_player_support.cc |
| diff --git a/media/blink/encrypted_media_player_support.cc b/media/blink/encrypted_media_player_support.cc |
| index cc11a2e50413d8b6cc5c1427da0ba36a88b0677d..119cc067915d9711a6a555bfa197008796d4bf0e 100644 |
| --- a/media/blink/encrypted_media_player_support.cc |
| +++ b/media/blink/encrypted_media_player_support.cc |
| @@ -18,11 +18,13 @@ |
| #include "media/blink/webcontentdecryptionmodule_impl.h" |
| #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h" |
| #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" |
| +#include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient.h" |
| #include "third_party/WebKit/public/web/WebDocument.h" |
| #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| using blink::WebMediaPlayer; |
| using blink::WebMediaPlayerClient; |
| +using blink::WebMediaPlayerEncryptedMediaClient; |
| using blink::WebString; |
| namespace media { |
| @@ -114,11 +116,13 @@ static EmeInitDataType GuessInitDataType(const unsigned char* init_data, |
| EncryptedMediaPlayerSupport::EncryptedMediaPlayerSupport( |
| CdmFactory* cdm_factory, |
| - blink::WebMediaPlayerClient* client, |
| + WebMediaPlayerClient* client, |
|
ddorwin
2015/05/26 21:43:07
I don't understand why we're passing this in.
If
Srirama
2015/05/27 14:48:50
To move encrypted related functions from WebMediaP
|
| + WebMediaPlayerEncryptedMediaClient* encrypted_client, |
| MediaPermission* media_permission, |
| const CdmContextReadyCB& cdm_context_ready_cb) |
| : cdm_factory_(cdm_factory), |
| client_(client), |
| + encrypted_client_(encrypted_client), |
| media_permission_(media_permission), |
| init_data_type_(EmeInitDataType::UNKNOWN), |
| cdm_context_ready_cb_(cdm_context_ready_cb) { |
| @@ -285,6 +289,10 @@ void EncryptedMediaPlayerSupport::OnKeyAdded(const std::string& session_id) { |
| client_->keyAdded( |
|
ddorwin
2015/05/26 21:43:07
This would result in two events if the encrypted_c
Srirama
2015/05/27 14:48:50
The client_ event will be dummy as i have kept emp
|
| WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)), |
| WebString::fromUTF8(session_id)); |
| + if (encrypted_client_) |
| + encrypted_client_->keyAdded( |
| + WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)), |
| + WebString::fromUTF8(session_id)); |
| } |
| void EncryptedMediaPlayerSupport::OnKeyError(const std::string& session_id, |
| @@ -306,6 +314,13 @@ void EncryptedMediaPlayerSupport::OnKeyError(const std::string& session_id, |
| WebString::fromUTF8(session_id), |
| static_cast<WebMediaPlayerClient::MediaKeyErrorCode>(error_code), |
| short_system_code); |
| + if (encrypted_client_) |
| + encrypted_client_->keyError( |
| + WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)), |
| + WebString::fromUTF8(session_id), |
| + static_cast<WebMediaPlayerEncryptedMediaClient::MediaKeyErrorCode>( |
| + error_code), |
| + short_system_code); |
| } |
| void EncryptedMediaPlayerSupport::OnKeyMessage( |
| @@ -320,6 +335,11 @@ void EncryptedMediaPlayerSupport::OnKeyMessage( |
| message.empty() ? NULL : &message[0], |
| base::saturated_cast<unsigned int>(message.size()), |
| destination_url); |
| + if (encrypted_client_) |
| + encrypted_client_->keyMessage( |
| + WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)), |
| + WebString::fromUTF8(session_id), message.empty() ? NULL : &message[0], |
| + base::saturated_cast<unsigned int>(message.size()), destination_url); |
| } |
| } // namespace media |