| 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/ppb_instance_proxy.h" | 5 #include "ppapi/proxy/ppb_instance_proxy.h" |
| 6 | 6 |
| 7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/c/pp_time.h" | 8 #include "ppapi/c/pp_time.h" |
| 9 #include "ppapi/c/pp_var.h" | 9 #include "ppapi/c/pp_var.h" |
| 10 #include "ppapi/c/ppb_audio_config.h" | 10 #include "ppapi/c/ppb_audio_config.h" |
| 11 #include "ppapi/c/ppb_instance.h" | 11 #include "ppapi/c/ppb_instance.h" |
| 12 #include "ppapi/c/ppb_messaging.h" | 12 #include "ppapi/c/ppb_messaging.h" |
| 13 #include "ppapi/c/ppb_mouse_lock.h" | 13 #include "ppapi/c/ppb_mouse_lock.h" |
| 14 #include "ppapi/c/private/pp_content_decryptor.h" |
| 15 #include "ppapi/proxy/content_decryptor_private_serializer.h" |
| 14 #include "ppapi/proxy/enter_proxy.h" | 16 #include "ppapi/proxy/enter_proxy.h" |
| 15 #include "ppapi/proxy/host_dispatcher.h" | 17 #include "ppapi/proxy/host_dispatcher.h" |
| 16 #include "ppapi/proxy/plugin_dispatcher.h" | 18 #include "ppapi/proxy/plugin_dispatcher.h" |
| 17 #include "ppapi/proxy/plugin_proxy_delegate.h" | 19 #include "ppapi/proxy/plugin_proxy_delegate.h" |
| 18 #include "ppapi/proxy/ppapi_messages.h" | 20 #include "ppapi/proxy/ppapi_messages.h" |
| 19 #include "ppapi/proxy/ppb_flash_proxy.h" | 21 #include "ppapi/proxy/ppb_flash_proxy.h" |
| 20 #include "ppapi/proxy/serialized_var.h" | 22 #include "ppapi/proxy/serialized_var.h" |
| 21 #include "ppapi/shared_impl/ppapi_globals.h" | 23 #include "ppapi/shared_impl/ppapi_globals.h" |
| 22 #include "ppapi/shared_impl/ppb_url_util_shared.h" | 24 #include "ppapi/shared_impl/ppb_url_util_shared.h" |
| 23 #include "ppapi/shared_impl/ppb_view_shared.h" | 25 #include "ppapi/shared_impl/ppb_view_shared.h" |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 API_ID_PPB_INSTANCE, | 474 API_ID_PPB_INSTANCE, |
| 473 instance, | 475 instance, |
| 474 SerializedVarSendInput(dispatcher(), key_system), | 476 SerializedVarSendInput(dispatcher(), key_system), |
| 475 SerializedVarSendInput(dispatcher(), session_id), | 477 SerializedVarSendInput(dispatcher(), session_id), |
| 476 media_error, | 478 media_error, |
| 477 system_code)); | 479 system_code)); |
| 478 } | 480 } |
| 479 | 481 |
| 480 void PPB_Instance_Proxy::DeliverBlock(PP_Instance instance, | 482 void PPB_Instance_Proxy::DeliverBlock(PP_Instance instance, |
| 481 PP_Resource decrypted_block, | 483 PP_Resource decrypted_block, |
| 482 int32_t request_id) { | 484 const PP_DecryptedBlockInfo* block_info) { |
| 483 Resource* object = | 485 Resource* object = |
| 484 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_block); | 486 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_block); |
| 485 if (!object || object->pp_instance() != instance) | 487 if (!object || object->pp_instance() != instance) |
| 486 return; | 488 return; |
| 489 |
| 490 std::string serialized_block_info; |
| 491 if (!SerializeBlockInfo(*block_info, &serialized_block_info)) |
| 492 return; |
| 493 |
| 487 dispatcher()->Send( | 494 dispatcher()->Send( |
| 488 new PpapiHostMsg_PPBInstance_DeliverBlock(API_ID_PPB_INSTANCE, | 495 new PpapiHostMsg_PPBInstance_DeliverBlock(API_ID_PPB_INSTANCE, |
| 489 instance, | 496 instance, |
| 490 object->host_resource().host_resource(), | 497 object->host_resource().host_resource(), |
| 491 request_id)); | 498 serialized_block_info)); |
| 492 } | 499 } |
| 493 | 500 |
| 494 void PPB_Instance_Proxy::DeliverFrame(PP_Instance instance, | 501 void PPB_Instance_Proxy::DeliverFrame(PP_Instance instance, |
| 495 PP_Resource decrypted_frame, | 502 PP_Resource decrypted_frame, |
| 496 int32_t request_id) { | 503 const PP_DecryptedBlockInfo* block_info) { |
| 497 Resource* object = | 504 Resource* object = |
| 498 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_frame); | 505 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_frame); |
| 499 if (!object || object->pp_instance() != instance) | 506 if (!object || object->pp_instance() != instance) |
| 500 return; | 507 return; |
| 508 |
| 509 std::string serialized_block_info; |
| 510 if (!SerializeBlockInfo(*block_info, &serialized_block_info)) |
| 511 return; |
| 512 |
| 501 dispatcher()->Send(new PpapiHostMsg_PPBInstance_DeliverFrame( | 513 dispatcher()->Send(new PpapiHostMsg_PPBInstance_DeliverFrame( |
| 502 API_ID_PPB_INSTANCE, | 514 API_ID_PPB_INSTANCE, |
| 503 instance, | 515 instance, |
| 504 object->host_resource().host_resource(), | 516 object->host_resource().host_resource(), |
| 505 request_id)); | 517 serialized_block_info)); |
| 506 } | 518 } |
| 507 | 519 |
| 508 void PPB_Instance_Proxy::DeliverSamples(PP_Instance instance, | 520 void PPB_Instance_Proxy::DeliverSamples( |
| 509 PP_Resource decrypted_samples, | 521 PP_Instance instance, |
| 510 int32_t request_id) { | 522 PP_Resource decrypted_samples, |
| 523 const PP_DecryptedBlockInfo* block_info) { |
| 511 Resource* object = | 524 Resource* object = |
| 512 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_samples); | 525 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_samples); |
| 513 if (!object || object->pp_instance() != instance) | 526 if (!object || object->pp_instance() != instance) |
| 514 return; | 527 return; |
| 528 |
| 529 std::string serialized_block_info; |
| 530 if (!SerializeBlockInfo(*block_info, &serialized_block_info)) |
| 531 return; |
| 532 |
| 515 dispatcher()->Send( | 533 dispatcher()->Send( |
| 516 new PpapiHostMsg_PPBInstance_DeliverSamples( | 534 new PpapiHostMsg_PPBInstance_DeliverSamples( |
| 517 API_ID_PPB_INSTANCE, | 535 API_ID_PPB_INSTANCE, |
| 518 instance, | 536 instance, |
| 519 object->host_resource().host_resource(), | 537 object->host_resource().host_resource(), |
| 520 request_id)); | 538 serialized_block_info)); |
| 521 } | 539 } |
| 522 | 540 |
| 523 #endif // !defined(OS_NACL) | 541 #endif // !defined(OS_NACL) |
| 524 | 542 |
| 525 void PPB_Instance_Proxy::PostMessage(PP_Instance instance, | 543 void PPB_Instance_Proxy::PostMessage(PP_Instance instance, |
| 526 PP_Var message) { | 544 PP_Var message) { |
| 527 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage( | 545 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage( |
| 528 API_ID_PPB_INSTANCE, | 546 API_ID_PPB_INSTANCE, |
| 529 instance, SerializedVarSendInput(dispatcher(), message))); | 547 instance, SerializedVarSendInput(dispatcher(), message))); |
| 530 } | 548 } |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 EnterInstanceNoLock enter(instance); | 934 EnterInstanceNoLock enter(instance); |
| 917 if (enter.succeeded()) { | 935 if (enter.succeeded()) { |
| 918 enter.functions()->KeyError(instance, | 936 enter.functions()->KeyError(instance, |
| 919 key_system.Get(dispatcher()), | 937 key_system.Get(dispatcher()), |
| 920 session_id.Get(dispatcher()), | 938 session_id.Get(dispatcher()), |
| 921 media_error, | 939 media_error, |
| 922 system_error); | 940 system_error); |
| 923 } | 941 } |
| 924 } | 942 } |
| 925 | 943 |
| 926 void PPB_Instance_Proxy::OnHostMsgDeliverBlock(PP_Instance instance, | 944 void PPB_Instance_Proxy::OnHostMsgDeliverBlock( |
| 927 PP_Resource decrypted_block, | 945 PP_Instance instance, |
| 928 int32_t request_id) { | 946 PP_Resource decrypted_block, |
| 947 const std::string& serialized_block_info) { |
| 948 PP_DecryptedBlockInfo block_info; |
| 949 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) |
| 950 return; |
| 951 |
| 929 EnterInstanceNoLock enter(instance); | 952 EnterInstanceNoLock enter(instance); |
| 930 if (enter.succeeded()) | 953 if (enter.succeeded()) |
| 931 enter.functions()->DeliverBlock(instance, decrypted_block, request_id); | 954 enter.functions()->DeliverBlock(instance, decrypted_block, &block_info); |
| 932 } | 955 } |
| 933 | 956 |
| 934 void PPB_Instance_Proxy::OnHostMsgDeliverFrame(PP_Instance instance, | 957 void PPB_Instance_Proxy::OnHostMsgDeliverFrame( |
| 935 PP_Resource decrypted_frame, | 958 PP_Instance instance, |
| 936 int32_t request_id) { | 959 PP_Resource decrypted_frame, |
| 960 const std::string& serialized_block_info) { |
| 961 PP_DecryptedBlockInfo block_info; |
| 962 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) |
| 963 return; |
| 964 |
| 937 EnterInstanceNoLock enter(instance); | 965 EnterInstanceNoLock enter(instance); |
| 938 if (enter.succeeded()) | 966 if (enter.succeeded()) |
| 939 enter.functions()->DeliverFrame(instance, decrypted_frame, request_id); | 967 enter.functions()->DeliverFrame(instance, decrypted_frame, &block_info); |
| 940 } | 968 } |
| 941 | 969 |
| 942 void PPB_Instance_Proxy::OnHostMsgDeliverSamples(PP_Instance instance, | 970 void PPB_Instance_Proxy::OnHostMsgDeliverSamples( |
| 943 PP_Resource decrypted_samples, | 971 PP_Instance instance, |
| 944 int32_t request_id) { | 972 PP_Resource decrypted_samples, |
| 973 const std::string& serialized_block_info) { |
| 974 PP_DecryptedBlockInfo block_info; |
| 975 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) |
| 976 return; |
| 977 |
| 945 EnterInstanceNoLock enter(instance); | 978 EnterInstanceNoLock enter(instance); |
| 946 if (enter.succeeded()) | 979 if (enter.succeeded()) |
| 947 enter.functions()->DeliverSamples(instance, decrypted_samples, request_id); | 980 enter.functions()->DeliverSamples(instance, decrypted_samples, &block_info); |
| 948 } | 981 } |
| 949 | 982 |
| 950 #endif // !defined(OS_NACL) | 983 #endif // !defined(OS_NACL) |
| 951 | 984 |
| 952 void PPB_Instance_Proxy::OnHostMsgSetCursor( | 985 void PPB_Instance_Proxy::OnHostMsgSetCursor( |
| 953 PP_Instance instance, | 986 PP_Instance instance, |
| 954 int32_t type, | 987 int32_t type, |
| 955 const ppapi::HostResource& custom_image, | 988 const ppapi::HostResource& custom_image, |
| 956 const PP_Point& hot_spot) { | 989 const PP_Point& hot_spot) { |
| 957 EnterInstanceNoLock enter(instance); | 990 EnterInstanceNoLock enter(instance); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 PP_Instance instance) { | 1053 PP_Instance instance) { |
| 1021 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 1054 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
| 1022 GetInstanceData(instance); | 1055 GetInstanceData(instance); |
| 1023 if (!data) | 1056 if (!data) |
| 1024 return; // Instance was probably deleted. | 1057 return; // Instance was probably deleted. |
| 1025 data->should_do_request_surrounding_text = false; | 1058 data->should_do_request_surrounding_text = false; |
| 1026 } | 1059 } |
| 1027 | 1060 |
| 1028 } // namespace proxy | 1061 } // namespace proxy |
| 1029 } // namespace ppapi | 1062 } // namespace ppapi |
| OLD | NEW |