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 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_NeedKey, |
| 140 OnHostMsgNeedKey) |
| 141 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyAdded, |
| 142 OnHostMsgKeyAdded) |
| 143 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyMessage, |
| 144 OnHostMsgKeyMessage) |
| 145 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyError, |
| 146 OnHostMsgKeyError) |
| 147 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverBlock, |
| 148 OnHostMsgDeliverBlock) |
| 149 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverFrame, |
| 150 OnHostMsgDeliverFrame) |
| 151 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverSamples, |
| 152 OnHostMsgDeliverSamples) |
| 153 |
139 #if !defined(OS_NACL) | 154 #if !defined(OS_NACL) |
140 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ResolveRelativeToDocument, | 155 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ResolveRelativeToDocument, |
141 OnHostMsgResolveRelativeToDocument) | 156 OnHostMsgResolveRelativeToDocument) |
142 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanRequest, | 157 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanRequest, |
143 OnHostMsgDocumentCanRequest) | 158 OnHostMsgDocumentCanRequest) |
144 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanAccessDocument, | 159 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanAccessDocument, |
145 OnHostMsgDocumentCanAccessDocument) | 160 OnHostMsgDocumentCanAccessDocument) |
146 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDocumentURL, | 161 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDocumentURL, |
147 OnHostMsgGetDocumentURL) | 162 OnHostMsgGetDocumentURL) |
148 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginInstanceURL, | 163 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginInstanceURL, |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 void PPB_Instance_Proxy::OnHostMsgGetOwnerElementObject( | 538 void PPB_Instance_Proxy::OnHostMsgGetOwnerElementObject( |
524 PP_Instance instance, | 539 PP_Instance instance, |
525 SerializedVarReturnValue result) { | 540 SerializedVarReturnValue result) { |
526 EnterInstanceNoLock enter(instance); | 541 EnterInstanceNoLock enter(instance); |
527 if (enter.succeeded()) { | 542 if (enter.succeeded()) { |
528 result.Return(dispatcher(), | 543 result.Return(dispatcher(), |
529 enter.functions()->GetOwnerElementObject(instance)); | 544 enter.functions()->GetOwnerElementObject(instance)); |
530 } | 545 } |
531 } | 546 } |
532 | 547 |
| 548 void PPB_Instance_Proxy::NeedKey(PP_Instance instance, |
| 549 PP_Var key_system, |
| 550 PP_Var session_id, |
| 551 PP_Var init_data) { |
| 552 dispatcher()->Send( |
| 553 new PpapiHostMsg_PPBInstance_NeedKey( |
| 554 API_ID_PPB_INSTANCE, |
| 555 instance, |
| 556 SerializedVarSendInput(dispatcher(), key_system), |
| 557 SerializedVarSendInput(dispatcher(), session_id), |
| 558 SerializedVarSendInput(dispatcher(), init_data))); |
| 559 } |
| 560 |
| 561 void PPB_Instance_Proxy::KeyAdded(PP_Instance instance, |
| 562 PP_Var key_system, |
| 563 PP_Var session_id) { |
| 564 dispatcher()->Send( |
| 565 new PpapiHostMsg_PPBInstance_KeyAdded( |
| 566 API_ID_PPB_INSTANCE, |
| 567 instance, |
| 568 SerializedVarSendInput(dispatcher(), key_system), |
| 569 SerializedVarSendInput(dispatcher(), session_id))); |
| 570 } |
| 571 |
| 572 void PPB_Instance_Proxy::KeyMessage(PP_Instance instance, |
| 573 PP_Var key_system, |
| 574 PP_Var session_id, |
| 575 PP_Resource message, |
| 576 PP_Var default_url) { |
| 577 Resource* object = |
| 578 PpapiGlobals::Get()->GetResourceTracker()->GetResource(message); |
| 579 if (!object || object->pp_instance() != instance) |
| 580 return; |
| 581 dispatcher()->Send( |
| 582 new PpapiHostMsg_PPBInstance_KeyMessage( |
| 583 API_ID_PPB_INSTANCE, |
| 584 instance, |
| 585 SerializedVarSendInput(dispatcher(), key_system), |
| 586 SerializedVarSendInput(dispatcher(), session_id), |
| 587 object->host_resource(), |
| 588 SerializedVarSendInput(dispatcher(), default_url))); |
| 589 } |
| 590 |
| 591 void PPB_Instance_Proxy::KeyError(PP_Instance instance, |
| 592 PP_Var key_system, |
| 593 PP_Var session_id, |
| 594 int32_t media_error, |
| 595 int32_t system_error) { |
| 596 dispatcher()->Send( |
| 597 new PpapiHostMsg_PPBInstance_KeyError( |
| 598 API_ID_PPB_INSTANCE, |
| 599 instance, |
| 600 SerializedVarSendInput(dispatcher(), key_system), |
| 601 SerializedVarSendInput(dispatcher(), session_id), |
| 602 media_error, |
| 603 system_error)); |
| 604 } |
| 605 |
| 606 void PPB_Instance_Proxy::DeliverBlock(PP_Instance instance, |
| 607 PP_Resource decrypted_block, |
| 608 uint64_t request_id) { |
| 609 Resource* object = |
| 610 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_block); |
| 611 if (!object || object->pp_instance() != instance) |
| 612 return; |
| 613 dispatcher()->Send( |
| 614 new PpapiHostMsg_PPBInstance_DeliverBlock(API_ID_PPB_INSTANCE, |
| 615 instance, |
| 616 object->host_resource(), |
| 617 request_id)); |
| 618 } |
| 619 |
| 620 void PPB_Instance_Proxy::DeliverFrame(PP_Instance instance, |
| 621 PP_Resource decrypted_frame, |
| 622 uint64_t request_id) { |
| 623 Resource* object = |
| 624 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_frame); |
| 625 if (!object || object->pp_instance() != instance) |
| 626 return; |
| 627 dispatcher()->Send( |
| 628 new PpapiHostMsg_PPBInstance_DeliverFrame(API_ID_PPB_INSTANCE, |
| 629 instance, |
| 630 object->host_resource(), |
| 631 request_id)); |
| 632 } |
| 633 |
| 634 void PPB_Instance_Proxy::DeliverSamples(PP_Instance instance, |
| 635 PP_Resource decrypted_samples, |
| 636 uint64_t request_id) { |
| 637 Resource* object = |
| 638 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_samples); |
| 639 if (!object || object->pp_instance() != instance) |
| 640 return; |
| 641 dispatcher()->Send( |
| 642 new PpapiHostMsg_PPBInstance_DeliverSamples(API_ID_PPB_INSTANCE, |
| 643 instance, |
| 644 object->host_resource(), |
| 645 request_id)); |
| 646 } |
| 647 |
| 648 |
533 void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance, | 649 void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance, |
534 const HostResource& device, | 650 const HostResource& device, |
535 PP_Bool* result) { | 651 PP_Bool* result) { |
536 EnterInstanceNoLock enter(instance); | 652 EnterInstanceNoLock enter(instance); |
537 if (enter.succeeded()) { | 653 if (enter.succeeded()) { |
538 *result = enter.functions()->BindGraphics(instance, | 654 *result = enter.functions()->BindGraphics(instance, |
539 device.host_resource()); | 655 device.host_resource()); |
540 } | 656 } |
541 } | 657 } |
542 | 658 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 const std::string& text, | 888 const std::string& text, |
773 uint32_t caret, | 889 uint32_t caret, |
774 uint32_t anchor) { | 890 uint32_t anchor) { |
775 EnterInstanceNoLock enter(instance); | 891 EnterInstanceNoLock enter(instance); |
776 if (enter.succeeded()) { | 892 if (enter.succeeded()) { |
777 enter.functions()->UpdateSurroundingText(instance, text.c_str(), caret, | 893 enter.functions()->UpdateSurroundingText(instance, text.c_str(), caret, |
778 anchor); | 894 anchor); |
779 } | 895 } |
780 } | 896 } |
781 | 897 |
| 898 void PPB_Instance_Proxy::OnHostMsgNeedKey(PP_Instance instance, |
| 899 SerializedVarReceiveInput key_system, |
| 900 SerializedVarReceiveInput session_id, |
| 901 SerializedVarReceiveInput init_data) { |
| 902 EnterInstanceNoLock enter(instance); |
| 903 if (enter.succeeded()) { |
| 904 enter.functions()->NeedKey(instance, |
| 905 key_system.Get(dispatcher()), |
| 906 session_id.Get(dispatcher()), |
| 907 init_data.Get(dispatcher())); |
| 908 } |
| 909 } |
| 910 |
| 911 void PPB_Instance_Proxy::OnHostMsgKeyAdded( |
| 912 PP_Instance instance, |
| 913 SerializedVarReceiveInput key_system, |
| 914 SerializedVarReceiveInput session_id) { |
| 915 EnterInstanceNoLock enter(instance); |
| 916 if (enter.succeeded()) { |
| 917 enter.functions()->KeyAdded(instance, |
| 918 key_system.Get(dispatcher()), |
| 919 session_id.Get(dispatcher())); |
| 920 } |
| 921 } |
| 922 |
| 923 void PPB_Instance_Proxy::OnHostMsgKeyMessage( |
| 924 PP_Instance instance, |
| 925 SerializedVarReceiveInput key_system, |
| 926 SerializedVarReceiveInput session_id, |
| 927 const ppapi::HostResource& message, |
| 928 SerializedVarReceiveInput default_url) { |
| 929 EnterInstanceNoLock enter(instance); |
| 930 if (enter.succeeded()) { |
| 931 enter.functions()->KeyMessage(instance, |
| 932 key_system.Get(dispatcher()), |
| 933 session_id.Get(dispatcher()), |
| 934 message.host_resource(), |
| 935 default_url.Get(dispatcher())); |
| 936 } |
| 937 } |
| 938 |
| 939 void PPB_Instance_Proxy::OnHostMsgKeyError( |
| 940 PP_Instance instance, |
| 941 SerializedVarReceiveInput key_system, |
| 942 SerializedVarReceiveInput session_id, |
| 943 int32_t media_error, |
| 944 int32_t system_error) { |
| 945 EnterInstanceNoLock enter(instance); |
| 946 if (enter.succeeded()) { |
| 947 enter.functions()->KeyError(instance, |
| 948 key_system.Get(dispatcher()), |
| 949 session_id.Get(dispatcher()), |
| 950 media_error, |
| 951 system_error); |
| 952 } |
| 953 } |
| 954 |
| 955 void PPB_Instance_Proxy::OnHostMsgDeliverBlock( |
| 956 PP_Instance instance, |
| 957 const ppapi::HostResource& decrypted_block, |
| 958 uint64_t request_id) { |
| 959 EnterInstanceNoLock enter(instance); |
| 960 if (enter.succeeded()) { |
| 961 enter.functions()->DeliverBlock(instance, |
| 962 decrypted_block.host_resource(), |
| 963 request_id); |
| 964 } |
| 965 } |
| 966 |
| 967 void PPB_Instance_Proxy::OnHostMsgDeliverFrame( |
| 968 PP_Instance instance, |
| 969 const ppapi::HostResource& decrypted_frame, |
| 970 uint64_t request_id) { |
| 971 EnterInstanceNoLock enter(instance); |
| 972 if (enter.succeeded()) { |
| 973 enter.functions()->DeliverFrame(instance, |
| 974 decrypted_frame.host_resource(), |
| 975 request_id); |
| 976 } |
| 977 } |
| 978 |
| 979 void PPB_Instance_Proxy::OnHostMsgDeliverSamples( |
| 980 PP_Instance instance, |
| 981 const ppapi::HostResource& decrypted_samples, |
| 982 uint64_t request_id) { |
| 983 EnterInstanceNoLock enter(instance); |
| 984 if (enter.succeeded()) { |
| 985 enter.functions()->DeliverSamples(instance, |
| 986 decrypted_samples.host_resource(), |
| 987 request_id); |
| 988 } |
| 989 } |
| 990 |
782 void PPB_Instance_Proxy::OnPluginMsgMouseLockComplete(PP_Instance instance, | 991 void PPB_Instance_Proxy::OnPluginMsgMouseLockComplete(PP_Instance instance, |
783 int32_t result) { | 992 int32_t result) { |
784 // Save the mouse callback on the instance data. | 993 // Save the mouse callback on the instance data. |
785 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 994 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
786 GetInstanceData(instance); | 995 GetInstanceData(instance); |
787 if (!data) | 996 if (!data) |
788 return; // Instance was probably deleted. | 997 return; // Instance was probably deleted. |
789 if (!TrackedCallback::IsPending(data->mouse_lock_callback)) { | 998 if (!TrackedCallback::IsPending(data->mouse_lock_callback)) { |
790 NOTREACHED(); | 999 NOTREACHED(); |
791 return; | 1000 return; |
792 } | 1001 } |
793 TrackedCallback::ClearAndRun(&(data->mouse_lock_callback), result); | 1002 TrackedCallback::ClearAndRun(&(data->mouse_lock_callback), result); |
794 } | 1003 } |
795 | 1004 |
796 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, | 1005 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, |
797 PP_Instance instance) { | 1006 PP_Instance instance) { |
798 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( | 1007 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( |
799 API_ID_PPB_INSTANCE, instance, result)); | 1008 API_ID_PPB_INSTANCE, instance, result)); |
800 } | 1009 } |
801 | 1010 |
802 } // namespace proxy | 1011 } // namespace proxy |
803 } // namespace ppapi | 1012 } // namespace ppapi |
OLD | NEW |