Chromium Code Reviews| Index: ppapi/cpp/private/content_decryptor_private.cc |
| diff --git a/ppapi/cpp/private/content_decryptor_private.cc b/ppapi/cpp/private/content_decryptor_private.cc |
| index 48690946128a21fba778128bb6b4280a333df6d9..e60a7124f005023034ded43dc49263d9dcb3ab9d 100644 |
| --- a/ppapi/cpp/private/content_decryptor_private.cc |
| +++ b/ppapi/cpp/private/content_decryptor_private.cc |
| @@ -23,10 +23,8 @@ 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) { |
|
xhwang
2013/09/18 00:07:18
nit: one line
jrummell
2013/09/18 21:01:15
Added additional parameter, so it doesn't fit anym
|
| void* object = |
| Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); |
| if (!object) |
| @@ -36,6 +34,18 @@ void GenerateKeyRequest(PP_Instance instance, |
| if (!key_system_var.is_string()) |
| return; |
| + static_cast<ContentDecryptor_Private*>(object)->Initialize( |
| + key_system_var.AsString()); |
| +} |
| + |
| +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 +56,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 +193,7 @@ void DecryptAndDecode(PP_Instance instance, |
| } |
| const PPP_ContentDecryptor_Private ppp_content_decryptor = { |
| + &Initialize, |
| &GenerateKeyRequest, |
| &AddKey, |
| &CancelKeyRequest, |
| @@ -214,22 +224,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>()) { |