Chromium Code Reviews| Index: ppapi/proxy/ppp_content_decryptor_private_proxy.cc |
| diff --git a/ppapi/proxy/ppp_content_decryptor_private_proxy.cc b/ppapi/proxy/ppp_content_decryptor_private_proxy.cc |
| index f986e7f8d7214dbbb3efbaa9a3751bef30be2ad0..b60ce90607cc59e248c28a669bbdc85a0dc6aeda 100644 |
| --- a/ppapi/proxy/ppp_content_decryptor_private_proxy.cc |
| +++ b/ppapi/proxy/ppp_content_decryptor_private_proxy.cc |
| @@ -109,8 +109,30 @@ bool InitializePppDecryptorBuffer(PP_Instance instance, |
| return true; |
| } |
| +void Initialize(PP_Instance instance, |
| + PP_Var key_system, |
| + const PP_KeySystemFlags* key_system_flags) { |
| + HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
| + if (!dispatcher) { |
| + NOTREACHED(); |
| + return; |
| + } |
| + |
| + std::string serialized_flags; |
| + if (!SerializeBlockInfo(*key_system_flags, &serialized_flags)) { |
| + NOTREACHED(); |
| + return; |
| + } |
| + |
| + dispatcher->Send( |
| + new PpapiMsg_PPPContentDecryptor_Initialize( |
| + API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, |
| + instance, |
| + SerializedVarSendInput(dispatcher, key_system), |
| + serialized_flags)); |
| +} |
| + |
| void GenerateKeyRequest(PP_Instance instance, |
| - PP_Var key_system, |
| PP_Var type, |
| PP_Var init_data) { |
| HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
| @@ -123,7 +145,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 +370,7 @@ void DecryptAndDecode(PP_Instance instance, |
| } |
| static const PPP_ContentDecryptor_Private content_decryptor_interface = { |
| + &Initialize, |
| &GenerateKeyRequest, |
| &AddKey, |
| &CancelKeyRequest, |
| @@ -390,6 +412,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 +438,28 @@ 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, |
| + const std::string& serialized_key_systems_flags) { |
| + if (ppp_decryptor_impl_) { |
| + PP_KeySystemFlags key_system_flags; |
| + if (!DeserializeBlockInfo(serialized_key_systems_flags, &key_system_flags)) |
|
dmichael (off chromium)
2013/09/18 22:52:32
hmm, I probably never should have lgtmed Deseriali
jrummell
2013/09/19 00:37:28
Switched to pass a bool, and avoid the serializati
|
| + return; |
| + CallWhileUnlocked(ppp_decryptor_impl_->Initialize, |
| + instance, |
| + ExtractReceivedVarAndAddRef(dispatcher(), &key_system), |
| + const_cast<const PP_KeySystemFlags*>(&key_system_flags)); |
|
ddorwin
2013/09/18 22:22:24
There's no way to pass structs by value or const r
dmichael (off chromium)
2013/09/18 22:52:32
No const-ref in C. You could technically use by-va
|
| + } |
| +} |
| + |
| +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)); |
| } |