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" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetCursor, | 129 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetCursor, |
130 OnHostMsgSetCursor) | 130 OnHostMsgSetCursor) |
131 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetTextInputType, | 131 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetTextInputType, |
132 OnHostMsgSetTextInputType) | 132 OnHostMsgSetTextInputType) |
133 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateCaretPosition, | 133 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateCaretPosition, |
134 OnHostMsgUpdateCaretPosition) | 134 OnHostMsgUpdateCaretPosition) |
135 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_CancelCompositionText, | 135 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_CancelCompositionText, |
136 OnHostMsgCancelCompositionText) | 136 OnHostMsgCancelCompositionText) |
137 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateSurroundingText, | 137 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateSurroundingText, |
138 OnHostMsgUpdateSurroundingText) | 138 OnHostMsgUpdateSurroundingText) |
| 139 |
139 #if !defined(OS_NACL) | 140 #if !defined(OS_NACL) |
140 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ResolveRelativeToDocument, | 141 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ResolveRelativeToDocument, |
141 OnHostMsgResolveRelativeToDocument) | 142 OnHostMsgResolveRelativeToDocument) |
142 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanRequest, | 143 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanRequest, |
143 OnHostMsgDocumentCanRequest) | 144 OnHostMsgDocumentCanRequest) |
144 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanAccessDocument, | 145 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanAccessDocument, |
145 OnHostMsgDocumentCanAccessDocument) | 146 OnHostMsgDocumentCanAccessDocument) |
146 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDocumentURL, | 147 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDocumentURL, |
147 OnHostMsgGetDocumentURL) | 148 OnHostMsgGetDocumentURL) |
148 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginInstanceURL, | 149 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginInstanceURL, |
149 OnHostMsgGetPluginInstanceURL) | 150 OnHostMsgGetPluginInstanceURL) |
| 151 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_NeedKey, |
| 152 OnHostMsgNeedKey) |
| 153 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyAdded, |
| 154 OnHostMsgKeyAdded) |
| 155 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyMessage, |
| 156 OnHostMsgKeyMessage) |
| 157 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyError, |
| 158 OnHostMsgKeyError) |
| 159 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverBlock, |
| 160 OnHostMsgDeliverBlock) |
| 161 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverFrame, |
| 162 OnHostMsgDeliverFrame) |
| 163 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverSamples, |
| 164 OnHostMsgDeliverSamples) |
150 #endif // !defined(OS_NACL) | 165 #endif // !defined(OS_NACL) |
151 | 166 |
152 // Host -> Plugin messages. | 167 // Host -> Plugin messages. |
153 IPC_MESSAGE_HANDLER(PpapiMsg_PPBInstance_MouseLockComplete, | 168 IPC_MESSAGE_HANDLER(PpapiMsg_PPBInstance_MouseLockComplete, |
154 OnPluginMsgMouseLockComplete) | 169 OnPluginMsgMouseLockComplete) |
155 | 170 |
156 IPC_MESSAGE_UNHANDLED(handled = false) | 171 IPC_MESSAGE_UNHANDLED(handled = false) |
157 IPC_END_MESSAGE_MAP() | 172 IPC_END_MESSAGE_MAP() |
158 return handled; | 173 return handled; |
159 } | 174 } |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 PP_Var PPB_Instance_Proxy::GetPluginInstanceURL( | 405 PP_Var PPB_Instance_Proxy::GetPluginInstanceURL( |
391 PP_Instance instance, | 406 PP_Instance instance, |
392 PP_URLComponents_Dev* components) { | 407 PP_URLComponents_Dev* components) { |
393 ReceiveSerializedVarReturnValue result; | 408 ReceiveSerializedVarReturnValue result; |
394 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetPluginInstanceURL( | 409 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetPluginInstanceURL( |
395 API_ID_PPB_INSTANCE, instance, &result)); | 410 API_ID_PPB_INSTANCE, instance, &result)); |
396 return PPB_URLUtil_Shared::ConvertComponentsAndReturnURL( | 411 return PPB_URLUtil_Shared::ConvertComponentsAndReturnURL( |
397 result.Return(dispatcher()), | 412 result.Return(dispatcher()), |
398 components); | 413 components); |
399 } | 414 } |
| 415 |
| 416 void PPB_Instance_Proxy::NeedKey(PP_Instance instance, |
| 417 PP_Var key_system, |
| 418 PP_Var session_id, |
| 419 PP_Var init_data) { |
| 420 dispatcher()->Send( |
| 421 new PpapiHostMsg_PPBInstance_NeedKey( |
| 422 API_ID_PPB_INSTANCE, |
| 423 instance, |
| 424 SerializedVarSendInput(dispatcher(), key_system), |
| 425 SerializedVarSendInput(dispatcher(), session_id), |
| 426 SerializedVarSendInput(dispatcher(), init_data))); |
| 427 } |
| 428 |
| 429 void PPB_Instance_Proxy::KeyAdded(PP_Instance instance, |
| 430 PP_Var key_system, |
| 431 PP_Var session_id) { |
| 432 dispatcher()->Send( |
| 433 new PpapiHostMsg_PPBInstance_KeyAdded( |
| 434 API_ID_PPB_INSTANCE, |
| 435 instance, |
| 436 SerializedVarSendInput(dispatcher(), key_system), |
| 437 SerializedVarSendInput(dispatcher(), session_id))); |
| 438 } |
| 439 |
| 440 void PPB_Instance_Proxy::KeyMessage(PP_Instance instance, |
| 441 PP_Var key_system, |
| 442 PP_Var session_id, |
| 443 PP_Resource message, |
| 444 PP_Var default_url) { |
| 445 Resource* object = |
| 446 PpapiGlobals::Get()->GetResourceTracker()->GetResource(message); |
| 447 if (!object || object->pp_instance() != instance) |
| 448 return; |
| 449 dispatcher()->Send( |
| 450 new PpapiHostMsg_PPBInstance_KeyMessage( |
| 451 API_ID_PPB_INSTANCE, |
| 452 instance, |
| 453 SerializedVarSendInput(dispatcher(), key_system), |
| 454 SerializedVarSendInput(dispatcher(), session_id), |
| 455 object->host_resource().host_resource(), |
| 456 SerializedVarSendInput(dispatcher(), default_url))); |
| 457 } |
| 458 |
| 459 void PPB_Instance_Proxy::KeyError(PP_Instance instance, |
| 460 PP_Var key_system, |
| 461 PP_Var session_id, |
| 462 int32_t media_error, |
| 463 int32_t system_code) { |
| 464 dispatcher()->Send( |
| 465 new PpapiHostMsg_PPBInstance_KeyError( |
| 466 API_ID_PPB_INSTANCE, |
| 467 instance, |
| 468 SerializedVarSendInput(dispatcher(), key_system), |
| 469 SerializedVarSendInput(dispatcher(), session_id), |
| 470 media_error, |
| 471 system_code)); |
| 472 } |
| 473 |
| 474 void PPB_Instance_Proxy::DeliverBlock(PP_Instance instance, |
| 475 PP_Resource decrypted_block, |
| 476 int32_t request_id) { |
| 477 Resource* object = |
| 478 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_block); |
| 479 if (!object || object->pp_instance() != instance) |
| 480 return; |
| 481 dispatcher()->Send( |
| 482 new PpapiHostMsg_PPBInstance_DeliverBlock(API_ID_PPB_INSTANCE, |
| 483 instance, |
| 484 object->host_resource().host_resource(), |
| 485 request_id)); |
| 486 } |
| 487 |
| 488 void PPB_Instance_Proxy::DeliverFrame(PP_Instance instance, |
| 489 PP_Resource decrypted_frame, |
| 490 int32_t request_id) { |
| 491 Resource* object = |
| 492 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_frame); |
| 493 if (!object || object->pp_instance() != instance) |
| 494 return; |
| 495 dispatcher()->Send(new PpapiHostMsg_PPBInstance_DeliverFrame( |
| 496 API_ID_PPB_INSTANCE, |
| 497 instance, |
| 498 object->host_resource().host_resource(), |
| 499 request_id)); |
| 500 } |
| 501 |
| 502 void PPB_Instance_Proxy::DeliverSamples(PP_Instance instance, |
| 503 PP_Resource decrypted_samples, |
| 504 int32_t request_id) { |
| 505 Resource* object = |
| 506 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_samples); |
| 507 if (!object || object->pp_instance() != instance) |
| 508 return; |
| 509 dispatcher()->Send( |
| 510 new PpapiHostMsg_PPBInstance_DeliverSamples( |
| 511 API_ID_PPB_INSTANCE, |
| 512 instance, |
| 513 object->host_resource().host_resource(), |
| 514 request_id)); |
| 515 } |
| 516 |
400 #endif // !defined(OS_NACL) | 517 #endif // !defined(OS_NACL) |
401 | 518 |
402 void PPB_Instance_Proxy::PostMessage(PP_Instance instance, | 519 void PPB_Instance_Proxy::PostMessage(PP_Instance instance, |
403 PP_Var message) { | 520 PP_Var message) { |
404 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage( | 521 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage( |
405 API_ID_PPB_INSTANCE, | 522 API_ID_PPB_INSTANCE, |
406 instance, SerializedVarSendInput(dispatcher(), message))); | 523 instance, SerializedVarSendInput(dispatcher(), message))); |
407 } | 524 } |
408 | 525 |
409 PP_Bool PPB_Instance_Proxy::SetCursor(PP_Instance instance, | 526 PP_Bool PPB_Instance_Proxy::SetCursor(PP_Instance instance, |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 | 840 |
724 void PPB_Instance_Proxy::OnHostMsgGetPluginInstanceURL( | 841 void PPB_Instance_Proxy::OnHostMsgGetPluginInstanceURL( |
725 PP_Instance instance, | 842 PP_Instance instance, |
726 SerializedVarReturnValue result) { | 843 SerializedVarReturnValue result) { |
727 EnterInstanceNoLock enter(instance); | 844 EnterInstanceNoLock enter(instance); |
728 if (enter.succeeded()) { | 845 if (enter.succeeded()) { |
729 result.Return(dispatcher(), | 846 result.Return(dispatcher(), |
730 enter.functions()->GetPluginInstanceURL(instance, NULL)); | 847 enter.functions()->GetPluginInstanceURL(instance, NULL)); |
731 } | 848 } |
732 } | 849 } |
| 850 |
| 851 void PPB_Instance_Proxy::OnHostMsgNeedKey(PP_Instance instance, |
| 852 SerializedVarReceiveInput key_system, |
| 853 SerializedVarReceiveInput session_id, |
| 854 SerializedVarReceiveInput init_data) { |
| 855 EnterInstanceNoLock enter(instance); |
| 856 if (enter.succeeded()) { |
| 857 enter.functions()->NeedKey(instance, |
| 858 key_system.Get(dispatcher()), |
| 859 session_id.Get(dispatcher()), |
| 860 init_data.Get(dispatcher())); |
| 861 } |
| 862 } |
| 863 |
| 864 void PPB_Instance_Proxy::OnHostMsgKeyAdded( |
| 865 PP_Instance instance, |
| 866 SerializedVarReceiveInput key_system, |
| 867 SerializedVarReceiveInput session_id) { |
| 868 EnterInstanceNoLock enter(instance); |
| 869 if (enter.succeeded()) { |
| 870 enter.functions()->KeyAdded(instance, |
| 871 key_system.Get(dispatcher()), |
| 872 session_id.Get(dispatcher())); |
| 873 } |
| 874 } |
| 875 |
| 876 void PPB_Instance_Proxy::OnHostMsgKeyMessage( |
| 877 PP_Instance instance, |
| 878 SerializedVarReceiveInput key_system, |
| 879 SerializedVarReceiveInput session_id, |
| 880 PP_Resource message, |
| 881 SerializedVarReceiveInput default_url) { |
| 882 EnterInstanceNoLock enter(instance); |
| 883 if (enter.succeeded()) { |
| 884 enter.functions()->KeyMessage(instance, |
| 885 key_system.Get(dispatcher()), |
| 886 session_id.Get(dispatcher()), |
| 887 message, |
| 888 default_url.Get(dispatcher())); |
| 889 } |
| 890 } |
| 891 |
| 892 void PPB_Instance_Proxy::OnHostMsgKeyError( |
| 893 PP_Instance instance, |
| 894 SerializedVarReceiveInput key_system, |
| 895 SerializedVarReceiveInput session_id, |
| 896 int32_t media_error, |
| 897 int32_t system_error) { |
| 898 EnterInstanceNoLock enter(instance); |
| 899 if (enter.succeeded()) { |
| 900 enter.functions()->KeyError(instance, |
| 901 key_system.Get(dispatcher()), |
| 902 session_id.Get(dispatcher()), |
| 903 media_error, |
| 904 system_error); |
| 905 } |
| 906 } |
| 907 |
| 908 void PPB_Instance_Proxy::OnHostMsgDeliverBlock(PP_Instance instance, |
| 909 PP_Resource decrypted_block, |
| 910 int32_t request_id) { |
| 911 EnterInstanceNoLock enter(instance); |
| 912 if (enter.succeeded()) |
| 913 enter.functions()->DeliverBlock(instance, decrypted_block, request_id); |
| 914 } |
| 915 |
| 916 void PPB_Instance_Proxy::OnHostMsgDeliverFrame(PP_Instance instance, |
| 917 PP_Resource decrypted_frame, |
| 918 int32_t request_id) { |
| 919 EnterInstanceNoLock enter(instance); |
| 920 if (enter.succeeded()) |
| 921 enter.functions()->DeliverFrame(instance, decrypted_frame, request_id); |
| 922 } |
| 923 |
| 924 void PPB_Instance_Proxy::OnHostMsgDeliverSamples(PP_Instance instance, |
| 925 PP_Resource decrypted_samples, |
| 926 int32_t request_id) { |
| 927 EnterInstanceNoLock enter(instance); |
| 928 if (enter.succeeded()) |
| 929 enter.functions()->DeliverSamples(instance, decrypted_samples, request_id); |
| 930 } |
| 931 |
733 #endif // !defined(OS_NACL) | 932 #endif // !defined(OS_NACL) |
734 | 933 |
735 void PPB_Instance_Proxy::OnHostMsgSetCursor( | 934 void PPB_Instance_Proxy::OnHostMsgSetCursor( |
736 PP_Instance instance, | 935 PP_Instance instance, |
737 int32_t type, | 936 int32_t type, |
738 const ppapi::HostResource& custom_image, | 937 const ppapi::HostResource& custom_image, |
739 const PP_Point& hot_spot) { | 938 const PP_Point& hot_spot) { |
740 EnterInstanceNoLock enter(instance); | 939 EnterInstanceNoLock enter(instance); |
741 if (enter.succeeded()) { | 940 if (enter.succeeded()) { |
742 enter.functions()->SetCursor( | 941 enter.functions()->SetCursor( |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 } | 993 } |
795 | 994 |
796 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, | 995 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, |
797 PP_Instance instance) { | 996 PP_Instance instance) { |
798 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( | 997 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( |
799 API_ID_PPB_INSTANCE, instance, result)); | 998 API_ID_PPB_INSTANCE, instance, result)); |
800 } | 999 } |
801 | 1000 |
802 } // namespace proxy | 1001 } // namespace proxy |
803 } // namespace ppapi | 1002 } // namespace ppapi |
OLD | NEW |