| Index: content/renderer/pepper/content_decryptor_delegate.cc
|
| diff --git a/content/renderer/pepper/content_decryptor_delegate.cc b/content/renderer/pepper/content_decryptor_delegate.cc
|
| index 039f040465ce4c64b75eab20a83e97b0fb6f9901..8626d30869f89b0051db2e49e0ef23a60d1a1818 100644
|
| --- a/content/renderer/pepper/content_decryptor_delegate.cc
|
| +++ b/content/renderer/pepper/content_decryptor_delegate.cc
|
| @@ -257,11 +257,12 @@ media::SampleFormat PpDecryptedSampleFormatToMediaSampleFormat(
|
|
|
| PP_SessionType MediaSessionTypeToPpSessionType(
|
| MediaKeys::SessionType session_type) {
|
| + // TODO(jrummell): Add support for PP_SESSIONTYPE_RELEASE_LICENSE.
|
| switch (session_type) {
|
| case MediaKeys::TEMPORARY_SESSION:
|
| return PP_SESSIONTYPE_TEMPORARY;
|
| case MediaKeys::PERSISTENT_SESSION:
|
| - return PP_SESSIONTYPE_PERSISTENT;
|
| + return PP_SESSIONTYPE_PERSISTENT_LICENSE;
|
| default:
|
| NOTREACHED();
|
| return PP_SESSIONTYPE_TEMPORARY;
|
| @@ -321,6 +322,7 @@ ContentDecryptorDelegate::~ContentDecryptorDelegate() {
|
| SatisfyAllPendingCallbacksOnError();
|
| }
|
|
|
| +// TODO(jrummell): Remove |session_ready_cb| and |session_keys_change_cb|.
|
| void ContentDecryptorDelegate::Initialize(
|
| const std::string& key_system,
|
| const media::SessionMessageCB& session_message_cb,
|
| @@ -371,6 +373,8 @@ void ContentDecryptorDelegate::SetServerCertificate(
|
| pp_instance_, promise_id, certificate_array);
|
| }
|
|
|
| +// TODO(jrummell): Rename method to CreateSessionAndGenerateRequest()
|
| +// and reorder parameter list.
|
| void ContentDecryptorDelegate::CreateSession(
|
| const std::string& init_data_type,
|
| const uint8* init_data,
|
| @@ -381,20 +385,19 @@ void ContentDecryptorDelegate::CreateSession(
|
| PP_Var init_data_array =
|
| PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
|
| init_data_length, init_data);
|
| - plugin_decryption_interface_->CreateSession(
|
| - pp_instance_,
|
| - promise_id,
|
| - StringVar::StringToPPVar(init_data_type),
|
| - init_data_array,
|
| - MediaSessionTypeToPpSessionType(session_type));
|
| + plugin_decryption_interface_->CreateSessionAndGenerateRequest(
|
| + pp_instance_, promise_id, MediaSessionTypeToPpSessionType(session_type),
|
| + StringVar::StringToPPVar(init_data_type), init_data_array);
|
| }
|
|
|
| +// TODO(jrummell): Pass |session_type| to this method.
|
| void ContentDecryptorDelegate::LoadSession(
|
| const std::string& web_session_id,
|
| scoped_ptr<NewSessionCdmPromise> promise) {
|
| uint32_t promise_id = SavePromise(promise.Pass());
|
| plugin_decryption_interface_->LoadSession(
|
| - pp_instance_, promise_id, StringVar::StringToPPVar(web_session_id));
|
| + pp_instance_, promise_id, PP_SESSIONTYPE_PERSISTENT_LICENSE,
|
| + StringVar::StringToPPVar(web_session_id));
|
| }
|
|
|
| void ContentDecryptorDelegate::UpdateSession(
|
| @@ -441,18 +444,11 @@ void ContentDecryptorDelegate::RemoveSession(
|
| pp_instance_, promise_id, StringVar::StringToPPVar(web_session_id));
|
| }
|
|
|
| +// TODO(jrummell): Remove this method.
|
| void ContentDecryptorDelegate::GetUsableKeyIds(
|
| const std::string& web_session_id,
|
| scoped_ptr<media::KeyIdsPromise> promise) {
|
| - if (web_session_id.length() > media::limits::kMaxWebSessionIdLength) {
|
| - promise->reject(
|
| - media::MediaKeys::INVALID_ACCESS_ERROR, 0, "Incorrect session.");
|
| - return;
|
| - }
|
| -
|
| - uint32_t promise_id = SavePromise(promise.Pass());
|
| - plugin_decryption_interface_->GetUsableKeyIds(
|
| - pp_instance_, promise_id, StringVar::StringToPPVar(web_session_id));
|
| + NOTREACHED();
|
| }
|
|
|
| // TODO(xhwang): Remove duplication of code in Decrypt(),
|
| @@ -729,43 +725,6 @@ void ContentDecryptorDelegate::OnPromiseResolvedWithSession(
|
| session_promise->resolve(web_session_id_string->value());
|
| }
|
|
|
| -void ContentDecryptorDelegate::OnPromiseResolvedWithKeyIds(
|
| - uint32 promise_id,
|
| - PP_Var key_ids_array) {
|
| - scoped_ptr<CdmPromise> promise = TakePromise(promise_id);
|
| -
|
| - ArrayVar* key_ids = ArrayVar::FromPPVar(key_ids_array);
|
| - DCHECK(key_ids && key_ids->GetLength() <= media::limits::kMaxKeyIds);
|
| - media::KeyIdsVector key_ids_vector;
|
| - if (key_ids && key_ids->GetLength() <= media::limits::kMaxKeyIds) {
|
| - for (size_t i = 0; i < key_ids->GetLength(); ++i) {
|
| - ArrayBufferVar* array_buffer = ArrayBufferVar::FromPPVar(key_ids->Get(i));
|
| -
|
| - if (!array_buffer ||
|
| - array_buffer->ByteLength() < media::limits::kMinKeyIdLength ||
|
| - array_buffer->ByteLength() > media::limits::kMaxKeyIdLength) {
|
| - NOTREACHED();
|
| - continue;
|
| - }
|
| -
|
| - std::vector<uint8> key_id;
|
| - const uint8* data = static_cast<const uint8*>(array_buffer->Map());
|
| - key_id.assign(data, data + array_buffer->ByteLength());
|
| - key_ids_vector.push_back(key_id);
|
| - }
|
| - }
|
| -
|
| - if (!promise ||
|
| - promise->GetResolveParameterType() !=
|
| - media::CdmPromise::KEY_IDS_VECTOR_TYPE) {
|
| - NOTREACHED();
|
| - return;
|
| - }
|
| -
|
| - KeyIdsPromise* key_ids_promise(static_cast<KeyIdsPromise*>(promise.get()));
|
| - key_ids_promise->resolve(key_ids_vector);
|
| -}
|
| -
|
| void ContentDecryptorDelegate::OnPromiseRejected(
|
| uint32 promise_id,
|
| PP_CdmExceptionCode exception_code,
|
| @@ -785,9 +744,10 @@ void ContentDecryptorDelegate::OnPromiseRejected(
|
| }
|
| }
|
|
|
| +// TODO(jrummell): Pass |message_type| to the callback.
|
| void ContentDecryptorDelegate::OnSessionMessage(PP_Var web_session_id,
|
| - PP_Var message,
|
| - PP_Var destination_url) {
|
| + PP_MessageType message_type,
|
| + PP_Var message) {
|
| if (session_message_cb_.is_null())
|
| return;
|
|
|
| @@ -801,23 +761,15 @@ void ContentDecryptorDelegate::OnSessionMessage(PP_Var web_session_id,
|
| message_vector.assign(data, data + message_array_buffer->ByteLength());
|
| }
|
|
|
| - StringVar* destination_url_string = StringVar::FromPPVar(destination_url);
|
| - DCHECK(destination_url_string);
|
| -
|
| - GURL verified_gurl = GURL(destination_url_string->value());
|
| - if (!verified_gurl.is_valid() && !verified_gurl.is_empty()) {
|
| - DLOG(WARNING) << "SessionMessage default_url is invalid : "
|
| - << verified_gurl.possibly_invalid_spec();
|
| - verified_gurl = GURL::EmptyGURL(); // Replace invalid destination_url.
|
| - }
|
| -
|
| - session_message_cb_.Run(
|
| - web_session_id_string->value(), message_vector, verified_gurl);
|
| + session_message_cb_.Run(web_session_id_string->value(), message_vector,
|
| + GURL::EmptyGURL());
|
| }
|
|
|
| +// TODO(jrummell): Decode |key_information| and pass it to the callback.
|
| void ContentDecryptorDelegate::OnSessionKeysChange(
|
| PP_Var web_session_id,
|
| - PP_Bool has_additional_usable_key) {
|
| + PP_Bool has_additional_usable_key,
|
| + PP_Var key_information) {
|
| if (session_keys_change_cb_.is_null())
|
| return;
|
|
|
| @@ -841,16 +793,6 @@ void ContentDecryptorDelegate::OnSessionExpirationChange(
|
| ppapi::PPTimeToTime(new_expiry_time));
|
| }
|
|
|
| -void ContentDecryptorDelegate::OnSessionReady(PP_Var web_session_id) {
|
| - if (session_ready_cb_.is_null())
|
| - return;
|
| -
|
| - StringVar* web_session_id_string = StringVar::FromPPVar(web_session_id);
|
| - DCHECK(web_session_id_string);
|
| -
|
| - session_ready_cb_.Run(web_session_id_string->value());
|
| -}
|
| -
|
| void ContentDecryptorDelegate::OnSessionClosed(PP_Var web_session_id) {
|
| if (session_closed_cb_.is_null())
|
| return;
|
|
|