diff options
author | jrummell@chromium.org <jrummell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-20 06:34:51 +0000 |
---|---|---|
committer | jrummell@chromium.org <jrummell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-20 06:34:51 +0000 |
commit | 38a995d99dae51ddb7e46717529ff88e5afd6e88 (patch) | |
tree | b29f4096bd9ba83e0e7310961bb565187d721d55 | |
parent | a711d03902fa67ba157dd666fa474766368e0687 (diff) | |
download | chromium_src-38a995d99dae51ddb7e46717529ff88e5afd6e88.zip chromium_src-38a995d99dae51ddb7e46717529ff88e5afd6e88.tar.gz chromium_src-38a995d99dae51ddb7e46717529ff88e5afd6e88.tar.bz2 |
Create a Pepper-based CDM when a MediaKeys object is created.
The new version of EME needs to be able to instantiate the Pepper-based CDM when a MediaKeys object is created. Moving creation from first GenerateKeyRequest() to Initialize(), and passing in extra (extendable) data.
Also removing unused NeedKey().
BUG=250049
TEST=browser_tests --gtest_filter=EncryptedMediaIsTypeSupported*.* all pass
Review URL: https://chromiumcodereview.appspot.com/24192004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224306 0039d316-1c4b-4281-b951-d872f2087c98
21 files changed, 236 insertions, 306 deletions
diff --git a/content/renderer/media/crypto/ppapi_decryptor.cc b/content/renderer/media/crypto/ppapi_decryptor.cc index 8d5bdf9..80f8149 100644 --- a/content/renderer/media/crypto/ppapi_decryptor.cc +++ b/content/renderer/media/crypto/ppapi_decryptor.cc @@ -36,7 +36,10 @@ scoped_ptr<PpapiDecryptor> PpapiDecryptor::Create( return scoped_ptr<PpapiDecryptor>(); } - plugin_cdm_delegate->Initialize(key_system); + // TODO(jrummell): How do we get the can_challenge_platform value from + // the browser? + const bool can_challenge_platform = false; + plugin_cdm_delegate->Initialize(key_system, can_challenge_platform); return scoped_ptr<PpapiDecryptor>(new PpapiDecryptor(plugin_instance, plugin_cdm_delegate, diff --git a/content/renderer/pepper/content_decryptor_delegate.cc b/content/renderer/pepper/content_decryptor_delegate.cc index 94d8928..ce91037 100644 --- a/content/renderer/pepper/content_decryptor_delegate.cc +++ b/content/renderer/pepper/content_decryptor_delegate.cc @@ -243,10 +243,16 @@ ContentDecryptorDelegate::ContentDecryptorDelegate( ContentDecryptorDelegate::~ContentDecryptorDelegate() { } -void ContentDecryptorDelegate::Initialize(const std::string& key_system) { - // TODO(ddorwin): Add an Initialize method to PPP_ContentDecryptor_Private. +void ContentDecryptorDelegate::Initialize(const std::string& key_system, + bool can_challenge_platform) { DCHECK(!key_system.empty()); + DCHECK(key_system_.empty()); key_system_ = key_system; + + plugin_decryption_interface_->Initialize( + pp_instance_, + StringVar::StringToPPVar(key_system_), + PP_FromBool(can_challenge_platform)); } void ContentDecryptorDelegate::SetKeyEventCallbacks( @@ -267,7 +273,6 @@ bool ContentDecryptorDelegate::GenerateKeyRequest(const std::string& type, plugin_decryption_interface_->GenerateKeyRequest( pp_instance_, - StringVar::StringToPPVar(key_system_), // TODO(ddorwin): Remove. StringVar::StringToPPVar(type), init_data_array); return true; diff --git a/content/renderer/pepper/content_decryptor_delegate.h b/content/renderer/pepper/content_decryptor_delegate.h index ca54d98..f58ef9f 100644 --- a/content/renderer/pepper/content_decryptor_delegate.h +++ b/content/renderer/pepper/content_decryptor_delegate.h @@ -39,7 +39,8 @@ class ContentDecryptorDelegate { const PPP_ContentDecryptor_Private* plugin_decryption_interface); ~ContentDecryptorDelegate(); - void Initialize(const std::string& key_system); + void Initialize(const std::string& key_system, + const bool can_challenge_platform); void SetKeyEventCallbacks(const media::KeyAddedCB& key_added_cb, const media::KeyErrorCB& key_error_cb, diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc index c95d3fe..988d066 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.cc +++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc @@ -2179,14 +2179,6 @@ PP_Var PepperPluginInstanceImpl::GetDefaultCharSet(PP_Instance instance) { // PPP_ContentDecryptor_Private calls made on |content_decryptor_delegate_|. // Therefore, |content_decryptor_delegate_| must have been initialized when // the following methods are called. -void PepperPluginInstanceImpl::NeedKey(PP_Instance instance, - PP_Var key_system_var, - PP_Var session_id_var, - PP_Var init_data_var) { - content_decryptor_delegate_->NeedKey( - key_system_var, session_id_var, init_data_var); -} - void PepperPluginInstanceImpl::KeyAdded(PP_Instance instance, PP_Var key_system_var, PP_Var session_id_var) { diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.h b/content/renderer/pepper/pepper_plugin_instance_impl.h index a700798..3113820 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.h +++ b/content/renderer/pepper/pepper_plugin_instance_impl.h @@ -442,10 +442,6 @@ class CONTENT_EXPORT PepperPluginInstanceImpl PP_URLComponents_Dev* components) OVERRIDE; // PPB_ContentDecryptor_Private implementation. - virtual void NeedKey(PP_Instance instance, - PP_Var key_system, - PP_Var session_id, - PP_Var init_data) OVERRIDE; virtual void KeyAdded(PP_Instance instance, PP_Var key_system, PP_Var session_id) OVERRIDE; diff --git a/media/cdm/ppapi/cdm_wrapper.cc b/media/cdm/ppapi/cdm_wrapper.cc index 6348f19..66ae43d 100644 --- a/media/cdm/ppapi/cdm_wrapper.cc +++ b/media/cdm/ppapi/cdm_wrapper.cc @@ -498,8 +498,9 @@ class CdmWrapper : public pp::Instance, // PPP_ContentDecryptor_Private implementation. // 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, + virtual void Initialize(const std::string& key_system, + bool can_challenge_platform) OVERRIDE; + virtual void GenerateKeyRequest(const std::string& type, pp::VarArrayBuffer init_data) OVERRIDE; virtual void AddKey(const std::string& session_id, pp::VarArrayBuffer key, @@ -636,11 +637,25 @@ bool CdmWrapper::CreateCdmInstance(const std::string& key_system) { return (cdm_ != NULL); } -void CdmWrapper::GenerateKeyRequest(const std::string& key_system, - const std::string& type, - pp::VarArrayBuffer init_data) { +void CdmWrapper::Initialize(const std::string& key_system, + bool can_challenge_platform) { PP_DCHECK(!key_system.empty()); - PP_DCHECK(key_system_.empty() || key_system_ == key_system); + PP_DCHECK(key_system_.empty() || (key_system_ == key_system && cdm_)); + + if (!cdm_) { + if (!CreateCdmInstance(key_system)) { + // TODO(jrummell): Is UnknownKeyError the correct response? + SendUnknownKeyError(key_system, std::string()); + return; + } + } + PP_DCHECK(cdm_); + key_system_ = key_system; +} + +void CdmWrapper::GenerateKeyRequest(const std::string& type, + pp::VarArrayBuffer init_data) { + PP_DCHECK(cdm_); // Initialize() should have succeeded. #if defined(CHECK_DOCUMENT_URL) PP_URLComponents_Dev url_components = {}; @@ -652,36 +667,19 @@ void CdmWrapper::GenerateKeyRequest(const std::string& key_system, PP_DCHECK(0 < url_components.host.len); #endif // defined(CHECK_DOCUMENT_URL) - if (!cdm_) { - if (!CreateCdmInstance(key_system)) { - SendUnknownKeyError(key_system, std::string()); - return; - } - } - PP_DCHECK(cdm_); - - // Must be set here in case the CDM synchronously calls a cdm::Host method. - // Clear below on error. - // TODO(ddorwin): Set/clear key_system_ & cdm_ at same time; clear both on - // error below. - key_system_ = key_system; cdm::Status status = cdm_->GenerateKeyRequest( type.data(), type.size(), static_cast<const uint8_t*>(init_data.Map()), init_data.ByteLength()); PP_DCHECK(status == cdm::kSuccess || status == cdm::kSessionError); - if (status != cdm::kSuccess) { - key_system_.clear(); // See comment above. - return; - } - - key_system_ = key_system; + if (status != cdm::kSuccess) + SendUnknownKeyError(key_system_, std::string()); } void CdmWrapper::AddKey(const std::string& session_id, pp::VarArrayBuffer key, pp::VarArrayBuffer init_data) { - PP_DCHECK(cdm_); // GenerateKeyRequest() should have succeeded. + PP_DCHECK(cdm_); // Initialize() should have succeeded. if (!cdm_) { SendUnknownKeyError(key_system_, session_id); return; @@ -711,7 +709,7 @@ void CdmWrapper::AddKey(const std::string& session_id, } void CdmWrapper::CancelKeyRequest(const std::string& session_id) { - PP_DCHECK(cdm_); // GenerateKeyRequest() should have succeeded. + PP_DCHECK(cdm_); // Initialize() should have succeeded. if (!cdm_) { SendUnknownKeyError(key_system_, session_id); return; @@ -729,7 +727,7 @@ void CdmWrapper::CancelKeyRequest(const std::string& session_id) { void CdmWrapper::Decrypt(pp::Buffer_Dev encrypted_buffer, const PP_EncryptedBlockInfo& encrypted_block_info) { - PP_DCHECK(cdm_); // GenerateKeyRequest() should have succeeded. + PP_DCHECK(cdm_); // Initialize() should have succeeded. PP_DCHECK(!encrypted_buffer.is_null()); // Release a buffer that the caller indicated it is finished with. @@ -759,7 +757,7 @@ void CdmWrapper::Decrypt(pp::Buffer_Dev encrypted_buffer, void CdmWrapper::InitializeAudioDecoder( const PP_AudioDecoderConfig& decoder_config, pp::Buffer_Dev extra_data_buffer) { - PP_DCHECK(cdm_); // GenerateKeyRequest() should have succeeded. + PP_DCHECK(cdm_); // Initialize() should have succeeded. cdm::Status status = cdm::kSessionError; if (cdm_) { @@ -786,7 +784,7 @@ void CdmWrapper::InitializeAudioDecoder( void CdmWrapper::InitializeVideoDecoder( const PP_VideoDecoderConfig& decoder_config, pp::Buffer_Dev extra_data_buffer) { - PP_DCHECK(cdm_); // GenerateKeyRequest() should have succeeded. + PP_DCHECK(cdm_); // Initialize() should have succeeded. cdm::Status status = cdm::kSessionError; if (cdm_) { @@ -815,7 +813,7 @@ void CdmWrapper::InitializeVideoDecoder( void CdmWrapper::DeinitializeDecoder(PP_DecryptorStreamType decoder_type, uint32_t request_id) { - PP_DCHECK(cdm_); // GenerateKeyRequest() should have succeeded. + PP_DCHECK(cdm_); // Initialize() should have succeeded. if (cdm_) { cdm_->DeinitializeDecoder( PpDecryptorStreamTypeToCdmStreamType(decoder_type)); @@ -829,7 +827,7 @@ void CdmWrapper::DeinitializeDecoder(PP_DecryptorStreamType decoder_type, void CdmWrapper::ResetDecoder(PP_DecryptorStreamType decoder_type, uint32_t request_id) { - PP_DCHECK(cdm_); // GenerateKeyRequest() should have succeeded. + PP_DCHECK(cdm_); // Initialize() should have succeeded. if (cdm_) cdm_->ResetDecoder(PpDecryptorStreamTypeToCdmStreamType(decoder_type)); @@ -842,7 +840,7 @@ void CdmWrapper::DecryptAndDecode( PP_DecryptorStreamType decoder_type, pp::Buffer_Dev encrypted_buffer, const PP_EncryptedBlockInfo& encrypted_block_info) { - PP_DCHECK(cdm_); // GenerateKeyRequest() should have succeeded. + PP_DCHECK(cdm_); // Initialize() should have succeeded. // Release a buffer that the caller indicated it is finished with. allocator_.Release(encrypted_block_info.tracking_info.buffer_id); diff --git a/ppapi/api/private/ppb_content_decryptor_private.idl b/ppapi/api/private/ppb_content_decryptor_private.idl index 9a6422d..8859448 100644 --- a/ppapi/api/private/ppb_content_decryptor_private.idl +++ b/ppapi/api/private/ppb_content_decryptor_private.idl @@ -12,7 +12,7 @@ [generate_thunk] label Chrome { - M24 = 0.6 + M31 = 0.7 }; /** @@ -24,35 +24,6 @@ label Chrome { */ interface PPB_ContentDecryptor_Private { /** - * The decryptor requires a key that has not been provided. - * - * Sent when the decryptor encounters encrypted content, but it does not have - * the key required to decrypt the data. The plugin will call this method in - * response to a call to the <code>Decrypt()</code> method on the - * <code>PPP_ContentDecryptor_Private<code> interface. - * - * The browser must notify the application that a key is needed, and, in - * response, the web application must direct the browser to call - * <code>AddKey()</code> on the <code>PPP_ContentDecryptor_Private</code> - * interface. - * - * @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] session_id A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the session ID. - * - * @param[in] init_data A <code>PP_Var</code> of type - * <code>PP_VARTYPE_ARRAY_BUFFER</code> containing container-specific - * initialization data. - */ - void NeedKey( - [in] PP_Instance instance, - [in] PP_Var key_system, - [in] PP_Var session_id, - [in] PP_Var init_data); - - /** * A key has been added as the result of a call to the <code>AddKey()</code> * method on the <code>PPP_ContentDecryptor_Private</code> interface. * diff --git a/ppapi/api/private/ppp_content_decryptor_private.idl b/ppapi/api/private/ppp_content_decryptor_private.idl index c36259a..5eba37a 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.6 + M31 = 0.7 }; /** @@ -21,6 +21,21 @@ label Chrome { */ interface PPP_ContentDecryptor_Private { /** + * Initialize for the specified key system. + * + * @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] can_challenge_platform A <code>PP_Bool</code> that + * indicates if the underlying host platform can be challenged; + * i.e., verified as a trusted platform. + */ + void Initialize( + [in] PP_Instance instance, + [in] PP_Var key_system, + [in] PP_Bool can_challenge_platform); + + /** * Generates a key request. key_system specifies the key or licensing system * to use. type contains the MIME type of init_data. init_data is a data * buffer containing data for use in generating the request. @@ -30,9 +45,6 @@ interface PPP_ContentDecryptor_Private { * browser by the CDM via <code>KeyMessage()</code> on the * <code>PPB_ContentDecryptor_Private</code> interface. * - * @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. * @@ -42,7 +54,6 @@ 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 e42c3c9e..86f239a 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 Mar 28 15:22:02 2013. + * modified Tue Sep 17 11:31:05 2013. */ #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_6 \ - "PPB_ContentDecryptor_Private;0.6" +#define PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_7 \ + "PPB_ContentDecryptor_Private;0.7" #define PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE \ - PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_6 + PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_7 /** * @file @@ -42,34 +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_6 { - /** - * The decryptor requires a key that has not been provided. - * - * Sent when the decryptor encounters encrypted content, but it does not have - * the key required to decrypt the data. The plugin will call this method in - * response to a call to the <code>Decrypt()</code> method on the - * <code>PPP_ContentDecryptor_Private<code> interface. - * - * The browser must notify the application that a key is needed, and, in - * response, the web application must direct the browser to call - * <code>AddKey()</code> on the <code>PPP_ContentDecryptor_Private</code> - * interface. - * - * @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] session_id A <code>PP_Var</code> of type - * <code>PP_VARTYPE_STRING</code> containing the session ID. - * - * @param[in] init_data A <code>PP_Var</code> of type - * <code>PP_VARTYPE_ARRAY_BUFFER</code> containing container-specific - * initialization data. - */ - void (*NeedKey)(PP_Instance instance, - struct PP_Var key_system, - struct PP_Var session_id, - struct PP_Var init_data); +struct PPB_ContentDecryptor_Private_0_7 { /** * A key has been added as the result of a call to the <code>AddKey()</code> * method on the <code>PPP_ContentDecryptor_Private</code> interface. @@ -271,7 +244,7 @@ struct PPB_ContentDecryptor_Private_0_6 { const struct PP_DecryptedBlockInfo* decrypted_block_info); }; -typedef struct PPB_ContentDecryptor_Private_0_6 PPB_ContentDecryptor_Private; +typedef struct PPB_ContentDecryptor_Private_0_7 PPB_ContentDecryptor_Private; /** * @} */ diff --git a/ppapi/c/private/ppp_content_decryptor_private.h b/ppapi/c/private/ppp_content_decryptor_private.h index ff224c0c..69763df 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 Fri Oct 26 15:36:54 2012. + * modified Wed Sep 18 16:14:30 2013. */ #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_6 \ - "PPP_ContentDecryptor_Private;0.6" +#define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_7 \ + "PPP_ContentDecryptor_Private;0.7" #define PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE \ - PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_6 + PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_7 /** * @file @@ -42,7 +42,20 @@ * Decryption Module (CDM) for v0.1 of the proposed Encrypted Media Extensions: * http://goo.gl/rbdnR */ -struct PPP_ContentDecryptor_Private_0_6 { +struct PPP_ContentDecryptor_Private_0_7 { + /** + * Initialize for the specified key system. + * + * @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] can_challenge_platform A <code>PP_Bool</code> that + * indicates if the underlying host platform can be challenged; + * i.e., verified as a trusted platform. + */ + void (*Initialize)(PP_Instance instance, + struct PP_Var key_system, + PP_Bool can_challenge_platform); /** * Generates a key request. key_system specifies the key or licensing system * to use. type contains the MIME type of init_data. init_data is a data @@ -53,9 +66,6 @@ struct PPP_ContentDecryptor_Private_0_6 { * browser by the CDM via <code>KeyMessage()</code> on the * <code>PPB_ContentDecryptor_Private</code> interface. * - * @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. * @@ -64,7 +74,6 @@ struct PPP_ContentDecryptor_Private_0_6 { * initialization data. */ void (*GenerateKeyRequest)(PP_Instance instance, - struct PP_Var key_system, struct PP_Var type, struct PP_Var init_data); /** @@ -226,7 +235,7 @@ struct PPP_ContentDecryptor_Private_0_6 { const struct PP_EncryptedBlockInfo* encrypted_block_info); }; -typedef struct PPP_ContentDecryptor_Private_0_6 PPP_ContentDecryptor_Private; +typedef struct PPP_ContentDecryptor_Private_0_7 PPP_ContentDecryptor_Private; /** * @} */ diff --git a/ppapi/cpp/private/content_decryptor_private.cc b/ppapi/cpp/private/content_decryptor_private.cc index 4869094..23417c3 100644 --- a/ppapi/cpp/private/content_decryptor_private.cc +++ b/ppapi/cpp/private/content_decryptor_private.cc @@ -23,10 +23,9 @@ namespace { static const char kPPPContentDecryptorInterface[] = PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE; -void GenerateKeyRequest(PP_Instance instance, - PP_Var key_system_arg, - PP_Var type_arg, - PP_Var init_data_arg) { +void Initialize(PP_Instance instance, + PP_Var key_system_arg, + PP_Bool can_challenge_platform) { void* object = Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); if (!object) @@ -36,6 +35,19 @@ void GenerateKeyRequest(PP_Instance instance, if (!key_system_var.is_string()) return; + static_cast<ContentDecryptor_Private*>(object)->Initialize( + key_system_var.AsString(), + PP_ToBool(can_challenge_platform)); +} + +void GenerateKeyRequest(PP_Instance instance, + PP_Var type_arg, + PP_Var init_data_arg) { + void* object = + Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); + if (!object) + return; + pp::Var type_var(pp::PASS_REF, type_arg); if (!type_var.is_string()) return; @@ -46,7 +58,6 @@ void GenerateKeyRequest(PP_Instance instance, 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); } @@ -184,6 +195,7 @@ void DecryptAndDecode(PP_Instance instance, } const PPP_ContentDecryptor_Private ppp_content_decryptor = { + &Initialize, &GenerateKeyRequest, &AddKey, &CancelKeyRequest, @@ -214,22 +226,6 @@ ContentDecryptor_Private::~ContentDecryptor_Private() { this); } -void ContentDecryptor_Private::NeedKey(const std::string& key_system, - const std::string& session_id, - pp::VarArrayBuffer init_data) { - // session_id can be empty here. - if (has_interface<PPB_ContentDecryptor_Private>()) { - pp::Var key_system_var(key_system); - pp::Var session_id_var(session_id); - - get_interface<PPB_ContentDecryptor_Private>()->NeedKey( - associated_instance_.pp_instance(), - key_system_var.pp_var(), - session_id_var.pp_var(), - init_data.pp_var()); - } -} - void ContentDecryptor_Private::KeyAdded(const std::string& key_system, const std::string& session_id) { if (has_interface<PPB_ContentDecryptor_Private>()) { diff --git a/ppapi/cpp/private/content_decryptor_private.h b/ppapi/cpp/private/content_decryptor_private.h index 477c6de..a43a74c 100644 --- a/ppapi/cpp/private/content_decryptor_private.h +++ b/ppapi/cpp/private/content_decryptor_private.h @@ -31,8 +31,9 @@ class ContentDecryptor_Private { // TODO(tomfinegan): This could be optimized to pass pp::Var instead of // 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, + virtual void Initialize(const std::string& key_system, + bool can_challenge_platform) = 0; + virtual void GenerateKeyRequest(const std::string& type, pp::VarArrayBuffer init_data) = 0; virtual void AddKey(const std::string& session_id, pp::VarArrayBuffer key, @@ -58,9 +59,6 @@ class ContentDecryptor_Private { // PPB_ContentDecryptor_Private methods for passing data from the decryptor // to the browser. - void NeedKey(const std::string& key_system, - const std::string& session_id, - pp::VarArrayBuffer init_data); void KeyAdded(const std::string& key_system, const std::string& session_id); void KeyMessage(const std::string& key_system, 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 783fd7e..91f9752 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 @@ -191,7 +191,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Selection_Dev_0_3; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_CrxFileSystem_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileIO_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_FileRefPrivate_0_1; @@ -228,7 +228,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_UMA_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDestination_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoSource_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_X509Certificate_Private_0_1; -static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Instance_Private_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_Alarms_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Ext_Events_Dev_0_1; @@ -2319,59 +2319,54 @@ static struct PP_Var Pnacl_M13_PPP_Selection_Dev_GetSelectedText(PP_Instance ins /* Not generating wrapper methods for PPP_Zoom_Dev_0_3 */ -/* Begin wrapper methods for PPB_ContentDecryptor_Private_0_6 */ +/* Begin wrapper methods for PPB_ContentDecryptor_Private_0_7 */ -static 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_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; - iface->NeedKey(instance, *key_system, *session_id, *init_data); -} - -static 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_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; +static void Pnacl_M31_PPB_ContentDecryptor_Private_KeyAdded(PP_Instance instance, struct PP_Var* key_system, struct PP_Var* session_id) { + const struct PPB_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; iface->KeyAdded(instance, *key_system, *session_id); } -static void Pnacl_M24_PPB_ContentDecryptor_Private_KeyMessage(PP_Instance instance, struct PP_Var* key_system, struct PP_Var* session_id, struct PP_Var* message, struct PP_Var* default_url) { - const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; +static void Pnacl_M31_PPB_ContentDecryptor_Private_KeyMessage(PP_Instance instance, struct PP_Var* key_system, struct PP_Var* session_id, struct PP_Var* message, struct PP_Var* default_url) { + const struct PPB_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; iface->KeyMessage(instance, *key_system, *session_id, *message, *default_url); } -static 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_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; +static void Pnacl_M31_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_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; iface->KeyError(instance, *key_system, *session_id, media_error, system_code); } -static 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_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; +static void Pnacl_M31_PPB_ContentDecryptor_Private_DeliverBlock(PP_Instance instance, PP_Resource decrypted_block, const struct PP_DecryptedBlockInfo* decrypted_block_info) { + const struct PPB_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; iface->DeliverBlock(instance, decrypted_block, decrypted_block_info); } -static 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_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; +static void Pnacl_M31_PPB_ContentDecryptor_Private_DecoderInitializeDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id, PP_Bool success) { + const struct PPB_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; iface->DecoderInitializeDone(instance, decoder_type, request_id, success); } -static void Pnacl_M24_PPB_ContentDecryptor_Private_DecoderDeinitializeDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { - const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; +static void Pnacl_M31_PPB_ContentDecryptor_Private_DecoderDeinitializeDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { + const struct PPB_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; iface->DecoderDeinitializeDone(instance, decoder_type, request_id); } -static void Pnacl_M24_PPB_ContentDecryptor_Private_DecoderResetDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { - const struct PPB_ContentDecryptor_Private_0_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; +static void Pnacl_M31_PPB_ContentDecryptor_Private_DecoderResetDone(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { + const struct PPB_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; iface->DecoderResetDone(instance, decoder_type, request_id); } -static 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_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; +static void Pnacl_M31_PPB_ContentDecryptor_Private_DeliverFrame(PP_Instance instance, PP_Resource decrypted_frame, const struct PP_DecryptedFrameInfo* decrypted_frame_info) { + const struct PPB_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; iface->DeliverFrame(instance, decrypted_frame, decrypted_frame_info); } -static 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_6 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6.real_iface; +static void Pnacl_M31_PPB_ContentDecryptor_Private_DeliverSamples(PP_Instance instance, PP_Resource audio_frames, const struct PP_DecryptedBlockInfo* decrypted_block_info) { + const struct PPB_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; iface->DeliverSamples(instance, audio_frames, decrypted_block_info); } -/* End wrapper methods for PPB_ContentDecryptor_Private_0_6 */ +/* End wrapper methods for PPB_ContentDecryptor_Private_0_7 */ /* Begin wrapper methods for PPB_Ext_CrxFileSystem_Private_0_1 */ @@ -3717,72 +3712,79 @@ static void Pnacl_M19_PPB_X509Certificate_Private_GetField(struct PP_Var* _struc /* End wrapper methods for PPB_X509Certificate_Private_0_1 */ -/* Begin wrapper methods for PPP_ContentDecryptor_Private_0_6 */ +/* Begin wrapper methods for PPP_ContentDecryptor_Private_0_7 */ + +static void Pnacl_M31_PPP_ContentDecryptor_Private_Initialize(PP_Instance instance, struct PP_Var key_system, PP_Bool can_challenge_platform) { + const struct PPP_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; + void (*temp_fp)(PP_Instance instance, struct PP_Var* key_system, PP_Bool can_challenge_platform) = + ((void (*)(PP_Instance instance, struct PP_Var* key_system, PP_Bool can_challenge_platform))iface->Initialize); + temp_fp(instance, &key_system, can_challenge_platform); +} -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 (*temp_fp)(PP_Instance instance, struct PP_Var* key_system, struct PP_Var* type, struct PP_Var* init_data) = - ((void (*)(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_M31_PPP_ContentDecryptor_Private_GenerateKeyRequest(PP_Instance instance, struct PP_Var type, struct PP_Var init_data) { + const struct PPP_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; + void (*temp_fp)(PP_Instance instance, struct PP_Var* type, struct PP_Var* init_data) = + ((void (*)(PP_Instance instance, struct PP_Var* type, struct PP_Var* init_data))iface->GenerateKeyRequest); + temp_fp(instance, &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_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface; +static void Pnacl_M31_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_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; void (*temp_fp)(PP_Instance instance, struct PP_Var* session_id, struct PP_Var* key, struct PP_Var* init_data) = ((void (*)(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_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface; +static void Pnacl_M31_PPP_ContentDecryptor_Private_CancelKeyRequest(PP_Instance instance, struct PP_Var session_id) { + const struct PPP_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; void (*temp_fp)(PP_Instance instance, struct PP_Var* session_id) = ((void (*)(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_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface; +static void Pnacl_M31_PPP_ContentDecryptor_Private_Decrypt(PP_Instance instance, PP_Resource encrypted_block, const struct PP_EncryptedBlockInfo* encrypted_block_info) { + const struct PPP_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; void (*temp_fp)(PP_Instance instance, PP_Resource encrypted_block, const struct PP_EncryptedBlockInfo* encrypted_block_info) = ((void (*)(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_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface; +static void Pnacl_M31_PPP_ContentDecryptor_Private_InitializeAudioDecoder(PP_Instance instance, const struct PP_AudioDecoderConfig* decoder_config, PP_Resource codec_extra_data) { + const struct PPP_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; void (*temp_fp)(PP_Instance instance, const struct PP_AudioDecoderConfig* decoder_config, PP_Resource codec_extra_data) = ((void (*)(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_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface; +static void Pnacl_M31_PPP_ContentDecryptor_Private_InitializeVideoDecoder(PP_Instance instance, const struct PP_VideoDecoderConfig* decoder_config, PP_Resource codec_extra_data) { + const struct PPP_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; void (*temp_fp)(PP_Instance instance, const struct PP_VideoDecoderConfig* decoder_config, PP_Resource codec_extra_data) = ((void (*)(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_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface; +static void Pnacl_M31_PPP_ContentDecryptor_Private_DeinitializeDecoder(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { + const struct PPP_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; void (*temp_fp)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) = ((void (*)(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_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface; +static void Pnacl_M31_PPP_ContentDecryptor_Private_ResetDecoder(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { + const struct PPP_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; void (*temp_fp)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) = ((void (*)(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_6 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6.real_iface; +static void Pnacl_M31_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_7 *iface = Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7.real_iface; void (*temp_fp)(PP_Instance instance, PP_DecryptorStreamType decoder_type, PP_Resource encrypted_buffer, const struct PP_EncryptedBlockInfo* encrypted_block_info) = ((void (*)(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_6 */ +/* End wrapper methods for PPP_ContentDecryptor_Private_0_7 */ /* Not generating wrapper methods for PPP_Flash_BrowserOperations_1_0 */ @@ -4654,17 +4656,16 @@ struct PPP_Selection_Dev_0_3 Pnacl_Wrappers_PPP_Selection_Dev_0_3 = { /* Not generating wrapper interface for PPP_Zoom_Dev_0_3 */ -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, struct PP_Var message, struct PP_Var default_url))&Pnacl_M24_PPB_ContentDecryptor_Private_KeyMessage, - .KeyError = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, int32_t media_error, int32_t system_code))&Pnacl_M24_PPB_ContentDecryptor_Private_KeyError, - .DeliverBlock = (void (*)(PP_Instance instance, PP_Resource decrypted_block, const struct PP_DecryptedBlockInfo* decrypted_block_info))&Pnacl_M24_PPB_ContentDecryptor_Private_DeliverBlock, - .DecoderInitializeDone = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id, PP_Bool success))&Pnacl_M24_PPB_ContentDecryptor_Private_DecoderInitializeDone, - .DecoderDeinitializeDone = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))&Pnacl_M24_PPB_ContentDecryptor_Private_DecoderDeinitializeDone, - .DecoderResetDone = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))&Pnacl_M24_PPB_ContentDecryptor_Private_DecoderResetDone, - .DeliverFrame = (void (*)(PP_Instance instance, PP_Resource decrypted_frame, const struct PP_DecryptedFrameInfo* decrypted_frame_info))&Pnacl_M24_PPB_ContentDecryptor_Private_DeliverFrame, - .DeliverSamples = (void (*)(PP_Instance instance, PP_Resource audio_frames, const struct PP_DecryptedBlockInfo* decrypted_block_info))&Pnacl_M24_PPB_ContentDecryptor_Private_DeliverSamples +struct PPB_ContentDecryptor_Private_0_7 Pnacl_Wrappers_PPB_ContentDecryptor_Private_0_7 = { + .KeyAdded = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id))&Pnacl_M31_PPB_ContentDecryptor_Private_KeyAdded, + .KeyMessage = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, struct PP_Var message, struct PP_Var default_url))&Pnacl_M31_PPB_ContentDecryptor_Private_KeyMessage, + .KeyError = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id, int32_t media_error, int32_t system_code))&Pnacl_M31_PPB_ContentDecryptor_Private_KeyError, + .DeliverBlock = (void (*)(PP_Instance instance, PP_Resource decrypted_block, const struct PP_DecryptedBlockInfo* decrypted_block_info))&Pnacl_M31_PPB_ContentDecryptor_Private_DeliverBlock, + .DecoderInitializeDone = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id, PP_Bool success))&Pnacl_M31_PPB_ContentDecryptor_Private_DecoderInitializeDone, + .DecoderDeinitializeDone = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))&Pnacl_M31_PPB_ContentDecryptor_Private_DecoderDeinitializeDone, + .DecoderResetDone = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))&Pnacl_M31_PPB_ContentDecryptor_Private_DecoderResetDone, + .DeliverFrame = (void (*)(PP_Instance instance, PP_Resource decrypted_frame, const struct PP_DecryptedFrameInfo* decrypted_frame_info))&Pnacl_M31_PPB_ContentDecryptor_Private_DeliverFrame, + .DeliverSamples = (void (*)(PP_Instance instance, PP_Resource audio_frames, const struct PP_DecryptedBlockInfo* decrypted_block_info))&Pnacl_M31_PPB_ContentDecryptor_Private_DeliverSamples }; struct PPB_Ext_CrxFileSystem_Private_0_1 Pnacl_Wrappers_PPB_Ext_CrxFileSystem_Private_0_1 = { @@ -5023,16 +5024,17 @@ 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_6 Pnacl_Wrappers_PPP_ContentDecryptor_Private_0_6 = { - .GenerateKeyRequest = &Pnacl_M24_PPP_ContentDecryptor_Private_GenerateKeyRequest, - .AddKey = &Pnacl_M24_PPP_ContentDecryptor_Private_AddKey, - .CancelKeyRequest = &Pnacl_M24_PPP_ContentDecryptor_Private_CancelKeyRequest, - .Decrypt = &Pnacl_M24_PPP_ContentDecryptor_Private_Decrypt, - .InitializeAudioDecoder = &Pnacl_M24_PPP_ContentDecryptor_Private_InitializeAudioDecoder, - .InitializeVideoDecoder = &Pnacl_M24_PPP_ContentDecryptor_Private_InitializeVideoDecoder, - .DeinitializeDecoder = &Pnacl_M24_PPP_ContentDecryptor_Private_DeinitializeDecoder, - .ResetDecoder = &Pnacl_M24_PPP_ContentDecryptor_Private_ResetDecoder, - .DecryptAndDecode = &Pnacl_M24_PPP_ContentDecryptor_Private_DecryptAndDecode +struct PPP_ContentDecryptor_Private_0_7 Pnacl_Wrappers_PPP_ContentDecryptor_Private_0_7 = { + .Initialize = &Pnacl_M31_PPP_ContentDecryptor_Private_Initialize, + .GenerateKeyRequest = &Pnacl_M31_PPP_ContentDecryptor_Private_GenerateKeyRequest, + .AddKey = &Pnacl_M31_PPP_ContentDecryptor_Private_AddKey, + .CancelKeyRequest = &Pnacl_M31_PPP_ContentDecryptor_Private_CancelKeyRequest, + .Decrypt = &Pnacl_M31_PPP_ContentDecryptor_Private_Decrypt, + .InitializeAudioDecoder = &Pnacl_M31_PPP_ContentDecryptor_Private_InitializeAudioDecoder, + .InitializeVideoDecoder = &Pnacl_M31_PPP_ContentDecryptor_Private_InitializeVideoDecoder, + .DeinitializeDecoder = &Pnacl_M31_PPP_ContentDecryptor_Private_DeinitializeDecoder, + .ResetDecoder = &Pnacl_M31_PPP_ContentDecryptor_Private_ResetDecoder, + .DecryptAndDecode = &Pnacl_M31_PPP_ContentDecryptor_Private_DecryptAndDecode }; /* Not generating wrapper interface for PPP_Flash_BrowserOperations_1_0 */ @@ -5435,9 +5437,9 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Selection_Dev_0_3 = { .real_iface = NULL }; -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, +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7 = { + .iface_macro = PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_7, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_ContentDecryptor_Private_0_7, .real_iface = NULL }; @@ -5657,9 +5659,9 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_X509Certificate_Private_0 .real_iface = NULL }; -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, +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7 = { + .iface_macro = PPP_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_7, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPP_ContentDecryptor_Private_0_7, .real_iface = NULL }; @@ -5748,7 +5750,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_2, &Pnacl_WrapperInfo_PPB_VideoCapture_Dev_0_3, &Pnacl_WrapperInfo_PPB_VideoDecoder_Dev_0_16, - &Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_6, + &Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7, &Pnacl_WrapperInfo_PPB_Ext_CrxFileSystem_Private_0_1, &Pnacl_WrapperInfo_PPB_FileIO_Private_0_1, &Pnacl_WrapperInfo_PPB_FileRefPrivate_0_1, @@ -5795,7 +5797,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { static struct __PnaclWrapperInfo *s_ppp_wrappers[] = { &Pnacl_WrapperInfo_PPP_Messaging_1_0, &Pnacl_WrapperInfo_PPP_Selection_Dev_0_3, - &Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_6, + &Pnacl_WrapperInfo_PPP_ContentDecryptor_Private_0_7, &Pnacl_WrapperInfo_PPP_Instance_Private_0_1, NULL }; diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index e386a3f..95bbd8b 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -633,9 +633,12 @@ IPC_MESSAGE_ROUTED3( int32_t /* result */) // PPP_ContentDecryptor_Dev -IPC_MESSAGE_ROUTED4(PpapiMsg_PPPContentDecryptor_GenerateKeyRequest, +IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_Initialize, PP_Instance /* instance */, ppapi::proxy::SerializedVar /* key_system, String */, + bool /* can_challenge_platform */) +IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_GenerateKeyRequest, + PP_Instance /* instance */, ppapi::proxy::SerializedVar /* type, String */, ppapi::proxy::SerializedVar /* init_data, ArrayBuffer */) IPC_MESSAGE_ROUTED4(PpapiMsg_PPPContentDecryptor_AddKey, @@ -968,11 +971,6 @@ IPC_SYNC_MESSAGE_ROUTED2_2( ppapi::proxy::SerializedHandle /* result_shm_handle */) // PPB_ContentDecryptor_Dev messages handled in PPB_Instance_Proxy. -IPC_MESSAGE_ROUTED4(PpapiHostMsg_PPBInstance_NeedKey, - PP_Instance /* instance */, - ppapi::proxy::SerializedVar /* key_system, String */, - ppapi::proxy::SerializedVar /* session_id, String */, - ppapi::proxy::SerializedVar /* init_data, ArrayBuffer */) IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBInstance_KeyAdded, PP_Instance /* instance */, ppapi::proxy::SerializedVar /* key_system, String */, diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc index 4239623..fdaa8c4 100644 --- a/ppapi/proxy/ppb_instance_proxy.cc +++ b/ppapi/proxy/ppb_instance_proxy.cc @@ -175,8 +175,6 @@ bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { OnHostMsgGetPluginInstanceURL) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginReferrerURL, OnHostMsgGetPluginReferrerURL) - IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_NeedKey, - OnHostMsgNeedKey) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyAdded, OnHostMsgKeyAdded) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyMessage, @@ -539,19 +537,6 @@ PP_Var PPB_Instance_Proxy::GetPluginReferrerURL( components); } -void PPB_Instance_Proxy::NeedKey(PP_Instance instance, - PP_Var key_system, - PP_Var session_id, - PP_Var init_data) { - dispatcher()->Send( - new PpapiHostMsg_PPBInstance_NeedKey( - API_ID_PPB_INSTANCE, - instance, - SerializedVarSendInput(dispatcher(), key_system), - SerializedVarSendInput(dispatcher(), session_id), - SerializedVarSendInput(dispatcher(), init_data))); -} - void PPB_Instance_Proxy::KeyAdded(PP_Instance instance, PP_Var key_system, PP_Var session_id) { @@ -1057,21 +1042,6 @@ void PPB_Instance_Proxy::OnHostMsgGetPluginReferrerURL( } } -void PPB_Instance_Proxy::OnHostMsgNeedKey(PP_Instance instance, - SerializedVarReceiveInput key_system, - SerializedVarReceiveInput session_id, - SerializedVarReceiveInput init_data) { - if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) - return; - EnterInstanceNoLock enter(instance); - if (enter.succeeded()) { - enter.functions()->NeedKey(instance, - key_system.Get(dispatcher()), - session_id.Get(dispatcher()), - init_data.Get(dispatcher())); - } -} - void PPB_Instance_Proxy::OnHostMsgKeyAdded( PP_Instance instance, SerializedVarReceiveInput key_system, diff --git a/ppapi/proxy/ppb_instance_proxy.h b/ppapi/proxy/ppb_instance_proxy.h index 6dff87c..a6516bc 100644 --- a/ppapi/proxy/ppb_instance_proxy.h +++ b/ppapi/proxy/ppb_instance_proxy.h @@ -117,10 +117,6 @@ class PPB_Instance_Proxy : public InterfaceProxy, virtual PP_Var GetPluginReferrerURL( PP_Instance instance, PP_URLComponents_Dev* components) OVERRIDE; - virtual void NeedKey(PP_Instance instance, - PP_Var key_system, - PP_Var session_id, - PP_Var init_data) OVERRIDE; virtual void KeyAdded(PP_Instance instance, PP_Var key_system, PP_Var session_id) OVERRIDE; @@ -223,10 +219,6 @@ class PPB_Instance_Proxy : public InterfaceProxy, SerializedVarReturnValue result); void OnHostMsgGetPluginReferrerURL(PP_Instance instance, SerializedVarReturnValue result); - virtual void OnHostMsgNeedKey(PP_Instance instance, - SerializedVarReceiveInput key_system, - SerializedVarReceiveInput session_id, - SerializedVarReceiveInput init_data); virtual void OnHostMsgKeyAdded(PP_Instance instance, SerializedVarReceiveInput key_system, SerializedVarReceiveInput session_id); diff --git a/ppapi/proxy/ppp_content_decryptor_private_proxy.cc b/ppapi/proxy/ppp_content_decryptor_private_proxy.cc index f986e7f..d32e632 100644 --- a/ppapi/proxy/ppp_content_decryptor_private_proxy.cc +++ b/ppapi/proxy/ppp_content_decryptor_private_proxy.cc @@ -109,8 +109,24 @@ bool InitializePppDecryptorBuffer(PP_Instance instance, return true; } +void Initialize(PP_Instance instance, + PP_Var key_system, + PP_Bool can_challenge_platform) { + HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); + if (!dispatcher) { + NOTREACHED(); + return; + } + + dispatcher->Send( + new PpapiMsg_PPPContentDecryptor_Initialize( + API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, + instance, + SerializedVarSendInput(dispatcher, key_system), + PP_ToBool(can_challenge_platform))); +} + void GenerateKeyRequest(PP_Instance instance, - PP_Var key_system, PP_Var type, PP_Var init_data) { HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); @@ -123,7 +139,6 @@ void GenerateKeyRequest(PP_Instance instance, new PpapiMsg_PPPContentDecryptor_GenerateKeyRequest( API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, instance, - SerializedVarSendInput(dispatcher, key_system), SerializedVarSendInput(dispatcher, type), SerializedVarSendInput(dispatcher, init_data))); } @@ -349,6 +364,7 @@ void DecryptAndDecode(PP_Instance instance, } static const PPP_ContentDecryptor_Private content_decryptor_interface = { + &Initialize, &GenerateKeyRequest, &AddKey, &CancelKeyRequest, @@ -390,6 +406,8 @@ bool PPP_ContentDecryptor_Private_Proxy::OnMessageReceived( bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPP_ContentDecryptor_Private_Proxy, msg) + IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_Initialize, + OnMsgInitialize) IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_GenerateKeyRequest, OnMsgGenerateKeyRequest) IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_AddKey, @@ -414,15 +432,26 @@ bool PPP_ContentDecryptor_Private_Proxy::OnMessageReceived( return handled; } -void PPP_ContentDecryptor_Private_Proxy::OnMsgGenerateKeyRequest( +void PPP_ContentDecryptor_Private_Proxy::OnMsgInitialize( PP_Instance instance, SerializedVarReceiveInput key_system, + bool can_challenge_platform) { + if (ppp_decryptor_impl_) { + CallWhileUnlocked( + ppp_decryptor_impl_->Initialize, + instance, + ExtractReceivedVarAndAddRef(dispatcher(), &key_system), + PP_FromBool(can_challenge_platform)); + } +} + +void PPP_ContentDecryptor_Private_Proxy::OnMsgGenerateKeyRequest( + PP_Instance instance, 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 5e7ecc8..2e4ad854 100644 --- a/ppapi/proxy/ppp_content_decryptor_private_proxy.h +++ b/ppapi/proxy/ppp_content_decryptor_private_proxy.h @@ -30,8 +30,10 @@ class PPP_ContentDecryptor_Private_Proxy : public InterfaceProxy { virtual bool OnMessageReceived(const IPC::Message& msg); // Message handlers. + void OnMsgInitialize(PP_Instance instance, + SerializedVarReceiveInput key_system, + bool can_challenge_platform); void OnMsgGenerateKeyRequest(PP_Instance instance, - SerializedVarReceiveInput key_system, SerializedVarReceiveInput type, SerializedVarReceiveInput init_data); void OnMsgAddKey(PP_Instance instance, diff --git a/ppapi/thunk/interfaces_ppb_private.h b/ppapi/thunk/interfaces_ppb_private.h index 84ca5e3..038d5c5 100644 --- a/ppapi/thunk/interfaces_ppb_private.h +++ b/ppapi/thunk/interfaces_ppb_private.h @@ -25,8 +25,8 @@ PROXIED_IFACE(PPB_Broker, PPB_BROKER_TRUSTED_INTERFACE_0_3, PROXIED_IFACE(PPB_Instance, PPB_BROWSERFONT_TRUSTED_INTERFACE_1_0, PPB_BrowserFont_Trusted_1_0) PROXIED_IFACE(PPB_Instance, - PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_6, - PPB_ContentDecryptor_Private_0_6) + PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE_0_7, + PPB_ContentDecryptor_Private_0_7) 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 9450eed..7fe79e1 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 Tue Apr 16 11:25:44 2013. +// modified Tue Sep 17 11:31:05 2013. #include "ppapi/c/pp_errors.h" #include "ppapi/c/private/ppb_content_decryptor_private.h" @@ -18,17 +18,6 @@ namespace thunk { namespace { -void NeedKey(PP_Instance instance, - struct PP_Var key_system, - struct PP_Var session_id, - struct PP_Var init_data) { - VLOG(4) << "PPB_ContentDecryptor_Private::NeedKey()"; - EnterInstance enter(instance); - if (enter.failed()) - return; - enter.functions()->NeedKey(instance, key_system, session_id, init_data); -} - void KeyAdded(PP_Instance instance, struct PP_Var key_system, struct PP_Var session_id) { @@ -144,9 +133,8 @@ void DeliverSamples( decrypted_block_info); } -const PPB_ContentDecryptor_Private_0_6 - g_ppb_contentdecryptor_private_thunk_0_6 = { - &NeedKey, +const PPB_ContentDecryptor_Private_0_7 + g_ppb_contentdecryptor_private_thunk_0_7 = { &KeyAdded, &KeyMessage, &KeyError, @@ -160,9 +148,9 @@ const PPB_ContentDecryptor_Private_0_6 } // namespace -const PPB_ContentDecryptor_Private_0_6* - GetPPB_ContentDecryptor_Private_0_6_Thunk() { - return &g_ppb_contentdecryptor_private_thunk_0_6; +const PPB_ContentDecryptor_Private_0_7* + GetPPB_ContentDecryptor_Private_0_7_Thunk() { + return &g_ppb_contentdecryptor_private_thunk_0_7; } } // namespace thunk diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h index 72904d4..0d424a5 100644 --- a/ppapi/thunk/ppb_instance_api.h +++ b/ppapi/thunk/ppb_instance_api.h @@ -142,10 +142,6 @@ class PPB_Instance_API { PP_URLComponents_Dev* components) = 0; #if !defined(OS_NACL) // Content Decryptor. - virtual void NeedKey(PP_Instance instance, - PP_Var key_system, - PP_Var session_id, - PP_Var init_data) = 0; virtual void KeyAdded(PP_Instance instance, PP_Var key_system, PP_Var session_id) = 0; |