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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 session_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 LoadSession(PP_Instance instance, |
| 146 uint32_t session_id, |
| 147 PP_Var web_session_id) { |
| 148 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
| 149 if (!dispatcher) { |
| 150 NOTREACHED(); |
| 151 return; |
| 152 } |
| 153 |
| 154 dispatcher->Send(new PpapiMsg_PPPContentDecryptor_LoadSession( |
| 155 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, |
| 156 instance, |
| 157 session_id, |
| 158 SerializedVarSendInput(dispatcher, web_session_id))); |
| 159 } |
| 160 |
145 void UpdateSession(PP_Instance instance, uint32_t session_id, PP_Var response) { | 161 void UpdateSession(PP_Instance instance, uint32_t session_id, PP_Var response) { |
146 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); | 162 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
147 if (!dispatcher) { | 163 if (!dispatcher) { |
148 NOTREACHED(); | 164 NOTREACHED(); |
149 return; | 165 return; |
150 } | 166 } |
151 | 167 |
152 dispatcher->Send(new PpapiMsg_PPPContentDecryptor_UpdateSession( | 168 dispatcher->Send(new PpapiMsg_PPPContentDecryptor_UpdateSession( |
153 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, | 169 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, |
154 instance, | 170 instance, |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, | 366 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, |
351 instance, | 367 instance, |
352 decoder_type, | 368 decoder_type, |
353 buffer, | 369 buffer, |
354 serialized_block_info)); | 370 serialized_block_info)); |
355 } | 371 } |
356 | 372 |
357 static const PPP_ContentDecryptor_Private content_decryptor_interface = { | 373 static const PPP_ContentDecryptor_Private content_decryptor_interface = { |
358 &Initialize, | 374 &Initialize, |
359 &CreateSession, | 375 &CreateSession, |
| 376 &LoadSession, |
360 &UpdateSession, | 377 &UpdateSession, |
361 &ReleaseSession, | 378 &ReleaseSession, |
362 &Decrypt, | 379 &Decrypt, |
363 &InitializeAudioDecoder, | 380 &InitializeAudioDecoder, |
364 &InitializeVideoDecoder, | 381 &InitializeVideoDecoder, |
365 &DeinitializeDecoder, | 382 &DeinitializeDecoder, |
366 &ResetDecoder, | 383 &ResetDecoder, |
367 &DecryptAndDecode | 384 &DecryptAndDecode |
368 }; | 385 }; |
369 | 386 |
(...skipping 24 matching lines...) Expand all Loading... |
394 if (!dispatcher()->IsPlugin()) | 411 if (!dispatcher()->IsPlugin()) |
395 return false; // These are only valid from host->plugin. | 412 return false; // These are only valid from host->plugin. |
396 // Don't allow the plugin to send these to the host. | 413 // Don't allow the plugin to send these to the host. |
397 | 414 |
398 bool handled = true; | 415 bool handled = true; |
399 IPC_BEGIN_MESSAGE_MAP(PPP_ContentDecryptor_Private_Proxy, msg) | 416 IPC_BEGIN_MESSAGE_MAP(PPP_ContentDecryptor_Private_Proxy, msg) |
400 IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_Initialize, | 417 IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_Initialize, |
401 OnMsgInitialize) | 418 OnMsgInitialize) |
402 IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_CreateSession, | 419 IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_CreateSession, |
403 OnMsgCreateSession) | 420 OnMsgCreateSession) |
| 421 IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_LoadSession, |
| 422 OnMsgLoadSession) |
404 IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_UpdateSession, | 423 IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_UpdateSession, |
405 OnMsgUpdateSession) | 424 OnMsgUpdateSession) |
406 IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_ReleaseSession, | 425 IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_ReleaseSession, |
407 OnMsgReleaseSession) | 426 OnMsgReleaseSession) |
408 IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_Decrypt, | 427 IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_Decrypt, |
409 OnMsgDecrypt) | 428 OnMsgDecrypt) |
410 IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_InitializeAudioDecoder, | 429 IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_InitializeAudioDecoder, |
411 OnMsgInitializeAudioDecoder) | 430 OnMsgInitializeAudioDecoder) |
412 IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_InitializeVideoDecoder, | 431 IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_InitializeVideoDecoder, |
413 OnMsgInitializeVideoDecoder) | 432 OnMsgInitializeVideoDecoder) |
(...skipping 27 matching lines...) Expand all Loading... |
441 SerializedVarReceiveInput init_data) { | 460 SerializedVarReceiveInput init_data) { |
442 if (ppp_decryptor_impl_) { | 461 if (ppp_decryptor_impl_) { |
443 CallWhileUnlocked(ppp_decryptor_impl_->CreateSession, | 462 CallWhileUnlocked(ppp_decryptor_impl_->CreateSession, |
444 instance, | 463 instance, |
445 session_id, | 464 session_id, |
446 ExtractReceivedVarAndAddRef(dispatcher(), &type), | 465 ExtractReceivedVarAndAddRef(dispatcher(), &type), |
447 ExtractReceivedVarAndAddRef(dispatcher(), &init_data)); | 466 ExtractReceivedVarAndAddRef(dispatcher(), &init_data)); |
448 } | 467 } |
449 } | 468 } |
450 | 469 |
| 470 void PPP_ContentDecryptor_Private_Proxy::OnMsgLoadSession( |
| 471 PP_Instance instance, |
| 472 uint32_t session_id, |
| 473 SerializedVarReceiveInput web_session_id) { |
| 474 if (ppp_decryptor_impl_) { |
| 475 CallWhileUnlocked( |
| 476 ppp_decryptor_impl_->LoadSession, |
| 477 instance, |
| 478 session_id, |
| 479 ExtractReceivedVarAndAddRef(dispatcher(), &web_session_id)); |
| 480 } |
| 481 } |
| 482 |
451 void PPP_ContentDecryptor_Private_Proxy::OnMsgUpdateSession( | 483 void PPP_ContentDecryptor_Private_Proxy::OnMsgUpdateSession( |
452 PP_Instance instance, | 484 PP_Instance instance, |
453 uint32_t session_id, | 485 uint32_t session_id, |
454 SerializedVarReceiveInput response) { | 486 SerializedVarReceiveInput response) { |
455 if (ppp_decryptor_impl_) { | 487 if (ppp_decryptor_impl_) { |
456 CallWhileUnlocked(ppp_decryptor_impl_->UpdateSession, | 488 CallWhileUnlocked(ppp_decryptor_impl_->UpdateSession, |
457 instance, | 489 instance, |
458 session_id, | 490 session_id, |
459 ExtractReceivedVarAndAddRef(dispatcher(), &response)); | 491 ExtractReceivedVarAndAddRef(dispatcher(), &response)); |
460 } | 492 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 ppp_decryptor_impl_->DecryptAndDecode, | 622 ppp_decryptor_impl_->DecryptAndDecode, |
591 instance, | 623 instance, |
592 decoder_type, | 624 decoder_type, |
593 plugin_resource.get(), | 625 plugin_resource.get(), |
594 const_cast<const PP_EncryptedBlockInfo*>(&block_info)); | 626 const_cast<const PP_EncryptedBlockInfo*>(&block_info)); |
595 } | 627 } |
596 } | 628 } |
597 | 629 |
598 } // namespace proxy | 630 } // namespace proxy |
599 } // namespace ppapi | 631 } // namespace ppapi |
OLD | NEW |