summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/api/private/ppb_content_decryptor_private.idl51
-rw-r--r--ppapi/api/private/ppp_content_decryptor_private.idl57
-rw-r--r--ppapi/c/private/ppb_content_decryptor_private.h48
-rw-r--r--ppapi/c/private/ppp_content_decryptor_private.h57
-rw-r--r--ppapi/cpp/private/content_decryptor_private.cc125
-rw-r--r--ppapi/cpp/private/content_decryptor_private.h18
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c48
-rw-r--r--ppapi/proxy/ppapi_messages.h28
-rw-r--r--ppapi/proxy/ppb_instance_proxy.cc133
-rw-r--r--ppapi/proxy/ppb_instance_proxy.h21
-rw-r--r--ppapi/proxy/ppp_content_decryptor_private_proxy.cc202
-rw-r--r--ppapi/proxy/ppp_content_decryptor_private_proxy.h16
-rw-r--r--ppapi/thunk/ppb_content_decryptor_private_thunk.cc41
-rw-r--r--ppapi/thunk/ppb_instance_api.h10
14 files changed, 784 insertions, 71 deletions
diff --git a/ppapi/api/private/ppb_content_decryptor_private.idl b/ppapi/api/private/ppb_content_decryptor_private.idl
index e4dfd4f14..ad59210 100644
--- a/ppapi/api/private/ppb_content_decryptor_private.idl
+++ b/ppapi/api/private/ppb_content_decryptor_private.idl
@@ -33,7 +33,7 @@ interface PPB_ContentDecryptor_Private {
[in] uint32_t promise_id);
/**
- * A promise has been resolved by the CDM.
+ * A promise that resulted in a new session has been resolved by the CDM.
*
* @param[in] promise_id Identifies the promise that the CDM resolved.
*
@@ -46,6 +46,20 @@ interface PPB_ContentDecryptor_Private {
[in] PP_Var web_session_id);
/**
+ * A promise that returns a set of key IDs has been resolved by the CDM.
+ *
+ * @param[in] promise_id Identifies the promise that the CDM resolved.
+ *
+ * @param[in] key_ids A <code>PP_Var</code> of type
+ * <code>PP_VARTYPE_ARRAY</code> containing elements of type
+ * <code>PP_VARTYPE_ARRAYBUFFER</code> that are the session's usable key IDs.
+ */
+ void PromiseResolvedWithKeyIds(
+ [in] PP_Instance instance,
+ [in] uint32_t promise_id,
+ [in] PP_Var key_ids_array);
+
+ /**
* A promise has been rejected by the CDM due to an error.
*
* @param[in] promise_id Identifies the promise that the CDM rejected.
@@ -80,8 +94,8 @@ interface PPB_ContentDecryptor_Private {
* required to prepare for decryption.
*
* @param[in] web_session_id A <code>PP_Var</code> of type
- * <code>PP_VARTYPE_STRING</code> containing the session's ID attribute for
- * which the message is intended.
+ * <code>PP_VARTYPE_STRING</code> containing the ID of a session for
+ * which this message is intended.
*
* @param[in] message A <code>PP_Var</code> of type
* <code>PP_VARTYPE_ARRAY_BUFFER</code> that contains the message.
@@ -97,6 +111,37 @@ interface PPB_ContentDecryptor_Private {
[in] PP_Var destination_url);
/**
+ * The keys for a session have changed.
+ *
+ * @param[in] web_session_id A <code>PP_Var</code> of type
+ * <code>PP_VARTYPE_STRING</code> containing the ID of the session that has
+ * a change in keys.
+ *
+ * @param[in] has_additional_usable_key A <code>PP_Bool</code> indicating if
+ * a new usable key has been added.
+ */
+ void SessionKeysChange(
+ [in] PP_Instance instance,
+ [in] PP_Var web_session_id,
+ [in] PP_Bool has_additional_usable_key);
+
+ /**
+ * The expiration time for a session has changed.
+ *
+ * @param[in] web_session_id A <code>PP_Var</code> of type
+ * <code>PP_VARTYPE_STRING</code> containing the ID of the session that has
+ * a new expiration time.
+ *
+ * @param[in] new_expiry_time A <code>PP_Time</code> indicating the new
+ * expiry time of the session. The value is defined as the number of seconds
+ * since the Epoch (00:00:00 UTC, January 1, 1970).
+ */
+ void SessionExpirationChange(
+ [in] PP_Instance instance,
+ [in] PP_Var web_session_id,
+ [in] PP_Time new_expiry_time);
+
+ /**
* The session is now ready to decrypt the media stream.
*
* Note: The above describes the most simple case. Depending on the key
diff --git a/ppapi/api/private/ppp_content_decryptor_private.idl b/ppapi/api/private/ppp_content_decryptor_private.idl
index 73a5225..46fc701 100644
--- a/ppapi/api/private/ppp_content_decryptor_private.idl
+++ b/ppapi/api/private/ppp_content_decryptor_private.idl
@@ -31,6 +31,21 @@ interface PPP_ContentDecryptor_Private {
[in] PP_Var key_system);
/**
+ * Provides a server certificate to be used to encrypt messages to the
+ * license server.
+ *
+ * @param[in] promise_id A reference for the promise that gets resolved or
+ * rejected depending upon the success or failure of setting the certificate.
+ *
+ * @param[in] server_certificate A <code>PP_Var</code> of type
+ * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the certificate to be used.
+ */
+ void SetServerCertificate(
+ [in] PP_Instance instance,
+ [in] uint32_t promise_id,
+ [in] PP_Var server_certificate);
+
+ /**
* Creates a session. <code>init_data_type</code> contains the MIME type of
* <code>init_data</code>. <code>init_data</code> is a data buffer
* containing data for use in generating the request.
@@ -108,17 +123,51 @@ interface PPP_ContentDecryptor_Private {
[in] PP_Var response);
/**
- * Release the specified session and related resources.
+ * Close the specified session and related resources.
+ *
+ * @param[in] promise_id A reference for the promise that gets resolved or
+ * rejected depending upon the success or failure of closing the session.
+ *
+ * @param[in] web_session_id A <code>PP_Var</code> of type
+ * <code>PP_VARTYPE_STRING</code> containing the web session ID of the session
+ * to be closed.
+ *
+ */
+ void CloseSession(
+ [in] PP_Instance instance,
+ [in] uint32_t promise_id,
+ [in] PP_Var web_session_id);
+
+ /**
+ * Remove stored data associated with this session.
+ *
+ * @param[in] promise_id A reference for the promise that gets resolved or
+ * rejected depending upon the success or failure of removing the session
+ * data.
+ *
+ * @param[in] web_session_id A <code>PP_Var</code> of type
+ * <code>PP_VARTYPE_STRING</code> containing the web session ID of the session
+ * to be removed.
+ *
+ */
+ void RemoveSession(
+ [in] PP_Instance instance,
+ [in] uint32_t promise_id,
+ [in] PP_Var web_session_id);
+
+ /**
+ * Get the key IDs for keys in the session that the CDM knows are currently
+ * usable to decrypt media data.
*
* @param[in] promise_id A reference for the promise that gets resolved or
- * rejected depending upon the success or failure of releasing the session.
+ * rejected depending upon the success or failure of obtaining the key IDs.
*
* @param[in] web_session_id A <code>PP_Var</code> of type
* <code>PP_VARTYPE_STRING</code> containing the web session ID of the session
- * to be released.
+ * to be queried.
*
*/
- void ReleaseSession(
+ void GetUsableKeyIds(
[in] PP_Instance instance,
[in] uint32_t promise_id,
[in] PP_Var web_session_id);
diff --git a/ppapi/c/private/ppb_content_decryptor_private.h b/ppapi/c/private/ppb_content_decryptor_private.h
index c65c9f8..5665806 100644
--- a/ppapi/c/private/ppb_content_decryptor_private.h
+++ b/ppapi/c/private/ppb_content_decryptor_private.h
@@ -4,7 +4,7 @@
*/
/* From private/ppb_content_decryptor_private.idl,
- * modified Thu Jun 5 13:39:15 2014.
+ * modified Mon Aug 25 13:52:39 2014.
*/
#ifndef PPAPI_C_PRIVATE_PPB_CONTENT_DECRYPTOR_PRIVATE_H_
@@ -15,6 +15,7 @@
#include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/pp_time.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/c/private/pp_content_decryptor.h"
@@ -50,7 +51,7 @@ struct PPB_ContentDecryptor_Private_0_12 {
*/
void (*PromiseResolved)(PP_Instance instance, uint32_t promise_id);
/**
- * A promise has been resolved by the CDM.
+ * A promise that resulted in a new session has been resolved by the CDM.
*
* @param[in] promise_id Identifies the promise that the CDM resolved.
*
@@ -61,6 +62,18 @@ struct PPB_ContentDecryptor_Private_0_12 {
uint32_t promise_id,
struct PP_Var web_session_id);
/**
+ * A promise that returns a set of key IDs has been resolved by the CDM.
+ *
+ * @param[in] promise_id Identifies the promise that the CDM resolved.
+ *
+ * @param[in] key_ids A <code>PP_Var</code> of type
+ * <code>PP_VARTYPE_ARRAY</code> containing elements of type
+ * <code>PP_VARTYPE_ARRAYBUFFER</code> that are the session's usable key IDs.
+ */
+ void (*PromiseResolvedWithKeyIds)(PP_Instance instance,
+ uint32_t promise_id,
+ struct PP_Var key_ids_array);
+ /**
* A promise has been rejected by the CDM due to an error.
*
* @param[in] promise_id Identifies the promise that the CDM rejected.
@@ -93,8 +106,8 @@ struct PPB_ContentDecryptor_Private_0_12 {
* required to prepare for decryption.
*
* @param[in] web_session_id A <code>PP_Var</code> of type
- * <code>PP_VARTYPE_STRING</code> containing the session's ID attribute for
- * which the message is intended.
+ * <code>PP_VARTYPE_STRING</code> containing the ID of a session for
+ * which this message is intended.
*
* @param[in] message A <code>PP_Var</code> of type
* <code>PP_VARTYPE_ARRAY_BUFFER</code> that contains the message.
@@ -108,6 +121,33 @@ struct PPB_ContentDecryptor_Private_0_12 {
struct PP_Var message,
struct PP_Var destination_url);
/**
+ * The keys for a session have changed.
+ *
+ * @param[in] web_session_id A <code>PP_Var</code> of type
+ * <code>PP_VARTYPE_STRING</code> containing the ID of the session that has
+ * a change in keys.
+ *
+ * @param[in] has_additional_usable_key A <code>PP_Bool</code> indicating if
+ * a new usable key has been added.
+ */
+ void (*SessionKeysChange)(PP_Instance instance,
+ struct PP_Var web_session_id,
+ PP_Bool has_additional_usable_key);
+ /**
+ * The expiration time for a session has changed.
+ *
+ * @param[in] web_session_id A <code>PP_Var</code> of type
+ * <code>PP_VARTYPE_STRING</code> containing the ID of the session that has
+ * a new expiration time.
+ *
+ * @param[in] new_expiry_time A <code>PP_Time</code> indicating the new
+ * expiry time of the session. The value is defined as the number of seconds
+ * since the Epoch (00:00:00 UTC, January 1, 1970).
+ */
+ void (*SessionExpirationChange)(PP_Instance instance,
+ struct PP_Var web_session_id,
+ PP_Time new_expiry_time);
+ /**
* The session is now ready to decrypt the media stream.
*
* Note: The above describes the most simple case. Depending on the key
diff --git a/ppapi/c/private/ppp_content_decryptor_private.h b/ppapi/c/private/ppp_content_decryptor_private.h
index 3470005..145d843 100644
--- a/ppapi/c/private/ppp_content_decryptor_private.h
+++ b/ppapi/c/private/ppp_content_decryptor_private.h
@@ -4,7 +4,7 @@
*/
/* From private/ppp_content_decryptor_private.idl,
- * modified Thu May 1 10:36:31 2014.
+ * modified Mon Aug 25 14:02:40 2014.
*/
#ifndef PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_
@@ -51,6 +51,19 @@ struct PPP_ContentDecryptor_Private_0_12 {
*/
void (*Initialize)(PP_Instance instance, struct PP_Var key_system);
/**
+ * Provides a server certificate to be used to encrypt messages to the
+ * license server.
+ *
+ * @param[in] promise_id A reference for the promise that gets resolved or
+ * rejected depending upon the success or failure of setting the certificate.
+ *
+ * @param[in] server_certificate A <code>PP_Var</code> of type
+ * <code>PP_VARTYPE_ARRAYBUFFER</code> containing the certificate to be used.
+ */
+ void (*SetServerCertificate)(PP_Instance instance,
+ uint32_t promise_id,
+ struct PP_Var server_certificate);
+ /**
* Creates a session. <code>init_data_type</code> contains the MIME type of
* <code>init_data</code>. <code>init_data</code> is a data buffer
* containing data for use in generating the request.
@@ -122,19 +135,49 @@ struct PPP_ContentDecryptor_Private_0_12 {
struct PP_Var web_session_id,
struct PP_Var response);
/**
- * Release the specified session and related resources.
+ * Close the specified session and related resources.
+ *
+ * @param[in] promise_id A reference for the promise that gets resolved or
+ * rejected depending upon the success or failure of closing the session.
+ *
+ * @param[in] web_session_id A <code>PP_Var</code> of type
+ * <code>PP_VARTYPE_STRING</code> containing the web session ID of the session
+ * to be closed.
+ *
+ */
+ void (*CloseSession)(PP_Instance instance,
+ uint32_t promise_id,
+ struct PP_Var web_session_id);
+ /**
+ * Remove stored data associated with this session.
+ *
+ * @param[in] promise_id A reference for the promise that gets resolved or
+ * rejected depending upon the success or failure of removing the session
+ * data.
+ *
+ * @param[in] web_session_id A <code>PP_Var</code> of type
+ * <code>PP_VARTYPE_STRING</code> containing the web session ID of the session
+ * to be removed.
+ *
+ */
+ void (*RemoveSession)(PP_Instance instance,
+ uint32_t promise_id,
+ struct PP_Var web_session_id);
+ /**
+ * Get the key IDs for keys in the session that the CDM knows are currently
+ * usable to decrypt media data.
*
* @param[in] promise_id A reference for the promise that gets resolved or
- * rejected depending upon the success or failure of releasing the session.
+ * rejected depending upon the success or failure of obtaining the key IDs.
*
* @param[in] web_session_id A <code>PP_Var</code> of type
* <code>PP_VARTYPE_STRING</code> containing the web session ID of the session
- * to be released.
+ * to be queried.
*
*/
- void (*ReleaseSession)(PP_Instance instance,
- uint32_t promise_id,
- struct PP_Var web_session_id);
+ void (*GetUsableKeyIds)(PP_Instance instance,
+ uint32_t promise_id,
+ struct PP_Var web_session_id);
/**
* Decrypts the block and returns the unencrypted block via
* <code>DeliverBlock()</code> on the
diff --git a/ppapi/cpp/private/content_decryptor_private.cc b/ppapi/cpp/private/content_decryptor_private.cc
index 3142511..65f822c 100644
--- a/ppapi/cpp/private/content_decryptor_private.cc
+++ b/ppapi/cpp/private/content_decryptor_private.cc
@@ -15,6 +15,7 @@
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/module_impl.h"
#include "ppapi/cpp/var.h"
+#include "ppapi/cpp/var_array.h"
namespace pp {
@@ -38,6 +39,23 @@ void Initialize(PP_Instance instance,
key_system_var.AsString());
}
+void SetServerCertificate(PP_Instance instance,
+ uint32_t promise_id,
+ PP_Var server_certificate_arg) {
+ void* object =
+ Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
+ if (!object)
+ return;
+
+ pp::Var server_certificate_var(server_certificate_arg);
+ if (!server_certificate_var.is_array_buffer())
+ return;
+ pp::VarArrayBuffer server_certificate(server_certificate_var);
+
+ static_cast<ContentDecryptor_Private*>(object)
+ ->SetServerCertificate(promise_id, server_certificate);
+}
+
void CreateSession(PP_Instance instance,
uint32_t promise_id,
PP_Var init_data_type_arg,
@@ -102,9 +120,41 @@ void UpdateSession(PP_Instance instance,
->UpdateSession(promise_id, web_session_id_var.AsString(), response);
}
-void ReleaseSession(PP_Instance instance,
- uint32_t promise_id,
- PP_Var web_session_id_arg) {
+void CloseSession(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)
+ ->CloseSession(promise_id, web_session_id_var.AsString());
+}
+
+void RemoveSession(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)
+ ->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)
@@ -115,7 +165,7 @@ void ReleaseSession(PP_Instance instance,
return;
static_cast<ContentDecryptor_Private*>(object)
- ->ReleaseSession(promise_id, web_session_id_var.AsString());
+ ->GetUsableKeyIds(promise_id, web_session_id_var.AsString());
}
void Decrypt(PP_Instance instance,
@@ -206,18 +256,20 @@ void DecryptAndDecode(PP_Instance instance,
}
const PPP_ContentDecryptor_Private ppp_content_decryptor = {
- &Initialize,
- &CreateSession,
- &LoadSession,
- &UpdateSession,
- &ReleaseSession,
- &Decrypt,
- &InitializeAudioDecoder,
- &InitializeVideoDecoder,
- &DeinitializeDecoder,
- &ResetDecoder,
- &DecryptAndDecode
-};
+ &Initialize,
+ &SetServerCertificate,
+ &CreateSession,
+ &LoadSession,
+ &UpdateSession,
+ &CloseSession,
+ &RemoveSession,
+ &GetUsableKeyIds,
+ &Decrypt,
+ &InitializeAudioDecoder,
+ &InitializeVideoDecoder,
+ &DeinitializeDecoder,
+ &ResetDecoder,
+ &DecryptAndDecode};
template <> const char* interface_name<PPB_ContentDecryptor_Private>() {
return PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE;
@@ -257,6 +309,23 @@ 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,
@@ -288,6 +357,30 @@ void ContentDecryptor_Private::SessionMessage(
}
}
+void ContentDecryptor_Private::SessionKeysChange(
+ const std::string& web_session_id,
+ bool has_additional_usable_key) {
+ 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));
+ }
+}
+
+void ContentDecryptor_Private::SessionExpirationChange(
+ const std::string& web_session_id,
+ PP_Time new_expiry_time) {
+ if (has_interface<PPB_ContentDecryptor_Private>()) {
+ pp::Var web_session_id_var(web_session_id);
+ get_interface<PPB_ContentDecryptor_Private>()->SessionExpirationChange(
+ associated_instance_.pp_instance(),
+ web_session_id_var.pp_var(),
+ new_expiry_time);
+ }
+}
+
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);
diff --git a/ppapi/cpp/private/content_decryptor_private.h b/ppapi/cpp/private/content_decryptor_private.h
index 674bd38..25aba52 100644
--- a/ppapi/cpp/private/content_decryptor_private.h
+++ b/ppapi/cpp/private/content_decryptor_private.h
@@ -6,6 +6,7 @@
#define PPAPI_CPP_PRIVATE_CONTENT_DECRYPTOR_PRIVATE_H_
#include <string>
+#include <vector>
#include "ppapi/c/private/pp_content_decryptor.h"
#include "ppapi/c/private/ppb_content_decryptor_private.h"
@@ -34,6 +35,8 @@ class ContentDecryptor_Private {
// strings. The change would allow the CDM wrapper to reuse vars when
// replying to the browser.
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,
@@ -43,8 +46,12 @@ class ContentDecryptor_Private {
virtual void UpdateSession(uint32_t promise_id,
const std::string& web_session_id,
pp::VarArrayBuffer response) = 0;
- virtual void ReleaseSession(uint32_t promise_id,
- const std::string& web_session_id) = 0;
+ virtual void CloseSession(uint32_t promise_id,
+ 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(
@@ -68,6 +75,9 @@ 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,
@@ -75,6 +85,10 @@ class ContentDecryptor_Private {
void SessionMessage(const std::string& web_session_id,
pp::VarArrayBuffer message,
const std::string& destination_url);
+ void SessionKeysChange(const std::string& web_session_id,
+ bool has_additional_usable_key);
+ 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,
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
index ab1beda..8ddb74e 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
@@ -2721,6 +2721,11 @@ static void Pnacl_M36_PPB_ContentDecryptor_Private_PromiseResolvedWithSession(PP
iface->PromiseResolvedWithSession(instance, promise_id, *web_session_id);
}
+static void Pnacl_M36_PPB_ContentDecryptor_Private_PromiseResolvedWithKeyIds(PP_Instance instance, uint32_t promise_id, struct PP_Var* key_ids_array) {
+ const struct PPB_ContentDecryptor_Private_0_12 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_12.real_iface;
+ iface->PromiseResolvedWithKeyIds(instance, promise_id, *key_ids_array);
+}
+
static void Pnacl_M36_PPB_ContentDecryptor_Private_PromiseRejected(PP_Instance instance, uint32_t promise_id, PP_CdmExceptionCode exception_code, uint32_t system_code, struct PP_Var* error_description) {
const struct PPB_ContentDecryptor_Private_0_12 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_12.real_iface;
iface->PromiseRejected(instance, promise_id, exception_code, system_code, *error_description);
@@ -2731,6 +2736,16 @@ static void Pnacl_M36_PPB_ContentDecryptor_Private_SessionMessage(PP_Instance in
iface->SessionMessage(instance, *web_session_id, *message, *destination_url);
}
+static void Pnacl_M36_PPB_ContentDecryptor_Private_SessionKeysChange(PP_Instance instance, struct PP_Var* web_session_id, PP_Bool has_additional_usable_key) {
+ const struct PPB_ContentDecryptor_Private_0_12 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_12.real_iface;
+ iface->SessionKeysChange(instance, *web_session_id, has_additional_usable_key);
+}
+
+static void Pnacl_M36_PPB_ContentDecryptor_Private_SessionExpirationChange(PP_Instance instance, struct PP_Var* web_session_id, PP_Time new_expiry_time) {
+ const struct PPB_ContentDecryptor_Private_0_12 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_12.real_iface;
+ iface->SessionExpirationChange(instance, *web_session_id, new_expiry_time);
+}
+
static void Pnacl_M36_PPB_ContentDecryptor_Private_SessionReady(PP_Instance instance, struct PP_Var* web_session_id) {
const struct PPB_ContentDecryptor_Private_0_12 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_12.real_iface;
iface->SessionReady(instance, *web_session_id);
@@ -4368,6 +4383,13 @@ static void Pnacl_M36_PPP_ContentDecryptor_Private_Initialize(PP_Instance instan
temp_fp(instance, &key_system);
}
+static void Pnacl_M36_PPP_ContentDecryptor_Private_SetServerCertificate(PP_Instance instance, uint32_t promise_id, struct PP_Var server_certificate) {
+ const struct PPP_ContentDecryptor_Private_0_12 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_12.real_iface;
+ void (*temp_fp)(PP_Instance instance, uint32_t promise_id, struct PP_Var* server_certificate) =
+ ((void (*)(PP_Instance instance, uint32_t promise_id, struct PP_Var* server_certificate))iface->SetServerCertificate);
+ temp_fp(instance, promise_id, &server_certificate);
+}
+
static void Pnacl_M36_PPP_ContentDecryptor_Private_CreateSession(PP_Instance instance, uint32_t promise_id, struct PP_Var init_data_type, struct PP_Var init_data, PP_SessionType session_type) {
const struct PPP_ContentDecryptor_Private_0_12 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_12.real_iface;
void (*temp_fp)(PP_Instance instance, uint32_t promise_id, struct PP_Var* init_data_type, struct PP_Var* init_data, PP_SessionType session_type) =
@@ -4389,10 +4411,24 @@ static void Pnacl_M36_PPP_ContentDecryptor_Private_UpdateSession(PP_Instance ins
temp_fp(instance, promise_id, &web_session_id, &response);
}
-static void Pnacl_M36_PPP_ContentDecryptor_Private_ReleaseSession(PP_Instance instance, uint32_t promise_id, struct PP_Var web_session_id) {
+static void Pnacl_M36_PPP_ContentDecryptor_Private_CloseSession(PP_Instance instance, uint32_t promise_id, struct PP_Var web_session_id) {
+ const struct PPP_ContentDecryptor_Private_0_12 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_12.real_iface;
+ void (*temp_fp)(PP_Instance instance, uint32_t promise_id, struct PP_Var* web_session_id) =
+ ((void (*)(PP_Instance instance, uint32_t promise_id, struct PP_Var* web_session_id))iface->CloseSession);
+ temp_fp(instance, promise_id, &web_session_id);
+}
+
+static void Pnacl_M36_PPP_ContentDecryptor_Private_RemoveSession(PP_Instance instance, uint32_t promise_id, struct PP_Var web_session_id) {
+ const struct PPP_ContentDecryptor_Private_0_12 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_12.real_iface;
+ void (*temp_fp)(PP_Instance instance, uint32_t promise_id, struct PP_Var* web_session_id) =
+ ((void (*)(PP_Instance instance, uint32_t promise_id, struct PP_Var* web_session_id))iface->RemoveSession);
+ temp_fp(instance, promise_id, &web_session_id);
+}
+
+static void Pnacl_M36_PPP_ContentDecryptor_Private_GetUsableKeyIds(PP_Instance instance, uint32_t promise_id, struct PP_Var web_session_id) {
const struct PPP_ContentDecryptor_Private_0_12 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_12.real_iface;
void (*temp_fp)(PP_Instance instance, uint32_t promise_id, struct PP_Var* web_session_id) =
- ((void (*)(PP_Instance instance, uint32_t promise_id, struct PP_Var* web_session_id))iface->ReleaseSession);
+ ((void (*)(PP_Instance instance, uint32_t promise_id, struct PP_Var* web_session_id))iface->GetUsableKeyIds);
temp_fp(instance, promise_id, &web_session_id);
}
@@ -5192,8 +5228,11 @@ static const struct PPP_Selection_Dev_0_3 Pnacl_Wrappers_PPP_Selection_Dev_0_3 =
static const struct PPB_ContentDecryptor_Private_0_12 Pnacl_Wrappers_PPB_ContentDecryptor_Private_0_12 = {
.PromiseResolved = (void (*)(PP_Instance instance, uint32_t promise_id))&Pnacl_M36_PPB_ContentDecryptor_Private_PromiseResolved,
.PromiseResolvedWithSession = (void (*)(PP_Instance instance, uint32_t promise_id, struct PP_Var web_session_id))&Pnacl_M36_PPB_ContentDecryptor_Private_PromiseResolvedWithSession,
+ .PromiseResolvedWithKeyIds = (void (*)(PP_Instance instance, uint32_t promise_id, struct PP_Var key_ids_array))&Pnacl_M36_PPB_ContentDecryptor_Private_PromiseResolvedWithKeyIds,
.PromiseRejected = (void (*)(PP_Instance instance, uint32_t promise_id, PP_CdmExceptionCode exception_code, uint32_t system_code, struct PP_Var error_description))&Pnacl_M36_PPB_ContentDecryptor_Private_PromiseRejected,
.SessionMessage = (void (*)(PP_Instance instance, struct PP_Var web_session_id, struct PP_Var message, struct PP_Var destination_url))&Pnacl_M36_PPB_ContentDecryptor_Private_SessionMessage,
+ .SessionKeysChange = (void (*)(PP_Instance instance, struct PP_Var web_session_id, PP_Bool has_additional_usable_key))&Pnacl_M36_PPB_ContentDecryptor_Private_SessionKeysChange,
+ .SessionExpirationChange = (void (*)(PP_Instance instance, struct PP_Var web_session_id, PP_Time new_expiry_time))&Pnacl_M36_PPB_ContentDecryptor_Private_SessionExpirationChange,
.SessionReady = (void (*)(PP_Instance instance, struct PP_Var web_session_id))&Pnacl_M36_PPB_ContentDecryptor_Private_SessionReady,
.SessionClosed = (void (*)(PP_Instance instance, struct PP_Var web_session_id))&Pnacl_M36_PPB_ContentDecryptor_Private_SessionClosed,
.SessionError = (void (*)(PP_Instance instance, struct PP_Var web_session_id, PP_CdmExceptionCode exception_code, uint32_t system_code, struct PP_Var error_description))&Pnacl_M36_PPB_ContentDecryptor_Private_SessionError,
@@ -5624,10 +5663,13 @@ static const struct PPB_X509Certificate_Private_0_1 Pnacl_Wrappers_PPB_X509Certi
static const struct PPP_ContentDecryptor_Private_0_12 Pnacl_Wrappers_PPP_ContentDecryptor_Private_0_12 = {
.Initialize = &Pnacl_M36_PPP_ContentDecryptor_Private_Initialize,
+ .SetServerCertificate = &Pnacl_M36_PPP_ContentDecryptor_Private_SetServerCertificate,
.CreateSession = &Pnacl_M36_PPP_ContentDecryptor_Private_CreateSession,
.LoadSession = &Pnacl_M36_PPP_ContentDecryptor_Private_LoadSession,
.UpdateSession = &Pnacl_M36_PPP_ContentDecryptor_Private_UpdateSession,
- .ReleaseSession = &Pnacl_M36_PPP_ContentDecryptor_Private_ReleaseSession,
+ .CloseSession = &Pnacl_M36_PPP_ContentDecryptor_Private_CloseSession,
+ .RemoveSession = &Pnacl_M36_PPP_ContentDecryptor_Private_RemoveSession,
+ .GetUsableKeyIds = &Pnacl_M36_PPP_ContentDecryptor_Private_GetUsableKeyIds,
.Decrypt = &Pnacl_M36_PPP_ContentDecryptor_Private_Decrypt,
.InitializeAudioDecoder = &Pnacl_M36_PPP_ContentDecryptor_Private_InitializeAudioDecoder,
.InitializeVideoDecoder = &Pnacl_M36_PPP_ContentDecryptor_Private_InitializeVideoDecoder,
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 9afdcbc..087cf12 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -757,6 +757,10 @@ IPC_MESSAGE_ROUTED3(
IPC_MESSAGE_ROUTED2(PpapiMsg_PPPContentDecryptor_Initialize,
PP_Instance /* instance */,
ppapi::proxy::SerializedVar /* key_system, String */)
+IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_SetServerCertificate,
+ PP_Instance /* instance */,
+ uint32_t /* promise_id */,
+ std::vector<uint8_t> /* certificate */)
IPC_MESSAGE_ROUTED5(PpapiMsg_PPPContentDecryptor_CreateSession,
PP_Instance /* instance */,
uint32_t /* promise_id */,
@@ -772,10 +776,18 @@ IPC_MESSAGE_ROUTED4(PpapiMsg_PPPContentDecryptor_UpdateSession,
uint32_t /* promise_id */,
ppapi::proxy::SerializedVar /* web_session_id, String */,
ppapi::proxy::SerializedVar /* response, ArrayBuffer */)
-IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_ReleaseSession,
+IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_CloseSession,
PP_Instance /* instance */,
uint32_t /* promise_id */,
- ppapi::proxy::SerializedVar /* web_session_id, String */)
+ std::string /* web_session_id */)
+IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_RemoveSession,
+ PP_Instance /* instance */,
+ uint32_t /* promise_id */,
+ std::string /* web_session_id */)
+IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_GetUsableKeyIds,
+ PP_Instance /* instance */,
+ uint32_t /* promise_id */,
+ std::string /* web_session_id */)
IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_Decrypt,
PP_Instance /* instance */,
ppapi::proxy::PPPDecryptor_Buffer /* buffer */,
@@ -1092,6 +1104,10 @@ IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBInstance_PromiseResolvedWithSession,
PP_Instance /* instance */,
uint32_t /* promise_id */,
ppapi::proxy::SerializedVar /* web_session_id, String */)
+IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBInstance_PromiseResolvedWithKeyIds,
+ PP_Instance /* instance */,
+ uint32_t /* promise_id */,
+ std::vector<std::vector<uint8_t> > /* key_ids */)
IPC_MESSAGE_ROUTED5(PpapiHostMsg_PPBInstance_PromiseRejected,
PP_Instance /* instance */,
uint32_t /* promise_id */,
@@ -1103,6 +1119,14 @@ IPC_MESSAGE_ROUTED4(PpapiHostMsg_PPBInstance_SessionMessage,
ppapi::proxy::SerializedVar /* web_session_id, String */,
ppapi::proxy::SerializedVar /* message, ArrayBuffer */,
ppapi::proxy::SerializedVar /* destination_url, String */)
+IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBInstance_SessionKeysChange,
+ PP_Instance /* instance */,
+ std::string /* web_session_id */,
+ PP_Bool /* has_additional_usable_key */)
+IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBInstance_SessionExpirationChange,
+ PP_Instance /* instance */,
+ std::string /* web_session_id */,
+ PP_Time /* new_expiry_time */)
IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBInstance_SessionReady,
PP_Instance /* instance */,
ppapi::proxy::SerializedVar /* web_session_id, String */)
diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc
index 2780022..e93a219 100644
--- a/ppapi/proxy/ppb_instance_proxy.cc
+++ b/ppapi/proxy/ppb_instance_proxy.cc
@@ -6,6 +6,7 @@
#include "base/memory/ref_counted.h"
#include "build/build_config.h"
+#include "media/base/limits.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/pp_time.h"
#include "ppapi/c/pp_var.h"
@@ -34,9 +35,11 @@
#include "ppapi/proxy/serialized_var.h"
#include "ppapi/proxy/truetype_font_singleton_resource.h"
#include "ppapi/proxy/uma_private_resource.h"
+#include "ppapi/shared_impl/array_var.h"
#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/ppb_url_util_shared.h"
#include "ppapi/shared_impl/ppb_view_shared.h"
+#include "ppapi/shared_impl/scoped_pp_var.h"
#include "ppapi/shared_impl/var.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_compositor_api.h"
@@ -179,10 +182,16 @@ bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) {
OnHostMsgPromiseResolved)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PromiseResolvedWithSession,
OnHostMsgPromiseResolvedWithSession)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PromiseResolvedWithKeyIds,
+ OnHostMsgPromiseResolvedWithKeyIds)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PromiseRejected,
OnHostMsgPromiseRejected)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionMessage,
OnHostMsgSessionMessage)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionKeysChange,
+ OnHostMsgSessionKeysChange)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionExpirationChange,
+ OnHostMsgSessionExpirationChange)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionReady,
OnHostMsgSessionReady)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionClosed,
@@ -577,6 +586,35 @@ void PPB_Instance_Proxy::PromiseResolvedWithSession(PP_Instance instance,
SerializedVarSendInput(dispatcher(), web_session_id_var)));
}
+void PPB_Instance_Proxy::PromiseResolvedWithKeyIds(PP_Instance instance,
+ uint32 promise_id,
+ PP_Var key_ids_var) {
+ ArrayVar* key_ids_array = ArrayVar::FromPPVar(key_ids_var);
+ if (!key_ids_array ||
+ key_ids_array->GetLength() > media::limits::kMaxKeyIds) {
+ NOTREACHED();
+ return;
+ }
+
+ std::vector<std::vector<uint8_t> > key_ids;
+ for (size_t i = 0; i < key_ids_array->GetLength(); ++i) {
+ ArrayBufferVar* key_id = ArrayBufferVar::FromPPVar(key_ids_array->Get(i));
+ if (!key_id || key_id->ByteLength() < media::limits::kMinKeyIdLength ||
+ key_id->ByteLength() > media::limits::kMaxKeyIdLength) {
+ NOTREACHED();
+ continue;
+ }
+
+ const uint8_t* key_id_ptr = static_cast<const uint8_t*>(key_id->Map());
+ const uint32_t key_id_size = key_id->ByteLength();
+ std::vector<uint8_t> key_id_vector(key_id_ptr, key_id_ptr + key_id_size);
+ key_ids.push_back(key_id_vector);
+ }
+
+ dispatcher()->Send(new PpapiHostMsg_PPBInstance_PromiseResolvedWithKeyIds(
+ API_ID_PPB_INSTANCE, instance, promise_id, key_ids));
+}
+
void PPB_Instance_Proxy::PromiseRejected(PP_Instance instance,
uint32 promise_id,
PP_CdmExceptionCode exception_code,
@@ -603,6 +641,37 @@ void PPB_Instance_Proxy::SessionMessage(PP_Instance instance,
SerializedVarSendInput(dispatcher(), destination_url_var)));
}
+void PPB_Instance_Proxy::SessionKeysChange(PP_Instance instance,
+ PP_Var web_session_id_var,
+ PP_Bool has_additional_usable_key) {
+ StringVar* session_id = StringVar::FromPPVar(web_session_id_var);
+ if (!session_id ||
+ session_id->value().length() > media::limits::kMaxWebSessionIdLength) {
+ NOTREACHED();
+ return;
+ }
+
+ dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionKeysChange(
+ API_ID_PPB_INSTANCE,
+ instance,
+ session_id->value(),
+ has_additional_usable_key));
+}
+
+void PPB_Instance_Proxy::SessionExpirationChange(PP_Instance instance,
+ PP_Var web_session_id_var,
+ PP_Time new_expiry_time) {
+ StringVar* session_id = StringVar::FromPPVar(web_session_id_var);
+ if (!session_id ||
+ session_id->value().length() > media::limits::kMaxWebSessionIdLength) {
+ NOTREACHED();
+ return;
+ }
+
+ dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionExpirationChange(
+ API_ID_PPB_INSTANCE, instance, session_id->value(), new_expiry_time));
+}
+
void PPB_Instance_Proxy::SessionReady(PP_Instance instance,
PP_Var web_session_id_var) {
dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionReady(
@@ -1198,6 +1267,40 @@ void PPB_Instance_Proxy::OnHostMsgPromiseResolvedWithSession(
}
}
+void PPB_Instance_Proxy::OnHostMsgPromiseResolvedWithKeyIds(
+ PP_Instance instance,
+ uint32_t promise_id,
+ const std::vector<std::vector<uint8_t> >& key_ids) {
+ if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+ return;
+ if (key_ids.size() > media::limits::kMaxKeyIds) {
+ NOTREACHED();
+ return;
+ }
+
+ scoped_refptr<ArrayVar> key_ids_array = new ArrayVar();
+ 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];
+ if (entry.size() < media::limits::kMinKeyIdLength ||
+ entry.size() > media::limits::kMaxKeyIdLength) {
+ NOTREACHED();
+ continue;
+ }
+ key_ids_array->Set(
+ i,
+ PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(entry.size(),
+ &entry[0]));
+ }
+
+ EnterInstanceNoLock enter(instance);
+ if (enter.succeeded()) {
+ ScopedPPVar key_ids_var(ScopedPPVar::PassRef(), key_ids_array->GetPPVar());
+ enter.functions()->PromiseResolvedWithKeyIds(
+ instance, promise_id, key_ids_var.get());
+ }
+}
+
void PPB_Instance_Proxy::OnHostMsgPromiseRejected(
PP_Instance instance,
uint32_t promise_id,
@@ -1232,6 +1335,36 @@ void PPB_Instance_Proxy::OnHostMsgSessionMessage(
}
}
+void PPB_Instance_Proxy::OnHostMsgSessionKeysChange(
+ PP_Instance instance,
+ const std::string& web_session_id,
+ PP_Bool has_additional_usable_key) {
+ if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+ return;
+ EnterInstanceNoLock enter(instance);
+ if (enter.succeeded()) {
+ ScopedPPVar web_session_id_var(ScopedPPVar::PassRef(),
+ StringVar::StringToPPVar(web_session_id));
+ enter.functions()->SessionKeysChange(
+ instance, web_session_id_var.get(), has_additional_usable_key);
+ }
+}
+
+void PPB_Instance_Proxy::OnHostMsgSessionExpirationChange(
+ PP_Instance instance,
+ const std::string& web_session_id,
+ PP_Time new_expiry_time) {
+ if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+ return;
+ EnterInstanceNoLock enter(instance);
+ if (enter.succeeded()) {
+ ScopedPPVar web_session_id_var(ScopedPPVar::PassRef(),
+ StringVar::StringToPPVar(web_session_id));
+ enter.functions()->SessionExpirationChange(
+ instance, web_session_id_var.get(), new_expiry_time);
+ }
+}
+
void PPB_Instance_Proxy::OnHostMsgSessionReady(
PP_Instance instance,
SerializedVarReceiveInput web_session_id) {
diff --git a/ppapi/proxy/ppb_instance_proxy.h b/ppapi/proxy/ppb_instance_proxy.h
index 2408674..83a0e99 100644
--- a/ppapi/proxy/ppb_instance_proxy.h
+++ b/ppapi/proxy/ppb_instance_proxy.h
@@ -6,6 +6,7 @@
#define PPAPI_PROXY_PPB_INSTANCE_PROXY_H_
#include <string>
+#include <vector>
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_resource.h"
@@ -130,6 +131,9 @@ class PPB_Instance_Proxy : public InterfaceProxy,
virtual void PromiseResolvedWithSession(PP_Instance instance,
uint32 promise_id,
PP_Var web_session_id_var) OVERRIDE;
+ virtual void PromiseResolvedWithKeyIds(PP_Instance instance,
+ uint32 promise_id,
+ PP_Var key_ids_var) OVERRIDE;
virtual void PromiseRejected(PP_Instance instance,
uint32 promise_id,
PP_CdmExceptionCode exception_code,
@@ -139,6 +143,12 @@ class PPB_Instance_Proxy : public InterfaceProxy,
PP_Var web_session_id_var,
PP_Var message_var,
PP_Var destination_url_var) OVERRIDE;
+ virtual void SessionKeysChange(PP_Instance instance,
+ PP_Var web_session_id_var,
+ PP_Bool has_additional_usable_key) OVERRIDE;
+ virtual void SessionExpirationChange(PP_Instance instance,
+ PP_Var web_session_id_var,
+ PP_Time new_expiry_time) OVERRIDE;
virtual void SessionReady(PP_Instance instance,
PP_Var web_session_id_var) OVERRIDE;
virtual void SessionClosed(PP_Instance instance,
@@ -254,6 +264,10 @@ class PPB_Instance_Proxy : public InterfaceProxy,
PP_Instance instance,
uint32_t promise_id,
SerializedVarReceiveInput web_session_id);
+ virtual void OnHostMsgPromiseResolvedWithKeyIds(
+ PP_Instance instance,
+ uint32 promise_id,
+ const std::vector<std::vector<uint8_t> >& key_ids);
virtual void OnHostMsgPromiseRejected(
PP_Instance instance,
uint32_t promise_id,
@@ -265,6 +279,13 @@ class PPB_Instance_Proxy : public InterfaceProxy,
SerializedVarReceiveInput web_session_id,
SerializedVarReceiveInput message,
SerializedVarReceiveInput destination_url);
+ virtual void OnHostMsgSessionKeysChange(PP_Instance instance,
+ const std::string& web_session_id,
+ PP_Bool has_additional_usable_key);
+ virtual void OnHostMsgSessionExpirationChange(
+ PP_Instance instance,
+ const std::string& web_session_id,
+ PP_Time new_expiry_time);
virtual void OnHostMsgSessionReady(PP_Instance instance,
SerializedVarReceiveInput web_session_id);
virtual void OnHostMsgSessionClosed(PP_Instance instance,
diff --git a/ppapi/proxy/ppp_content_decryptor_private_proxy.cc b/ppapi/proxy/ppp_content_decryptor_private_proxy.cc
index eee3871..9d9afcc 100644
--- a/ppapi/proxy/ppp_content_decryptor_private_proxy.cc
+++ b/ppapi/proxy/ppp_content_decryptor_private_proxy.cc
@@ -5,6 +5,7 @@
#include "ppapi/proxy/ppp_content_decryptor_private_proxy.h"
#include "base/files/file.h"
+#include "media/base/limits.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/ppb_core.h"
#include "ppapi/proxy/content_decryptor_private_serializer.h"
@@ -15,6 +16,7 @@
#include "ppapi/proxy/ppb_buffer_proxy.h"
#include "ppapi/proxy/serialized_var.h"
#include "ppapi/shared_impl/scoped_pp_resource.h"
+#include "ppapi/shared_impl/scoped_pp_var.h"
#include "ppapi/shared_impl/var_tracker.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_buffer_api.h"
@@ -124,6 +126,40 @@ void Initialize(PP_Instance instance,
SerializedVarSendInput(dispatcher, key_system)));
}
+void SetServerCertificate(PP_Instance instance,
+ uint32_t promise_id,
+ PP_Var server_certificate) {
+ HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
+ if (!dispatcher) {
+ NOTREACHED();
+ return;
+ }
+
+ ArrayBufferVar* server_certificate_buffer =
+ ArrayBufferVar::FromPPVar(server_certificate);
+ if (!server_certificate_buffer ||
+ server_certificate_buffer->ByteLength() <
+ media::limits::kMinCertificateLength ||
+ server_certificate_buffer->ByteLength() >
+ media::limits::kMaxCertificateLength) {
+ NOTREACHED();
+ return;
+ }
+
+ const uint8_t* server_certificate_ptr =
+ static_cast<const uint8_t*>(server_certificate_buffer->Map());
+ const uint32_t server_certificate_size =
+ server_certificate_buffer->ByteLength();
+ std::vector<uint8_t> server_certificate_vector(
+ server_certificate_ptr, server_certificate_ptr + server_certificate_size);
+
+ dispatcher->Send(new PpapiMsg_PPPContentDecryptor_SetServerCertificate(
+ API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
+ instance,
+ promise_id,
+ server_certificate_vector));
+}
+
void CreateSession(PP_Instance instance,
uint32_t promise_id,
PP_Var init_data_type,
@@ -178,20 +214,73 @@ void UpdateSession(PP_Instance instance,
SerializedVarSendInput(dispatcher, response)));
}
-void ReleaseSession(PP_Instance instance,
- uint32_t promise_id,
- PP_Var web_session_id) {
+void CloseSession(PP_Instance instance,
+ uint32_t promise_id,
+ PP_Var web_session_id) {
HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
if (!dispatcher) {
NOTREACHED();
return;
}
- dispatcher->Send(new PpapiMsg_PPPContentDecryptor_ReleaseSession(
+ StringVar* session_id = StringVar::FromPPVar(web_session_id);
+ if (!session_id ||
+ session_id->value().length() > media::limits::kMaxWebSessionIdLength) {
+ NOTREACHED();
+ return;
+ }
+
+ dispatcher->Send(new PpapiMsg_PPPContentDecryptor_CloseSession(
API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
instance,
promise_id,
- SerializedVarSendInput(dispatcher, web_session_id)));
+ session_id->value()));
+}
+
+void RemoveSession(PP_Instance instance,
+ uint32_t promise_id,
+ PP_Var web_session_id) {
+ HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
+ if (!dispatcher) {
+ NOTREACHED();
+ return;
+ }
+
+ StringVar* session_id = StringVar::FromPPVar(web_session_id);
+ if (!session_id ||
+ session_id->value().length() > media::limits::kMaxWebSessionIdLength) {
+ NOTREACHED();
+ return;
+ }
+
+ dispatcher->Send(new PpapiMsg_PPPContentDecryptor_RemoveSession(
+ API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
+ instance,
+ promise_id,
+ session_id->value()));
+}
+
+void GetUsableKeyIds(PP_Instance instance,
+ uint32_t promise_id,
+ PP_Var web_session_id) {
+ HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
+ if (!dispatcher) {
+ NOTREACHED();
+ return;
+ }
+
+ StringVar* session_id = StringVar::FromPPVar(web_session_id);
+ if (!session_id ||
+ session_id->value().length() > media::limits::kMaxWebSessionIdLength) {
+ NOTREACHED();
+ return;
+ }
+
+ dispatcher->Send(new PpapiMsg_PPPContentDecryptor_GetUsableKeyIds(
+ API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
+ instance,
+ promise_id,
+ session_id->value()));
}
void Decrypt(PP_Instance instance,
@@ -382,18 +471,20 @@ void DecryptAndDecode(PP_Instance instance,
}
static const PPP_ContentDecryptor_Private content_decryptor_interface = {
- &Initialize,
- &CreateSession,
- &LoadSession,
- &UpdateSession,
- &ReleaseSession,
- &Decrypt,
- &InitializeAudioDecoder,
- &InitializeVideoDecoder,
- &DeinitializeDecoder,
- &ResetDecoder,
- &DecryptAndDecode
-};
+ &Initialize,
+ &SetServerCertificate,
+ &CreateSession,
+ &LoadSession,
+ &UpdateSession,
+ &CloseSession,
+ &RemoveSession,
+ &GetUsableKeyIds,
+ &Decrypt,
+ &InitializeAudioDecoder,
+ &InitializeVideoDecoder,
+ &DeinitializeDecoder,
+ &ResetDecoder,
+ &DecryptAndDecode};
} // namespace
@@ -427,14 +518,20 @@ bool PPP_ContentDecryptor_Private_Proxy::OnMessageReceived(
IPC_BEGIN_MESSAGE_MAP(PPP_ContentDecryptor_Private_Proxy, msg)
IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_Initialize,
OnMsgInitialize)
+ IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_SetServerCertificate,
+ OnMsgSetServerCertificate)
IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_CreateSession,
OnMsgCreateSession)
IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_LoadSession,
OnMsgLoadSession)
IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_UpdateSession,
OnMsgUpdateSession)
- IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_ReleaseSession,
- OnMsgReleaseSession)
+ IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_CloseSession,
+ OnMsgCloseSession)
+ IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_RemoveSession,
+ OnMsgRemoveSession)
+ IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_GetUsableKeyIds,
+ OnMsgGetUsableKeyIds)
IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_Decrypt,
OnMsgDecrypt)
IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_InitializeAudioDecoder,
@@ -464,6 +561,30 @@ void PPP_ContentDecryptor_Private_Proxy::OnMsgInitialize(
}
}
+void PPP_ContentDecryptor_Private_Proxy::OnMsgSetServerCertificate(
+ PP_Instance instance,
+ uint32_t promise_id,
+ std::vector<uint8_t> server_certificate) {
+ if (server_certificate.size() < media::limits::kMinCertificateLength ||
+ server_certificate.size() > media::limits::kMaxCertificateLength) {
+ NOTREACHED();
+ return;
+ }
+
+ if (ppp_decryptor_impl_) {
+ ScopedPPVar server_certificate_var(
+ ScopedPPVar::PassRef(),
+ PpapiGlobals::Get()
+ ->GetVarTracker()
+ ->MakeArrayBufferPPVar(server_certificate.size(),
+ &server_certificate[0]));
+ CallWhileUnlocked(ppp_decryptor_impl_->SetServerCertificate,
+ instance,
+ promise_id,
+ server_certificate_var.get());
+ }
+}
+
void PPP_ContentDecryptor_Private_Proxy::OnMsgCreateSession(
PP_Instance instance,
uint32_t promise_id,
@@ -509,16 +630,45 @@ void PPP_ContentDecryptor_Private_Proxy::OnMsgUpdateSession(
}
}
-void PPP_ContentDecryptor_Private_Proxy::OnMsgReleaseSession(
+void PPP_ContentDecryptor_Private_Proxy::OnMsgCloseSession(
PP_Instance instance,
uint32_t promise_id,
- SerializedVarReceiveInput web_session_id) {
+ const std::string& web_session_id) {
if (ppp_decryptor_impl_) {
- CallWhileUnlocked(
- ppp_decryptor_impl_->ReleaseSession,
- instance,
- promise_id,
- ExtractReceivedVarAndAddRef(dispatcher(), &web_session_id));
+ ScopedPPVar web_session_id_var(ScopedPPVar::PassRef(),
+ StringVar::StringToPPVar(web_session_id));
+ CallWhileUnlocked(ppp_decryptor_impl_->CloseSession,
+ instance,
+ promise_id,
+ web_session_id_var.get());
+ }
+}
+
+void PPP_ContentDecryptor_Private_Proxy::OnMsgRemoveSession(
+ PP_Instance instance,
+ uint32_t promise_id,
+ const std::string& web_session_id) {
+ if (ppp_decryptor_impl_) {
+ ScopedPPVar web_session_id_var(ScopedPPVar::PassRef(),
+ StringVar::StringToPPVar(web_session_id));
+ CallWhileUnlocked(ppp_decryptor_impl_->RemoveSession,
+ instance,
+ promise_id,
+ web_session_id_var.get());
+ }
+}
+
+void PPP_ContentDecryptor_Private_Proxy::OnMsgGetUsableKeyIds(
+ PP_Instance instance,
+ uint32_t promise_id,
+ const std::string& web_session_id) {
+ if (ppp_decryptor_impl_) {
+ ScopedPPVar web_session_id_var(ScopedPPVar::PassRef(),
+ StringVar::StringToPPVar(web_session_id));
+ CallWhileUnlocked(ppp_decryptor_impl_->GetUsableKeyIds,
+ instance,
+ promise_id,
+ web_session_id_var.get());
}
}
diff --git a/ppapi/proxy/ppp_content_decryptor_private_proxy.h b/ppapi/proxy/ppp_content_decryptor_private_proxy.h
index f7c78ba..217a9b9 100644
--- a/ppapi/proxy/ppp_content_decryptor_private_proxy.h
+++ b/ppapi/proxy/ppp_content_decryptor_private_proxy.h
@@ -6,6 +6,7 @@
#define PPAPI_PROXY_PPP_CONTENT_DECRYPTOR_PRIVATE_PROXY_H_
#include <string>
+#include <vector>
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/private/ppp_content_decryptor_private.h"
@@ -32,6 +33,9 @@ class PPP_ContentDecryptor_Private_Proxy : public InterfaceProxy {
// Message handlers.
void OnMsgInitialize(PP_Instance instance,
SerializedVarReceiveInput key_system);
+ void OnMsgSetServerCertificate(PP_Instance instance,
+ uint32_t promise_id,
+ std::vector<uint8_t> server_certificate);
void OnMsgCreateSession(PP_Instance instance,
uint32_t promise_id,
SerializedVarReceiveInput init_data_type,
@@ -44,9 +48,15 @@ class PPP_ContentDecryptor_Private_Proxy : public InterfaceProxy {
uint32_t promise_id,
SerializedVarReceiveInput web_session_id,
SerializedVarReceiveInput response);
- void OnMsgReleaseSession(PP_Instance instance,
- uint32_t promise_id,
- SerializedVarReceiveInput web_session_id);
+ void OnMsgCloseSession(PP_Instance instance,
+ uint32_t promise_id,
+ const std::string& web_session_id);
+ void OnMsgRemoveSession(PP_Instance instance,
+ uint32_t promise_id,
+ const std::string& web_session_id);
+ void OnMsgGetUsableKeyIds(PP_Instance instance,
+ uint32_t promise_id,
+ const std::string& web_session_id);
void OnMsgDecrypt(PP_Instance instance,
const PPPDecryptor_Buffer& encrypted_buffer,
const std::string& serialized_encrypted_block_info);
diff --git a/ppapi/thunk/ppb_content_decryptor_private_thunk.cc b/ppapi/thunk/ppb_content_decryptor_private_thunk.cc
index 19bbd18..a79307a 100644
--- a/ppapi/thunk/ppb_content_decryptor_private_thunk.cc
+++ b/ppapi/thunk/ppb_content_decryptor_private_thunk.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
// From private/ppb_content_decryptor_private.idl,
-// modified Thu Jun 5 13:39:15 2014.
+// modified Mon Aug 25 13:52:39 2014.
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_content_decryptor_private.h"
@@ -36,6 +36,18 @@ void PromiseResolvedWithSession(PP_Instance instance,
web_session_id);
}
+void PromiseResolvedWithKeyIds(PP_Instance instance,
+ uint32_t promise_id,
+ struct PP_Var key_ids_array) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::PromiseResolvedWithKeyIds()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->PromiseResolvedWithKeyIds(instance,
+ promise_id,
+ key_ids_array);
+}
+
void PromiseRejected(PP_Instance instance,
uint32_t promise_id,
PP_CdmExceptionCode exception_code,
@@ -66,6 +78,30 @@ void SessionMessage(PP_Instance instance,
destination_url);
}
+void SessionKeysChange(PP_Instance instance,
+ struct PP_Var web_session_id,
+ PP_Bool has_additional_usable_key) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::SessionKeysChange()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->SessionKeysChange(instance,
+ web_session_id,
+ has_additional_usable_key);
+}
+
+void SessionExpirationChange(PP_Instance instance,
+ struct PP_Var web_session_id,
+ PP_Time new_expiry_time) {
+ VLOG(4) << "PPB_ContentDecryptor_Private::SessionExpirationChange()";
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->SessionExpirationChange(instance,
+ web_session_id,
+ new_expiry_time);
+}
+
void SessionReady(PP_Instance instance, struct PP_Var web_session_id) {
VLOG(4) << "PPB_ContentDecryptor_Private::SessionReady()";
EnterInstance enter(instance);
@@ -175,8 +211,11 @@ const PPB_ContentDecryptor_Private_0_12
g_ppb_contentdecryptor_private_thunk_0_12 = {
&PromiseResolved,
&PromiseResolvedWithSession,
+ &PromiseResolvedWithKeyIds,
&PromiseRejected,
&SessionMessage,
+ &SessionKeysChange,
+ &SessionExpirationChange,
&SessionReady,
&SessionClosed,
&SessionError,
diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h
index 263b49c..1f0e2a5 100644
--- a/ppapi/thunk/ppb_instance_api.h
+++ b/ppapi/thunk/ppb_instance_api.h
@@ -11,6 +11,7 @@
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_size.h"
+#include "ppapi/c/pp_time.h"
#include "ppapi/c/ppb_audio_config.h"
#include "ppapi/c/ppb_console.h"
#include "ppapi/c/ppb_gamepad.h"
@@ -159,6 +160,9 @@ class PPB_Instance_API {
virtual void PromiseResolvedWithSession(PP_Instance instance,
uint32 promise_id,
PP_Var web_session_id_var) = 0;
+ virtual void PromiseResolvedWithKeyIds(PP_Instance instance,
+ uint32 promise_id,
+ PP_Var key_ids_var) = 0;
virtual void PromiseRejected(PP_Instance instance,
uint32 promise_id,
PP_CdmExceptionCode exception_code,
@@ -168,6 +172,12 @@ class PPB_Instance_API {
PP_Var web_session_id_var,
PP_Var message_var,
PP_Var destination_url_var) = 0;
+ virtual void SessionKeysChange(PP_Instance instance,
+ PP_Var web_session_id_var,
+ PP_Bool has_additional_usable_key) = 0;
+ virtual void SessionExpirationChange(PP_Instance instance,
+ PP_Var web_session_id_var,
+ PP_Time new_expiry_time) = 0;
virtual void SessionReady(PP_Instance instance,
PP_Var web_session_id_var) = 0;
virtual void SessionClosed(PP_Instance instance,