diff options
author | tomfinegan@chromium.org <tomfinegan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-29 22:50:23 +0000 |
---|---|---|
committer | tomfinegan@chromium.org <tomfinegan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-29 22:50:23 +0000 |
commit | f1b1db0631b9b253ca511119061ebf7fcfd814e9 (patch) | |
tree | 3e548bc7be79f6cc1fdf7ff9e4c97cfba02c7c7b | |
parent | ac08e7f6cde403d12d02d50fdfe373ff3f0e9ee3 (diff) | |
download | chromium_src-f1b1db0631b9b253ca511119061ebf7fcfd814e9.zip chromium_src-f1b1db0631b9b253ca511119061ebf7fcfd814e9.tar.gz chromium_src-f1b1db0631b9b253ca511119061ebf7fcfd814e9.tar.bz2 |
Add type argument to pepper content decryptor method GenerateKeyRequest().
The type argument is used to carry a MIME type that identifies the type of initialization data.
TEST=encrypted ExternalClearKey tests pass
Review URL: https://chromiumcodereview.appspot.com/11270057
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164757 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ppapi/api/private/ppb_content_decryptor_private.idl | 2 | ||||
-rw-r--r-- | ppapi/api/private/ppp_content_decryptor_private.idl | 10 | ||||
-rw-r--r-- | ppapi/c/private/ppb_content_decryptor_private.h | 12 | ||||
-rw-r--r-- | ppapi/c/private/ppp_content_decryptor_private.h | 20 | ||||
-rw-r--r-- | ppapi/cpp/private/content_decryptor_private.cc | 18 | ||||
-rw-r--r-- | ppapi/cpp/private/content_decryptor_private.h | 1 | ||||
-rw-r--r-- | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c | 80 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_messages.h | 3 | ||||
-rw-r--r-- | ppapi/proxy/ppp_content_decryptor_private_proxy.cc | 4 | ||||
-rw-r--r-- | ppapi/proxy/ppp_content_decryptor_private_proxy.h | 1 | ||||
-rw-r--r-- | ppapi/thunk/interfaces_ppb_private.h | 4 | ||||
-rw-r--r-- | ppapi/thunk/ppb_content_decryptor_private_thunk.cc | 2 | ||||
-rw-r--r-- | webkit/media/crypto/ppapi/cdm_wrapper.cc | 6 | ||||
-rw-r--r-- | webkit/media/crypto/ppapi/clear_key_cdm.cc | 16 | ||||
-rw-r--r-- | webkit/media/crypto/ppapi/clear_key_cdm.h | 14 | ||||
-rw-r--r-- | webkit/media/crypto/ppapi/content_decryption_module.h | 31 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppapi_plugin_instance.cc | 2 |
17 files changed, 125 insertions, 101 deletions
diff --git a/ppapi/api/private/ppb_content_decryptor_private.idl b/ppapi/api/private/ppb_content_decryptor_private.idl index 1751ad9..c915ae0 100644 --- a/ppapi/api/private/ppb_content_decryptor_private.idl +++ b/ppapi/api/private/ppb_content_decryptor_private.idl @@ -9,7 +9,7 @@ * Decryption Modules, not normal plugins. */ label Chrome { - M24 = 0.5 + M24 = 0.6 }; /** diff --git a/ppapi/api/private/ppp_content_decryptor_private.idl b/ppapi/api/private/ppp_content_decryptor_private.idl index 640553d..c36259a 100644 --- a/ppapi/api/private/ppp_content_decryptor_private.idl +++ b/ppapi/api/private/ppp_content_decryptor_private.idl @@ -9,7 +9,7 @@ * Decryption Modules, not normal plugins. */ label Chrome { - M24 = 0.5 + M24 = 0.6 }; /** @@ -22,8 +22,8 @@ label Chrome { interface PPP_ContentDecryptor_Private { /** * Generates a key request. key_system specifies the key or licensing system - * to use. init_data is a data buffer containing data for use in generating - * the request. + * to use. type contains the MIME type of init_data. init_data is a data + * buffer containing data for use in generating the request. * * Note: <code>GenerateKeyRequest()</code> must create the session ID used in * other methods on this interface. The session ID must be provided to the @@ -33,6 +33,9 @@ interface PPP_ContentDecryptor_Private { * @param[in] key_system A <code>PP_Var</code> of type * <code>PP_VARTYPE_STRING</code> containing the name of the key system. * + * @param[in] type A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the MIME type for init_data. + * * @param[in] init_data A <code>PP_Var</code> of type * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container specific * initialization data. @@ -40,6 +43,7 @@ interface PPP_ContentDecryptor_Private { void GenerateKeyRequest( [in] PP_Instance instance, [in] PP_Var key_system, + [in] PP_Var type, [in] PP_Var init_data); /** diff --git a/ppapi/c/private/ppb_content_decryptor_private.h b/ppapi/c/private/ppb_content_decryptor_private.h index 507cd14..7adeb20 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 Mon Oct 22 19:48:14 2012. + * modified Fri Oct 26 14:47:38 2012. */ #ifndef PPAPI_C_PRIVATE_PPB_CONTENT_DECRYPTOR_PRIVATE_H_ @@ -18,10 +18,10 @@ #include "ppapi/c/pp_var.h" #include "ppapi/c/private/pp_content_decryptor.h" -#define PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_5 \ - "PPB_ContentDecryptor_Private;0.5" +#define PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_6 \ + "PPB_ContentDecryptor_Private;0.6" #define PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE \ - PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_5 + PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_6 /** * @file @@ -42,7 +42,7 @@ * browser side support for the Content Decryption Module (CDM) for v0.1 of the * proposed Encrypted Media Extensions: http://goo.gl/rbdnR */ -struct PPB_ContentDecryptor_Private_0_5 { +struct PPB_ContentDecryptor_Private_0_6 { /** * The decryptor requires a key that has not been provided. * @@ -257,7 +257,7 @@ struct PPB_ContentDecryptor_Private_0_5 { const struct PP_DecryptedBlockInfo* decrypted_block_info); }; -typedef struct PPB_ContentDecryptor_Private_0_5 PPB_ContentDecryptor_Private; +typedef struct PPB_ContentDecryptor_Private_0_6 PPB_ContentDecryptor_Private; /** * @} */ diff --git a/ppapi/c/private/ppp_content_decryptor_private.h b/ppapi/c/private/ppp_content_decryptor_private.h index 599e274..ff224c0c 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 Mon Oct 22 19:47:57 2012. + * modified Fri Oct 26 15:36:54 2012. */ #ifndef PPAPI_C_PRIVATE_PPP_CONTENT_DECRYPTOR_PRIVATE_H_ @@ -18,10 +18,10 @@ #include "ppapi/c/pp_var.h" #include "ppapi/c/private/pp_content_decryptor.h" -#define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_5 \ - "PPP_ContentDecryptor_Private;0.5" +#define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_6 \ + "PPP_ContentDecryptor_Private;0.6" #define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE \ - PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_5 + PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_6 /** * @file @@ -42,11 +42,11 @@ * Decryption Module (CDM) for v0.1 of the proposed Encrypted Media Extensions: * http://goo.gl/rbdnR */ -struct PPP_ContentDecryptor_Private_0_5 { +struct PPP_ContentDecryptor_Private_0_6 { /** * Generates a key request. key_system specifies the key or licensing system - * to use. init_data is a data buffer containing data for use in generating - * the request. + * to use. type contains the MIME type of init_data. init_data is a data + * buffer containing data for use in generating the request. * * Note: <code>GenerateKeyRequest()</code> must create the session ID used in * other methods on this interface. The session ID must be provided to the @@ -56,12 +56,16 @@ struct PPP_ContentDecryptor_Private_0_5 { * @param[in] key_system A <code>PP_Var</code> of type * <code>PP_VARTYPE_STRING</code> containing the name of the key system. * + * @param[in] type A <code>PP_Var</code> of type + * <code>PP_VARTYPE_STRING</code> containing the MIME type for init_data. + * * @param[in] init_data A <code>PP_Var</code> of type * <code>PP_VARTYPE_ARRAYBUFFER</code> containing container specific * initialization data. */ void (*GenerateKeyRequest)(PP_Instance instance, struct PP_Var key_system, + struct PP_Var type, struct PP_Var init_data); /** * Provides a key or license to the decryptor for decrypting media data. @@ -222,7 +226,7 @@ struct PPP_ContentDecryptor_Private_0_5 { const struct PP_EncryptedBlockInfo* encrypted_block_info); }; -typedef struct PPP_ContentDecryptor_Private_0_5 PPP_ContentDecryptor_Private; +typedef struct PPP_ContentDecryptor_Private_0_6 PPP_ContentDecryptor_Private; /** * @} */ diff --git a/ppapi/cpp/private/content_decryptor_private.cc b/ppapi/cpp/private/content_decryptor_private.cc index 90842c3..3c649f14 100644 --- a/ppapi/cpp/private/content_decryptor_private.cc +++ b/ppapi/cpp/private/content_decryptor_private.cc @@ -25,6 +25,7 @@ static const char kPPPContentDecryptorInterface[] = void GenerateKeyRequest(PP_Instance instance, PP_Var key_system_arg, + PP_Var type_arg, PP_Var init_data_arg) { void* object = Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); @@ -32,16 +33,21 @@ void GenerateKeyRequest(PP_Instance instance, return; pp::Var key_system_var(pp::PASS_REF, key_system_arg); - if (key_system_var.is_string() == false) + if (!key_system_var.is_string()) + return; + + pp::Var type_var(pp::PASS_REF, type_arg); + if (!type_var.is_string()) return; pp::Var init_data_var(pp::PASS_REF, init_data_arg); - if (init_data_var.is_array_buffer() == false) + if (!init_data_var.is_array_buffer()) return; pp::VarArrayBuffer init_data_array_buffer(init_data_var); static_cast<ContentDecryptor_Private*>(object)->GenerateKeyRequest( key_system_var.AsString(), + type_var.AsString(), init_data_array_buffer); } @@ -55,16 +61,16 @@ void AddKey(PP_Instance instance, return; pp::Var session_id_var(pp::PASS_REF, session_id_arg); - if (session_id_var.is_string() == false) + if (!session_id_var.is_string()) return; pp::Var key_var(pp::PASS_REF, key_arg); - if (key_var.is_array_buffer() == false) + if (!key_var.is_array_buffer()) return; pp::VarArrayBuffer key(key_var); pp::Var init_data_var(pp::PASS_REF, init_data_arg); - if (init_data_var.is_array_buffer() == false) + if (!init_data_var.is_array_buffer()) return; pp::VarArrayBuffer init_data(init_data_var); @@ -82,7 +88,7 @@ void CancelKeyRequest(PP_Instance instance, PP_Var session_id_arg) { return; pp::Var session_id_var(pp::PASS_REF, session_id_arg); - if (session_id_var.is_string() == false) + if (!session_id_var.is_string()) return; static_cast<ContentDecryptor_Private*>(object)->CancelKeyRequest( diff --git a/ppapi/cpp/private/content_decryptor_private.h b/ppapi/cpp/private/content_decryptor_private.h index 08b31a3..629540a 100644 --- a/ppapi/cpp/private/content_decryptor_private.h +++ b/ppapi/cpp/private/content_decryptor_private.h @@ -29,6 +29,7 @@ class ContentDecryptor_Private { // strings. The change would allow the CDM wrapper to reuse vars when // replying to the browser. virtual void GenerateKeyRequest(const std::string& key_system, + const std::string& type, pp::VarArrayBuffer init_data) = 0; virtual void AddKey(const std::string& session_id, pp::VarArrayBuffer key, 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 cec1eab..45c4736 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 @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* Last generated from IDL: Thu Oct 25 16:40:11 2012. */ +/* Last generated from IDL: Mon Oct 29 11:08:12 2012. */ #include "ppapi/generators/pnacl_shim.h" #include "ppapi/c/ppb.h" @@ -203,7 +203,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_VideoDecoder_Dev_0_10; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_VideoDecoder_Dev_0_11; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Widget_Dev_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Zoom_Dev_0_3; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_5; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRefPrivate_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_12_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Flash_12_1; @@ -238,7 +238,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_3; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UDPSocket_Private_0_4; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UMA_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_X509Certificate_Private_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_5; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Flash_BrowserOperations_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Flash_BrowserOperations_1_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Flash_BrowserOperations_1_3; @@ -1955,69 +1955,69 @@ void Pnacl_M14_PPB_VideoDecoder_Dev_Destroy(PP_Resource video_decoder) { /* Not generating wrapper methods for PPP_Zoom_Dev_0_3 */ -/* Begin wrapper methods for PPB_ContentDecryptor_Private_0_5 */ +/* Begin wrapper methods for PPB_ContentDecryptor_Private_0_6 */ static __attribute__((pnaclcall)) void Pnacl_M24_PPB_ContentDecryptor_Private_NeedKey(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, struct PP_Var init_data) { - const struct PPB_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_5.real_iface; + const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; iface->NeedKey(instance, key_system, session_id, init_data); } static __attribute__((pnaclcall)) void Pnacl_M24_PPB_ContentDecryptor_Private_KeyAdded(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id) { - const struct PPB_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_5.real_iface; + const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; iface->KeyAdded(instance, key_system, session_id); } static __attribute__((pnaclcall)) void Pnacl_M24_PPB_ContentDecryptor_Private_KeyMessage(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, PP_Resource message, struct PP_Var default_url) { - const struct PPB_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_5.real_iface; + const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; iface->KeyMessage(instance, key_system, session_id, message, default_url); } static __attribute__((pnaclcall)) void Pnacl_M24_PPB_ContentDecryptor_Private_KeyError(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, int32_t media_error, int32_t system_code) { - const struct PPB_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_5.real_iface; + const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; iface->KeyError(instance, key_system, session_id, media_error, system_code); } static __attribute__((pnaclcall)) void Pnacl_M24_PPB_ContentDecryptor_Private_DeliverBlock(PP_Instance instance, PP_Resource decrypted_block, const struct PP_DecryptedBlockInfo* decrypted_block_info) { - const struct PPB_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_5.real_iface; + const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; iface->DeliverBlock(instance, decrypted_block, decrypted_block_info); } static __attribute__((pnaclcall)) void Pnacl_M24_PPB_ContentDecryptor_Private_DecoderInitializeDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id, PP_Bool success) { - const struct PPB_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_5.real_iface; + const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; iface->DecoderInitializeDone(instance, decoder_type, request_id, success); } static __attribute__((pnaclcall)) void Pnacl_M24_PPB_ContentDecryptor_Private_DecoderDeinitializeDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { - const struct PPB_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_5.real_iface; + const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; iface->DecoderDeinitializeDone(instance, decoder_type, request_id); } static __attribute__((pnaclcall)) void Pnacl_M24_PPB_ContentDecryptor_Private_DecoderResetDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { - const struct PPB_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_5.real_iface; + const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; iface->DecoderResetDone(instance, decoder_type, request_id); } static __attribute__((pnaclcall)) void Pnacl_M24_PPB_ContentDecryptor_Private_DeliverFrame(PP_Instance instance, PP_Resource decrypted_frame, const struct PP_DecryptedFrameInfo* decrypted_frame_info) { - const struct PPB_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_5.real_iface; + const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; iface->DeliverFrame(instance, decrypted_frame, decrypted_frame_info); } static __attribute__((pnaclcall)) void Pnacl_M24_PPB_ContentDecryptor_Private_DeliverSamples(PP_Instance instance, PP_Resource audio_frames, const struct PP_DecryptedBlockInfo* decrypted_block_info) { - const struct PPB_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_5.real_iface; + const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; iface->DeliverSamples(instance, audio_frames, decrypted_block_info); } -/* End wrapper methods for PPB_ContentDecryptor_Private_0_5 */ +/* End wrapper methods for PPB_ContentDecryptor_Private_0_6 */ /* Begin wrapper methods for PPB_FileRefPrivate_0_1 */ @@ -3437,63 +3437,63 @@ struct PP_Var Pnacl_M19_PPB_X509Certificate_Private_GetField(PP_Resource resourc /* End wrapper methods for PPB_X509Certificate_Private_0_1 */ -/* Begin wrapper methods for PPP_ContentDecryptor_Private_0_5 */ +/* Begin wrapper methods for PPP_ContentDecryptor_Private_0_6 */ -static void Pnacl_M24_PPP_ContentDecryptor_Private_GenerateKeyRequest(PP_Instance instance, struct PP_Var key_system, struct PP_Var init_data) { - const struct PPP_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_5.real_iface; - void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, struct PP_Var key_system, struct PP_Var init_data) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, struct PP_Var key_system, struct PP_Var init_data))iface->GenerateKeyRequest); - temp_fp(instance, key_system, init_data); +static void Pnacl_M24_PPP_ContentDecryptor_Private_GenerateKeyRequest(PP_Instance instance, struct PP_Var key_system, struct PP_Var type, struct PP_Var init_data) { + const struct PPP_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface; + void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, struct PP_Var key_system, struct PP_Var type, struct PP_Var init_data) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, struct PP_Var key_system, struct PP_Var type, struct PP_Var init_data))iface->GenerateKeyRequest); + temp_fp(instance, key_system, type, init_data); } static void Pnacl_M24_PPP_ContentDecryptor_Private_AddKey(PP_Instance instance, struct PP_Var session_id, struct PP_Var key, struct PP_Var init_data) { - const struct PPP_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_5.real_iface; + const struct PPP_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface; void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, struct PP_Var session_id, struct PP_Var key, struct PP_Var init_data) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, struct PP_Var session_id, struct PP_Var key, struct PP_Var init_data))iface->AddKey); temp_fp(instance, session_id, key, init_data); } static void Pnacl_M24_PPP_ContentDecryptor_Private_CancelKeyRequest(PP_Instance instance, struct PP_Var session_id) { - const struct PPP_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_5.real_iface; + const struct PPP_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface; void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, struct PP_Var session_id) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, struct PP_Var session_id))iface->CancelKeyRequest); temp_fp(instance, session_id); } static void Pnacl_M24_PPP_ContentDecryptor_Private_Decrypt(PP_Instance instance, PP_Resource encrypted_block, const struct PP_EncryptedBlockInfo* encrypted_block_info) { - const struct PPP_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_5.real_iface; + const struct PPP_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface; void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, PP_Resource encrypted_block, const struct PP_EncryptedBlockInfo* encrypted_block_info) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, PP_Resource encrypted_block, const struct PP_EncryptedBlockInfo* encrypted_block_info))iface->Decrypt); temp_fp(instance, encrypted_block, encrypted_block_info); } static void Pnacl_M24_PPP_ContentDecryptor_Private_InitializeAudioDecoder(PP_Instance instance, const struct PP_AudioDecoderConfig* decoder_config, PP_Resource codec_extra_data) { - const struct PPP_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_5.real_iface; + const struct PPP_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface; void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, const struct PP_AudioDecoderConfig* decoder_config, PP_Resource codec_extra_data) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, const struct PP_AudioDecoderConfig* decoder_config, PP_Resource codec_extra_data))iface->InitializeAudioDecoder); temp_fp(instance, decoder_config, codec_extra_data); } static void Pnacl_M24_PPP_ContentDecryptor_Private_InitializeVideoDecoder(PP_Instance instance, const struct PP_VideoDecoderConfig* decoder_config, PP_Resource codec_extra_data) { - const struct PPP_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_5.real_iface; + const struct PPP_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface; void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, const struct PP_VideoDecoderConfig* decoder_config, PP_Resource codec_extra_data) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, const struct PP_VideoDecoderConfig* decoder_config, PP_Resource codec_extra_data))iface->InitializeVideoDecoder); temp_fp(instance, decoder_config, codec_extra_data); } static void Pnacl_M24_PPP_ContentDecryptor_Private_DeinitializeDecoder(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { - const struct PPP_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_5.real_iface; + const struct PPP_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface; void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))iface->DeinitializeDecoder); temp_fp(instance, decoder_type, request_id); } static void Pnacl_M24_PPP_ContentDecryptor_Private_ResetDecoder(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { - const struct PPP_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_5.real_iface; + const struct PPP_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface; void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))iface->ResetDecoder); temp_fp(instance, decoder_type, request_id); } static void Pnacl_M24_PPP_ContentDecryptor_Private_DecryptAndDecode(PP_Instance instance, PP_DecryptorStreamType decoder_type, PP_Resource encrypted_buffer, const struct PP_EncryptedBlockInfo* encrypted_block_info) { - const struct PPP_ContentDecryptor_Private_0_5 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_5.real_iface; + const struct PPP_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface; void (__attribute__((pnaclcall)) *temp_fp)(PP_Instance instance, PP_DecryptorStreamType decoder_type, PP_Resource encrypted_buffer, const struct PP_EncryptedBlockInfo* encrypted_block_info) = ((void (__attribute__((pnaclcall)) *)(PP_Instance instance, PP_DecryptorStreamType decoder_type, PP_Resource encrypted_buffer, const struct PP_EncryptedBlockInfo* encrypted_block_info))iface->DecryptAndDecode); temp_fp(instance, decoder_type, encrypted_buffer, encrypted_block_info); } -/* End wrapper methods for PPP_ContentDecryptor_Private_0_5 */ +/* End wrapper methods for PPP_ContentDecryptor_Private_0_6 */ /* Not generating wrapper methods for PPP_Flash_BrowserOperations_1_0 */ @@ -3976,7 +3976,7 @@ struct PPB_VideoDecoder_Dev_0_16 Pnacl_Wrappers_PPB_VideoDecoder_Dev_0_16 = { /* Not generating wrapper interface for PPP_Zoom_Dev_0_3 */ -struct PPB_ContentDecryptor_Private_0_5 Pnacl_Wrappers_PPB_ContentDecryptor_Private_0_5 = { +struct PPB_ContentDecryptor_Private_0_6 Pnacl_Wrappers_PPB_ContentDecryptor_Private_0_6 = { .NeedKey = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, struct PP_Var init_data))&Pnacl_M24_PPB_ContentDecryptor_Private_NeedKey, .KeyAdded = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id))&Pnacl_M24_PPB_ContentDecryptor_Private_KeyAdded, .KeyMessage = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, PP_Resource message, struct PP_Var default_url))&Pnacl_M24_PPB_ContentDecryptor_Private_KeyMessage, @@ -4300,8 +4300,8 @@ struct PPB_X509Certificate_Private_0_1 Pnacl_Wrappers_PPB_X509Certificate_Privat .GetField = (struct PP_Var (*)(PP_Resource resource, PP_X509Certificate_Private_Field field))&Pnacl_M19_PPB_X509Certificate_Private_GetField }; -struct PPP_ContentDecryptor_Private_0_5 Pnacl_Wrappers_PPP_ContentDecryptor_Private_0_5 = { - .GenerateKeyRequest = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var init_data))&Pnacl_M24_PPP_ContentDecryptor_Private_GenerateKeyRequest, +struct PPP_ContentDecryptor_Private_0_6 Pnacl_Wrappers_PPP_ContentDecryptor_Private_0_6 = { + .GenerateKeyRequest = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var type, struct PP_Var init_data))&Pnacl_M24_PPP_ContentDecryptor_Private_GenerateKeyRequest, .AddKey = (void (*)(PP_Instance instance, struct PP_Var session_id, struct PP_Var key, struct PP_Var init_data))&Pnacl_M24_PPP_ContentDecryptor_Private_AddKey, .CancelKeyRequest = (void (*)(PP_Instance instance, struct PP_Var session_id))&Pnacl_M24_PPP_ContentDecryptor_Private_CancelKeyRequest, .Decrypt = (void (*)(PP_Instance instance, PP_Resource encrypted_block, const struct PP_EncryptedBlockInfo* encrypted_block_info))&Pnacl_M24_PPP_ContentDecryptor_Private_Decrypt, @@ -4862,9 +4862,9 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Zoom_Dev_0_3 = { .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_5 = { - .iface_macro = PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_5, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_ContentDecryptor_Private_0_5, +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6 = { + .iface_macro = PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_6, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_ContentDecryptor_Private_0_6, .real_iface = NULL }; @@ -5072,9 +5072,9 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_X509Certificate_Private_0 .real_iface = NULL }; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_5 = { - .iface_macro = PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_5, - .wrapped_iface = (void *) &Pnacl_Wrappers_PPP_ContentDecryptor_Private_0_5, +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6 = { + .iface_macro = PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_6, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPP_ContentDecryptor_Private_0_6, .real_iface = NULL }; @@ -5179,7 +5179,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_Widget_Dev_0_3, &Pnacl_WrapperInfo_PPB_Widget_Dev_0_4, &Pnacl_WrapperInfo_PPB_Zoom_Dev_0_2, - &Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_5, + &Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6, &Pnacl_WrapperInfo_PPB_FileRefPrivate_0_1, &Pnacl_WrapperInfo_PPB_Flash_12_0, &Pnacl_WrapperInfo_PPB_Flash_12_1, @@ -5232,7 +5232,7 @@ static struct __PnaclWrapperInfo *s_ppp_wrappers[] = { &Pnacl_WrapperInfo_PPP_VideoDecoder_Dev_0_11, &Pnacl_WrapperInfo_PPP_Widget_Dev_0_2, &Pnacl_WrapperInfo_PPP_Zoom_Dev_0_3, - &Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_5, + &Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6, &Pnacl_WrapperInfo_PPP_Flash_BrowserOperations_1_0, &Pnacl_WrapperInfo_PPP_Flash_BrowserOperations_1_2, &Pnacl_WrapperInfo_PPP_Flash_BrowserOperations_1_3, diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index 361c19e..cf85b19 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -630,9 +630,10 @@ IPC_MESSAGE_ROUTED3( int32_t /* result */) // PPP_ContentDecryptor_Dev -IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_GenerateKeyRequest, +IPC_MESSAGE_ROUTED4(PpapiMsg_PPPContentDecryptor_GenerateKeyRequest, PP_Instance /* instance */, ppapi::proxy::SerializedVar /* key_system, String */, + ppapi::proxy::SerializedVar /* type, String */, ppapi::proxy::SerializedVar /* init_data, ArrayBuffer */) IPC_MESSAGE_ROUTED4(PpapiMsg_PPPContentDecryptor_AddKey, PP_Instance /* instance */, diff --git a/ppapi/proxy/ppp_content_decryptor_private_proxy.cc b/ppapi/proxy/ppp_content_decryptor_private_proxy.cc index 4afd8fc..1b472074 100644 --- a/ppapi/proxy/ppp_content_decryptor_private_proxy.cc +++ b/ppapi/proxy/ppp_content_decryptor_private_proxy.cc @@ -131,6 +131,7 @@ bool InitializePppDecryptorBuffer(PP_Instance instance, void GenerateKeyRequest(PP_Instance instance, PP_Var key_system, + PP_Var type, PP_Var init_data) { HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); if (!dispatcher) { @@ -143,6 +144,7 @@ void GenerateKeyRequest(PP_Instance instance, API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, instance, SerializedVarSendInput(dispatcher, key_system), + SerializedVarSendInput(dispatcher, type), SerializedVarSendInput(dispatcher, init_data))); } @@ -411,11 +413,13 @@ bool PPP_ContentDecryptor_Private_Proxy::OnMessageReceived( void PPP_ContentDecryptor_Private_Proxy::OnMsgGenerateKeyRequest( PP_Instance instance, SerializedVarReceiveInput key_system, + SerializedVarReceiveInput type, SerializedVarReceiveInput init_data) { if (ppp_decryptor_impl_) { CallWhileUnlocked(ppp_decryptor_impl_->GenerateKeyRequest, instance, ExtractReceivedVarAndAddRef(dispatcher(), &key_system), + ExtractReceivedVarAndAddRef(dispatcher(), &type), ExtractReceivedVarAndAddRef(dispatcher(), &init_data)); } } diff --git a/ppapi/proxy/ppp_content_decryptor_private_proxy.h b/ppapi/proxy/ppp_content_decryptor_private_proxy.h index ccbbf6d..5e7ecc8 100644 --- a/ppapi/proxy/ppp_content_decryptor_private_proxy.h +++ b/ppapi/proxy/ppp_content_decryptor_private_proxy.h @@ -32,6 +32,7 @@ class PPP_ContentDecryptor_Private_Proxy : public InterfaceProxy { // Message handlers. void OnMsgGenerateKeyRequest(PP_Instance instance, SerializedVarReceiveInput key_system, + SerializedVarReceiveInput type, SerializedVarReceiveInput init_data); void OnMsgAddKey(PP_Instance instance, SerializedVarReceiveInput session_id, diff --git a/ppapi/thunk/interfaces_ppb_private.h b/ppapi/thunk/interfaces_ppb_private.h index 763c15d..498ab25 100644 --- a/ppapi/thunk/interfaces_ppb_private.h +++ b/ppapi/thunk/interfaces_ppb_private.h @@ -55,8 +55,8 @@ PROXIED_IFACE(PPB_Broker, PPB_BROKER_TRUSTED_INTERFACE_0_2, PROXIED_IFACE(PPB_Instance, PPB_BROWSERFONT_TRUSTED_INTERFACE_1_0, PPB_BrowserFont_Trusted_1_0) PROXIED_IFACE(PPB_Instance, - PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_5, - PPB_ContentDecryptor_Private_0_5) + PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_6, + PPB_ContentDecryptor_Private_0_6) PROXIED_IFACE(PPB_Instance, PPB_CHARSET_TRUSTED_INTERFACE_1_0, PPB_CharSet_Trusted_1_0) PROXIED_IFACE(NoAPIName, PPB_FILECHOOSER_TRUSTED_INTERFACE_0_5, diff --git a/ppapi/thunk/ppb_content_decryptor_private_thunk.cc b/ppapi/thunk/ppb_content_decryptor_private_thunk.cc index 946e5b3..905d482 100644 --- a/ppapi/thunk/ppb_content_decryptor_private_thunk.cc +++ b/ppapi/thunk/ppb_content_decryptor_private_thunk.cc @@ -125,7 +125,7 @@ const PPB_ContentDecryptor_Private g_ppb_decryption_thunk = { } // namespace const PPB_ContentDecryptor_Private* - GetPPB_ContentDecryptor_Private_0_5_Thunk() { + GetPPB_ContentDecryptor_Private_0_6_Thunk() { return &g_ppb_decryption_thunk; } diff --git a/webkit/media/crypto/ppapi/cdm_wrapper.cc b/webkit/media/crypto/ppapi/cdm_wrapper.cc index ab88d48..649426a 100644 --- a/webkit/media/crypto/ppapi/cdm_wrapper.cc +++ b/webkit/media/crypto/ppapi/cdm_wrapper.cc @@ -440,6 +440,7 @@ class CdmWrapper : public pp::Instance, // Note: Results of calls to these methods must be reported through the // PPB_ContentDecryptor_Private interface. virtual void GenerateKeyRequest(const std::string& key_system, + const std::string& type, pp::VarArrayBuffer init_data) OVERRIDE; virtual void AddKey(const std::string& session_id, pp::VarArrayBuffer key, @@ -530,11 +531,13 @@ CdmWrapper::~CdmWrapper() { } void CdmWrapper::GenerateKeyRequest(const std::string& key_system, + const std::string& type, pp::VarArrayBuffer init_data) { PP_DCHECK(!key_system.empty()); if (!cdm_) { - cdm_ = CreateCdmInstance(&allocator_, this); + cdm_ = CreateCdmInstance(key_system.data(), key_system.size(), + &allocator_, this); PP_DCHECK(cdm_); if (!cdm_) { FireKeyError(""); @@ -544,6 +547,7 @@ void CdmWrapper::GenerateKeyRequest(const std::string& key_system, LinkedKeyMessage key_request(new KeyMessageImpl()); cdm::Status status = cdm_->GenerateKeyRequest( + type.data(), type.size(), static_cast<const uint8_t*>(init_data.Map()), init_data.ByteLength(), key_request.get()); diff --git a/webkit/media/crypto/ppapi/clear_key_cdm.cc b/webkit/media/crypto/ppapi/clear_key_cdm.cc index 7a7be26..93d19d5 100644 --- a/webkit/media/crypto/ppapi/clear_key_cdm.cc +++ b/webkit/media/crypto/ppapi/clear_key_cdm.cc @@ -54,6 +54,7 @@ static bool g_cdm_module_initialized = InitializeFFmpegLibraries(); #endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER static const char kClearKeyCdmVersion[] = "0.1.0.0"; +static const char kExternalClearKey[] = "org.chromium.externalclearkey"; // Copies |input_buffer| into a media::DecoderBuffer. If the |input_buffer| is // empty, an empty (end-of-stream) media::DecoderBuffer is returned. @@ -116,9 +117,12 @@ void INITIALIZE_CDM_MODULE() { void DeInitializeCdmModule() { } -cdm::ContentDecryptionModule* CreateCdmInstance( - cdm::Allocator* allocator, cdm::CdmHost* host) { +cdm::ContentDecryptionModule* CreateCdmInstance(const char* key_system_arg, + int key_system_size, + cdm::Allocator* allocator, + cdm::CdmHost* host) { DVLOG(1) << "CreateCdmInstance()"; + DCHECK_EQ(std::string(key_system_arg, key_system_size), kExternalClearKey); return new webkit_media::ClearKeyCdm(allocator, host); } @@ -196,14 +200,16 @@ ClearKeyCdm::ClearKeyCdm(cdm::Allocator* allocator, cdm::CdmHost*) ClearKeyCdm::~ClearKeyCdm() {} -cdm::Status ClearKeyCdm::GenerateKeyRequest(const uint8_t* init_data, +cdm::Status ClearKeyCdm::GenerateKeyRequest(const char* type, int type_size, + const uint8_t* init_data, int init_data_size, cdm::KeyMessage* key_request) { DVLOG(1) << "GenerateKeyRequest()"; base::AutoLock auto_lock(client_lock_); ScopedResetter<Client> auto_resetter(&client_); - // TODO(tomfinegan): Pass "type" here once ContentDecryptionModule is updated. - decryptor_.GenerateKeyRequest("", "", init_data, init_data_size); + decryptor_.GenerateKeyRequest(kExternalClearKey, + std::string(type, type_size), + init_data, init_data_size); if (client_.status() != Client::kKeyMessage) return cdm::kSessionError; diff --git a/webkit/media/crypto/ppapi/clear_key_cdm.h b/webkit/media/crypto/ppapi/clear_key_cdm.h index 2053328..e3056be 100644 --- a/webkit/media/crypto/ppapi/clear_key_cdm.h +++ b/webkit/media/crypto/ppapi/clear_key_cdm.h @@ -46,17 +46,13 @@ class ClearKeyCdm : public cdm::ContentDecryptionModule { virtual ~ClearKeyCdm(); // ContentDecryptionModule implementation. - // TODO(tomfinegan): Update ContentDecryptionModule to pass "type" through. virtual cdm::Status GenerateKeyRequest( - const uint8_t* init_data, - int init_data_size, + const char* type, int type_size, + const uint8_t* init_data, int init_data_size, cdm::KeyMessage* key_request) OVERRIDE; - virtual cdm::Status AddKey(const char* session_id, - int session_id_size, - const uint8_t* key, - int key_size, - const uint8_t* key_id, - int key_id_size) OVERRIDE; + virtual cdm::Status AddKey(const char* session_id, int session_id_size, + const uint8_t* key, int key_size, + const uint8_t* key_id, int key_id_size) OVERRIDE; virtual cdm::Status CancelKeyRequest(const char* session_id, int session_id_size) OVERRIDE; virtual void TimerExpired(cdm::KeyMessage* msg, bool* populated) OVERRIDE; diff --git a/webkit/media/crypto/ppapi/content_decryption_module.h b/webkit/media/crypto/ppapi/content_decryption_module.h index d2e9237..8bc9870 100644 --- a/webkit/media/crypto/ppapi/content_decryption_module.h +++ b/webkit/media/crypto/ppapi/content_decryption_module.h @@ -33,7 +33,10 @@ CDM_EXPORT void DeInitializeCdmModule(); // Caller retains ownership of arguments, which must outlive the call to // DestroyCdmInstance below. CDM_EXPORT cdm::ContentDecryptionModule* CreateCdmInstance( - cdm::Allocator* allocator, cdm::CdmHost* host); + const char* key_system, + int key_system_size, + cdm::Allocator* allocator, + cdm::CdmHost* host); CDM_EXPORT void DestroyCdmInstance(cdm::ContentDecryptionModule* instance); CDM_EXPORT const char* GetCdmVersion(); } @@ -211,7 +214,7 @@ enum StreamType { // when a Buffer is created that will never be returned to the caller. class ContentDecryptionModule { public: - // Generates a |key_request| given the |init_data|. + // Generates a |key_request| given |type| and |init_data|. // // Returns kSuccess if the key request was successfully generated, // in which case the callee should have allocated memory for the output @@ -219,32 +222,26 @@ class ContentDecryptionModule { // to the caller. // Returns kSessionError if any error happened, in which case the // |key_request| should not be used by the caller. - // - // TODO(xhwang): It's not safe to pass the ownership of the dynamically - // allocated memory over library boundaries. Fix it after related PPAPI change - // and sample CDM are landed. - virtual Status GenerateKeyRequest(const uint8_t* init_data, - int init_data_size, - KeyMessage* key_request) = 0; + virtual Status GenerateKeyRequest( + const char* type, int type_size, + const uint8_t* init_data, int init_data_size, + KeyMessage* key_request) = 0; // Adds the |key| to the CDM to be associated with |key_id|. // // Returns kSuccess if the key was successfully added, kSessionError // otherwise. - virtual Status AddKey(const char* session_id, - int session_id_size, - const uint8_t* key, - int key_size, - const uint8_t* key_id, - int key_id_size) = 0; + virtual Status AddKey(const char* session_id, int session_id_size, + const uint8_t* key, int key_size, + const uint8_t* key_id, int key_id_size) = 0; // Cancels any pending key request made to the CDM for |session_id|. // // Returns kSuccess if all pending key requests for |session_id| were // successfully canceled or there was no key request to be canceled, // kSessionError otherwise. - virtual Status CancelKeyRequest(const char* session_id, - int session_id_size) = 0; + virtual Status CancelKeyRequest( + const char* session_id, int session_id_size) = 0; // Optionally populates |*msg| and indicates so in |*populated|. virtual void TimerExpired(KeyMessage* msg, bool* populated) = 0; diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index cd78ea8..0b858c6 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -1635,10 +1635,10 @@ bool PluginInstance::GenerateKeyRequest(const std::string& key_system, PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( init_data.size(), init_data.data()); - // TODO(tomfinegan): Pass "type" once PPP_ContentDecryptor_Private is updated. plugin_decryption_interface_->GenerateKeyRequest( pp_instance(), StringVar::StringToPPVar(key_system), + StringVar::StringToPPVar(type), init_data_array); return true; } |