| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return false; | 124 return false; |
| 125 | 125 |
| 126 buffer->resource = host_resource; | 126 buffer->resource = host_resource; |
| 127 buffer->handle = handle; | 127 buffer->handle = handle; |
| 128 buffer->size = size; | 128 buffer->size = size; |
| 129 return true; | 129 return true; |
| 130 } | 130 } |
| 131 | 131 |
| 132 void GenerateKeyRequest(PP_Instance instance, | 132 void GenerateKeyRequest(PP_Instance instance, |
| 133 PP_Var key_system, | 133 PP_Var key_system, |
| 134 PP_Var type, |
| 134 PP_Var init_data) { | 135 PP_Var init_data) { |
| 135 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); | 136 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
| 136 if (!dispatcher) { | 137 if (!dispatcher) { |
| 137 NOTREACHED(); | 138 NOTREACHED(); |
| 138 return; | 139 return; |
| 139 } | 140 } |
| 140 | 141 |
| 141 dispatcher->Send( | 142 dispatcher->Send( |
| 142 new PpapiMsg_PPPContentDecryptor_GenerateKeyRequest( | 143 new PpapiMsg_PPPContentDecryptor_GenerateKeyRequest( |
| 143 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, | 144 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, |
| 144 instance, | 145 instance, |
| 145 SerializedVarSendInput(dispatcher, key_system), | 146 SerializedVarSendInput(dispatcher, key_system), |
| 147 SerializedVarSendInput(dispatcher, type), |
| 146 SerializedVarSendInput(dispatcher, init_data))); | 148 SerializedVarSendInput(dispatcher, init_data))); |
| 147 } | 149 } |
| 148 | 150 |
| 149 void AddKey(PP_Instance instance, | 151 void AddKey(PP_Instance instance, |
| 150 PP_Var session_id, | 152 PP_Var session_id, |
| 151 PP_Var key, | 153 PP_Var key, |
| 152 PP_Var init_data) { | 154 PP_Var init_data) { |
| 153 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); | 155 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
| 154 if (!dispatcher) { | 156 if (!dispatcher) { |
| 155 NOTREACHED(); | 157 NOTREACHED(); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 OnMsgDecryptAndDecode) | 406 OnMsgDecryptAndDecode) |
| 405 IPC_MESSAGE_UNHANDLED(handled = false) | 407 IPC_MESSAGE_UNHANDLED(handled = false) |
| 406 IPC_END_MESSAGE_MAP() | 408 IPC_END_MESSAGE_MAP() |
| 407 DCHECK(handled); | 409 DCHECK(handled); |
| 408 return handled; | 410 return handled; |
| 409 } | 411 } |
| 410 | 412 |
| 411 void PPP_ContentDecryptor_Private_Proxy::OnMsgGenerateKeyRequest( | 413 void PPP_ContentDecryptor_Private_Proxy::OnMsgGenerateKeyRequest( |
| 412 PP_Instance instance, | 414 PP_Instance instance, |
| 413 SerializedVarReceiveInput key_system, | 415 SerializedVarReceiveInput key_system, |
| 416 SerializedVarReceiveInput type, |
| 414 SerializedVarReceiveInput init_data) { | 417 SerializedVarReceiveInput init_data) { |
| 415 if (ppp_decryptor_impl_) { | 418 if (ppp_decryptor_impl_) { |
| 416 CallWhileUnlocked(ppp_decryptor_impl_->GenerateKeyRequest, | 419 CallWhileUnlocked(ppp_decryptor_impl_->GenerateKeyRequest, |
| 417 instance, | 420 instance, |
| 418 ExtractReceivedVarAndAddRef(dispatcher(), &key_system), | 421 ExtractReceivedVarAndAddRef(dispatcher(), &key_system), |
| 422 ExtractReceivedVarAndAddRef(dispatcher(), &type), |
| 419 ExtractReceivedVarAndAddRef(dispatcher(), &init_data)); | 423 ExtractReceivedVarAndAddRef(dispatcher(), &init_data)); |
| 420 } | 424 } |
| 421 } | 425 } |
| 422 | 426 |
| 423 void PPP_ContentDecryptor_Private_Proxy::OnMsgAddKey( | 427 void PPP_ContentDecryptor_Private_Proxy::OnMsgAddKey( |
| 424 PP_Instance instance, | 428 PP_Instance instance, |
| 425 SerializedVarReceiveInput session_id, | 429 SerializedVarReceiveInput session_id, |
| 426 SerializedVarReceiveInput key, | 430 SerializedVarReceiveInput key, |
| 427 SerializedVarReceiveInput init_data) { | 431 SerializedVarReceiveInput init_data) { |
| 428 if (ppp_decryptor_impl_) { | 432 if (ppp_decryptor_impl_) { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 ppp_decryptor_impl_->DecryptAndDecode, | 567 ppp_decryptor_impl_->DecryptAndDecode, |
| 564 instance, | 568 instance, |
| 565 decoder_type, | 569 decoder_type, |
| 566 plugin_resource, | 570 plugin_resource, |
| 567 const_cast<const PP_EncryptedBlockInfo*>(&block_info)); | 571 const_cast<const PP_EncryptedBlockInfo*>(&block_info)); |
| 568 } | 572 } |
| 569 } | 573 } |
| 570 | 574 |
| 571 } // namespace proxy | 575 } // namespace proxy |
| 572 } // namespace ppapi | 576 } // namespace ppapi |
| OLD | NEW |