| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ppapi/proxy/ppp_content_decryptor_private_proxy.h" | 5 #include "ppapi/proxy/ppp_content_decryptor_private_proxy.h" |
| 6 | 6 |
| 7 #include "base/platform_file.h" | 7 #include "base/platform_file.h" |
| 8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
| 9 #include "ppapi/c/ppb_core.h" | 9 #include "ppapi/c/ppb_core.h" |
| 10 #include "ppapi/proxy/content_decryptor_private_serializer.h" | 10 #include "ppapi/proxy/content_decryptor_private_serializer.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 } | 118 } |
| 119 | 119 |
| 120 dispatcher->Send( | 120 dispatcher->Send( |
| 121 new PpapiMsg_PPPContentDecryptor_Initialize( | 121 new PpapiMsg_PPPContentDecryptor_Initialize( |
| 122 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, | 122 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, |
| 123 instance, | 123 instance, |
| 124 SerializedVarSendInput(dispatcher, key_system))); | 124 SerializedVarSendInput(dispatcher, key_system))); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void CreateSession(PP_Instance instance, | 127 void CreateSession(PP_Instance instance, |
| 128 uint32_t reference_id, | 128 uint32_t session_id, |
| 129 PP_Var type, | 129 PP_Var type, |
| 130 PP_Var init_data) { | 130 PP_Var init_data) { |
| 131 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); | 131 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
| 132 if (!dispatcher) { | 132 if (!dispatcher) { |
| 133 NOTREACHED(); | 133 NOTREACHED(); |
| 134 return; | 134 return; |
| 135 } | 135 } |
| 136 | 136 |
| 137 dispatcher->Send(new PpapiMsg_PPPContentDecryptor_CreateSession( | 137 dispatcher->Send(new PpapiMsg_PPPContentDecryptor_CreateSession( |
| 138 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, | 138 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, |
| 139 instance, | 139 instance, |
| 140 reference_id, | 140 session_id, |
| 141 SerializedVarSendInput(dispatcher, type), | 141 SerializedVarSendInput(dispatcher, type), |
| 142 SerializedVarSendInput(dispatcher, init_data))); | 142 SerializedVarSendInput(dispatcher, init_data))); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void UpdateSession(PP_Instance instance, | 145 void UpdateSession(PP_Instance instance, uint32_t session_id, PP_Var response) { |
| 146 uint32_t reference_id, | |
| 147 PP_Var response) { | |
| 148 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); | 146 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
| 149 if (!dispatcher) { | 147 if (!dispatcher) { |
| 150 NOTREACHED(); | 148 NOTREACHED(); |
| 151 return; | 149 return; |
| 152 } | 150 } |
| 153 | 151 |
| 154 dispatcher->Send(new PpapiMsg_PPPContentDecryptor_UpdateSession( | 152 dispatcher->Send(new PpapiMsg_PPPContentDecryptor_UpdateSession( |
| 155 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, | 153 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, |
| 156 instance, | 154 instance, |
| 157 reference_id, | 155 session_id, |
| 158 SerializedVarSendInput(dispatcher, response))); | 156 SerializedVarSendInput(dispatcher, response))); |
| 159 } | 157 } |
| 160 | 158 |
| 161 void ReleaseSession(PP_Instance instance, uint32_t reference_id) { | 159 void ReleaseSession(PP_Instance instance, uint32_t session_id) { |
| 162 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); | 160 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
| 163 if (!dispatcher) { | 161 if (!dispatcher) { |
| 164 NOTREACHED(); | 162 NOTREACHED(); |
| 165 return; | 163 return; |
| 166 } | 164 } |
| 167 | 165 |
| 168 dispatcher->Send(new PpapiMsg_PPPContentDecryptor_ReleaseSession( | 166 dispatcher->Send(new PpapiMsg_PPPContentDecryptor_ReleaseSession( |
| 169 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, instance, reference_id)); | 167 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, instance, session_id)); |
| 170 } | 168 } |
| 171 | 169 |
| 172 void Decrypt(PP_Instance instance, | 170 void Decrypt(PP_Instance instance, |
| 173 PP_Resource encrypted_block, | 171 PP_Resource encrypted_block, |
| 174 const PP_EncryptedBlockInfo* encrypted_block_info) { | 172 const PP_EncryptedBlockInfo* encrypted_block_info) { |
| 175 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); | 173 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
| 176 if (!dispatcher) { | 174 if (!dispatcher) { |
| 177 NOTREACHED(); | 175 NOTREACHED(); |
| 178 return; | 176 return; |
| 179 } | 177 } |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 if (ppp_decryptor_impl_) { | 429 if (ppp_decryptor_impl_) { |
| 432 CallWhileUnlocked( | 430 CallWhileUnlocked( |
| 433 ppp_decryptor_impl_->Initialize, | 431 ppp_decryptor_impl_->Initialize, |
| 434 instance, | 432 instance, |
| 435 ExtractReceivedVarAndAddRef(dispatcher(), &key_system)); | 433 ExtractReceivedVarAndAddRef(dispatcher(), &key_system)); |
| 436 } | 434 } |
| 437 } | 435 } |
| 438 | 436 |
| 439 void PPP_ContentDecryptor_Private_Proxy::OnMsgCreateSession( | 437 void PPP_ContentDecryptor_Private_Proxy::OnMsgCreateSession( |
| 440 PP_Instance instance, | 438 PP_Instance instance, |
| 441 uint32_t reference_id, | 439 uint32_t session_id, |
| 442 SerializedVarReceiveInput type, | 440 SerializedVarReceiveInput type, |
| 443 SerializedVarReceiveInput init_data) { | 441 SerializedVarReceiveInput init_data) { |
| 444 if (ppp_decryptor_impl_) { | 442 if (ppp_decryptor_impl_) { |
| 445 CallWhileUnlocked(ppp_decryptor_impl_->CreateSession, | 443 CallWhileUnlocked(ppp_decryptor_impl_->CreateSession, |
| 446 instance, | 444 instance, |
| 447 reference_id, | 445 session_id, |
| 448 ExtractReceivedVarAndAddRef(dispatcher(), &type), | 446 ExtractReceivedVarAndAddRef(dispatcher(), &type), |
| 449 ExtractReceivedVarAndAddRef(dispatcher(), &init_data)); | 447 ExtractReceivedVarAndAddRef(dispatcher(), &init_data)); |
| 450 } | 448 } |
| 451 } | 449 } |
| 452 | 450 |
| 453 void PPP_ContentDecryptor_Private_Proxy::OnMsgUpdateSession( | 451 void PPP_ContentDecryptor_Private_Proxy::OnMsgUpdateSession( |
| 454 PP_Instance instance, | 452 PP_Instance instance, |
| 455 uint32_t reference_id, | 453 uint32_t session_id, |
| 456 SerializedVarReceiveInput response) { | 454 SerializedVarReceiveInput response) { |
| 457 if (ppp_decryptor_impl_) { | 455 if (ppp_decryptor_impl_) { |
| 458 CallWhileUnlocked(ppp_decryptor_impl_->UpdateSession, | 456 CallWhileUnlocked(ppp_decryptor_impl_->UpdateSession, |
| 459 instance, | 457 instance, |
| 460 reference_id, | 458 session_id, |
| 461 ExtractReceivedVarAndAddRef(dispatcher(), &response)); | 459 ExtractReceivedVarAndAddRef(dispatcher(), &response)); |
| 462 } | 460 } |
| 463 } | 461 } |
| 464 | 462 |
| 465 void PPP_ContentDecryptor_Private_Proxy::OnMsgReleaseSession( | 463 void PPP_ContentDecryptor_Private_Proxy::OnMsgReleaseSession( |
| 466 PP_Instance instance, | 464 PP_Instance instance, |
| 467 uint32_t reference_id) { | 465 uint32_t session_id) { |
| 468 if (ppp_decryptor_impl_) { | 466 if (ppp_decryptor_impl_) { |
| 469 CallWhileUnlocked(ppp_decryptor_impl_->ReleaseSession, | 467 CallWhileUnlocked(ppp_decryptor_impl_->ReleaseSession, |
| 470 instance, | 468 instance, |
| 471 reference_id); | 469 session_id); |
| 472 } | 470 } |
| 473 } | 471 } |
| 474 | 472 |
| 475 void PPP_ContentDecryptor_Private_Proxy::OnMsgDecrypt( | 473 void PPP_ContentDecryptor_Private_Proxy::OnMsgDecrypt( |
| 476 PP_Instance instance, | 474 PP_Instance instance, |
| 477 const PPPDecryptor_Buffer& encrypted_buffer, | 475 const PPPDecryptor_Buffer& encrypted_buffer, |
| 478 const std::string& serialized_block_info) { | 476 const std::string& serialized_block_info) { |
| 479 ScopedPPResource plugin_resource( | 477 ScopedPPResource plugin_resource( |
| 480 ScopedPPResource::PassRef(), | 478 ScopedPPResource::PassRef(), |
| 481 PPB_Buffer_Proxy::AddProxyResource(encrypted_buffer.resource, | 479 PPB_Buffer_Proxy::AddProxyResource(encrypted_buffer.resource, |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 ppp_decryptor_impl_->DecryptAndDecode, | 590 ppp_decryptor_impl_->DecryptAndDecode, |
| 593 instance, | 591 instance, |
| 594 decoder_type, | 592 decoder_type, |
| 595 plugin_resource.get(), | 593 plugin_resource.get(), |
| 596 const_cast<const PP_EncryptedBlockInfo*>(&block_info)); | 594 const_cast<const PP_EncryptedBlockInfo*>(&block_info)); |
| 597 } | 595 } |
| 598 } | 596 } |
| 599 | 597 |
| 600 } // namespace proxy | 598 } // namespace proxy |
| 601 } // namespace ppapi | 599 } // namespace ppapi |
| OLD | NEW |