summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp
diff options
context:
space:
mode:
authorjrummell <jrummell@chromium.org>2015-01-08 14:35:43 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-08 22:36:50 +0000
commita68c98fe5d09235cdfff39176964e10ac2074a6b (patch)
tree76a322aac7228e577ec7520918f0fe543f6433c4 /ppapi/cpp
parent2e8ed92e162ff1684b4f97fc7a9bbdaa2d78451b (diff)
downloadchromium_src-a68c98fe5d09235cdfff39176964e10ac2074a6b.zip
chromium_src-a68c98fe5d09235cdfff39176964e10ac2074a6b.tar.gz
chromium_src-a68c98fe5d09235cdfff39176964e10ac2074a6b.tar.bz2
Changes to support CDM_7
Add support for CDM_7 and update Pepper to support the updated interface. Changes: - Rename CreateSession() to CreateSessionAndGenerateRequest() with reordered parameter list. - Add |session_type| to LoadSession(). - OnSessionMessage() adds |message_type|, removes |destination_url|. - OnSessionKeysChange() adds |key_information|. - Remove GetUsableKeyIds() - Remove OnPromiseResolvedWithKeyIds() - Remove OnSessionReady(). BUG=428384 TEST=existing EME test cases pass Review URL: https://codereview.chromium.org/811923002 Cr-Commit-Position: refs/heads/master@{#310615}
Diffstat (limited to 'ppapi/cpp')
-rw-r--r--ppapi/cpp/private/content_decryptor_private.cc87
-rw-r--r--ppapi/cpp/private/content_decryptor_private.h23
2 files changed, 31 insertions, 79 deletions
diff --git a/ppapi/cpp/private/content_decryptor_private.cc b/ppapi/cpp/private/content_decryptor_private.cc
index 65f822c..d64d502 100644
--- a/ppapi/cpp/private/content_decryptor_private.cc
+++ b/ppapi/cpp/private/content_decryptor_private.cc
@@ -56,11 +56,11 @@ void SetServerCertificate(PP_Instance instance,
->SetServerCertificate(promise_id, server_certificate);
}
-void CreateSession(PP_Instance instance,
- uint32_t promise_id,
- PP_Var init_data_type_arg,
- PP_Var init_data_arg,
- PP_SessionType session_type) {
+void CreateSessionAndGenerateRequest(PP_Instance instance,
+ uint32_t promise_id,
+ PP_SessionType session_type,
+ PP_Var init_data_type_arg,
+ PP_Var init_data_arg) {
void* object =
Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
if (!object)
@@ -76,14 +76,14 @@ void CreateSession(PP_Instance instance,
pp::VarArrayBuffer init_data_array_buffer(init_data_var);
static_cast<ContentDecryptor_Private*>(object)
- ->CreateSession(promise_id,
- init_data_type_var.AsString(),
- init_data_array_buffer,
- session_type);
+ ->CreateSessionAndGenerateRequest(promise_id, session_type,
+ init_data_type_var.AsString(),
+ init_data_array_buffer);
}
void LoadSession(PP_Instance instance,
uint32_t promise_id,
+ PP_SessionType session_type,
PP_Var web_session_id_arg) {
void* object =
Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
@@ -95,7 +95,7 @@ void LoadSession(PP_Instance instance,
return;
static_cast<ContentDecryptor_Private*>(object)
- ->LoadSession(promise_id, web_session_id_var.AsString());
+ ->LoadSession(promise_id, session_type, web_session_id_var.AsString());
}
void UpdateSession(PP_Instance instance,
@@ -152,22 +152,6 @@ void RemoveSession(PP_Instance instance,
->RemoveSession(promise_id, web_session_id_var.AsString());
}
-void GetUsableKeyIds(PP_Instance instance,
- uint32_t promise_id,
- PP_Var web_session_id_arg) {
- void* object =
- Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
- if (!object)
- return;
-
- pp::Var web_session_id_var(web_session_id_arg);
- if (!web_session_id_var.is_string())
- return;
-
- static_cast<ContentDecryptor_Private*>(object)
- ->GetUsableKeyIds(promise_id, web_session_id_var.AsString());
-}
-
void Decrypt(PP_Instance instance,
PP_Resource encrypted_resource,
const PP_EncryptedBlockInfo* encrypted_block_info) {
@@ -258,12 +242,11 @@ void DecryptAndDecode(PP_Instance instance,
const PPP_ContentDecryptor_Private ppp_content_decryptor = {
&Initialize,
&SetServerCertificate,
- &CreateSession,
+ &CreateSessionAndGenerateRequest,
&LoadSession,
&UpdateSession,
&CloseSession,
&RemoveSession,
- &GetUsableKeyIds,
&Decrypt,
&InitializeAudioDecoder,
&InitializeVideoDecoder,
@@ -309,23 +292,6 @@ void ContentDecryptor_Private::PromiseResolvedWithSession(
}
}
-void ContentDecryptor_Private::PromiseResolvedWithKeyIds(
- uint32_t promise_id,
- const std::vector<std::vector<uint8_t> >& key_ids) {
- if (has_interface<PPB_ContentDecryptor_Private>()) {
- pp::VarArray key_ids_array = pp::VarArray();
- key_ids_array.SetLength(key_ids.size());
- for (size_t i = 0; i < key_ids.size(); ++i) {
- const std::vector<uint8_t>& entry = key_ids[i];
- pp::VarArrayBuffer array_buffer(entry.size());
- memcpy(array_buffer.Map(), &entry[0], entry.size());
- key_ids_array.Set(i, array_buffer);
- }
- get_interface<PPB_ContentDecryptor_Private>()->PromiseResolvedWithKeyIds(
- associated_instance_.pp_instance(), promise_id, key_ids_array.pp_var());
- }
-}
-
void ContentDecryptor_Private::PromiseRejected(
uint32_t promise_id,
PP_CdmExceptionCode exception_code,
@@ -342,30 +308,27 @@ void ContentDecryptor_Private::PromiseRejected(
}
}
-void ContentDecryptor_Private::SessionMessage(
- const std::string& web_session_id,
- pp::VarArrayBuffer message,
- const std::string& destination_url) {
+void ContentDecryptor_Private::SessionMessage(const std::string& web_session_id,
+ PP_CdmMessageType message_type,
+ pp::VarArrayBuffer message) {
if (has_interface<PPB_ContentDecryptor_Private>()) {
pp::Var web_session_id_var(web_session_id);
- pp::Var destination_url_var(destination_url);
get_interface<PPB_ContentDecryptor_Private>()->SessionMessage(
- associated_instance_.pp_instance(),
- web_session_id_var.pp_var(),
- message.pp_var(),
- destination_url_var.pp_var());
+ associated_instance_.pp_instance(), web_session_id_var.pp_var(),
+ message_type, message.pp_var());
}
}
void ContentDecryptor_Private::SessionKeysChange(
const std::string& web_session_id,
- bool has_additional_usable_key) {
+ bool has_additional_usable_key,
+ const std::vector<PP_KeyInformation>& key_information) {
if (has_interface<PPB_ContentDecryptor_Private>()) {
pp::Var web_session_id_var(web_session_id);
get_interface<PPB_ContentDecryptor_Private>()->SessionKeysChange(
- associated_instance_.pp_instance(),
- web_session_id_var.pp_var(),
- PP_FromBool(has_additional_usable_key));
+ associated_instance_.pp_instance(), web_session_id_var.pp_var(),
+ PP_FromBool(has_additional_usable_key), key_information.size(),
+ key_information.empty() ? NULL : &key_information[0]);
}
}
@@ -381,14 +344,6 @@ void ContentDecryptor_Private::SessionExpirationChange(
}
}
-void ContentDecryptor_Private::SessionReady(const std::string& web_session_id) {
- if (has_interface<PPB_ContentDecryptor_Private>()) {
- pp::Var web_session_id_var(web_session_id);
- get_interface<PPB_ContentDecryptor_Private>()->SessionReady(
- associated_instance_.pp_instance(), web_session_id_var.pp_var());
- }
-}
-
void ContentDecryptor_Private::SessionClosed(
const std::string& web_session_id) {
if (has_interface<PPB_ContentDecryptor_Private>()) {
diff --git a/ppapi/cpp/private/content_decryptor_private.h b/ppapi/cpp/private/content_decryptor_private.h
index 25aba52..0117c72 100644
--- a/ppapi/cpp/private/content_decryptor_private.h
+++ b/ppapi/cpp/private/content_decryptor_private.h
@@ -37,11 +37,13 @@ class ContentDecryptor_Private {
virtual void Initialize(const std::string& key_system) = 0;
virtual void SetServerCertificate(uint32_t promise_id,
pp::VarArrayBuffer server_certificate) = 0;
- virtual void CreateSession(uint32_t promise_id,
- const std::string& init_data_type,
- pp::VarArrayBuffer init_data,
- PP_SessionType session_type) = 0;
+ virtual void CreateSessionAndGenerateRequest(
+ uint32_t promise_id,
+ PP_SessionType session_type,
+ const std::string& init_data_type,
+ pp::VarArrayBuffer init_data) = 0;
virtual void LoadSession(uint32_t promise_id,
+ PP_SessionType session_type,
const std::string& web_session_id) = 0;
virtual void UpdateSession(uint32_t promise_id,
const std::string& web_session_id,
@@ -50,8 +52,6 @@ class ContentDecryptor_Private {
const std::string& web_session_id) = 0;
virtual void RemoveSession(uint32_t promise_id,
const std::string& web_session_id) = 0;
- virtual void GetUsableKeyIds(uint32_t promise_id,
- const std::string& web_session_id) = 0;
virtual void Decrypt(pp::Buffer_Dev encrypted_buffer,
const PP_EncryptedBlockInfo& encrypted_block_info) = 0;
virtual void InitializeAudioDecoder(
@@ -75,21 +75,18 @@ class ContentDecryptor_Private {
void PromiseResolved(uint32_t promise_id);
void PromiseResolvedWithSession(uint32_t promise_id,
const std::string& web_session_id);
- void PromiseResolvedWithKeyIds(
- uint32_t promise_id,
- const std::vector<std::vector<uint8_t> >& key_ids);
void PromiseRejected(uint32_t promise_id,
PP_CdmExceptionCode exception_code,
uint32_t system_code,
const std::string& error_description);
void SessionMessage(const std::string& web_session_id,
- pp::VarArrayBuffer message,
- const std::string& destination_url);
+ PP_CdmMessageType message_type,
+ pp::VarArrayBuffer message);
void SessionKeysChange(const std::string& web_session_id,
- bool has_additional_usable_key);
+ bool has_additional_usable_key,
+ const std::vector<PP_KeyInformation>& key_information);
void SessionExpirationChange(const std::string& web_session_id,
PP_Time new_expiry_time);
- void SessionReady(const std::string& web_session_id);
void SessionClosed(const std::string& web_session_id);
void SessionError(const std::string& web_session_id,
PP_CdmExceptionCode exception_code,