Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1554)

Side by Side Diff: ppapi/proxy/ppb_instance_proxy.cc

Issue 10545036: Add PPAPI decryptor interfaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix PP_Resource/HostResource usage (hopefully), and update comments. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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,
dmichael (off chromium) 2012/08/08 22:24:02 In this direction, I think you need to look the PP
Tom Finegan 2012/08/09 22:45:17 Done.
576 PP_Var default_url) {
577 dispatcher()->Send(
578 new PpapiHostMsg_PPBInstance_KeyMessage(
579 API_ID_PPB_INSTANCE,
580 instance,
581 SerializedVarSendInput(dispatcher(), key_system),
582 SerializedVarSendInput(dispatcher(), session_id),
583 message,
584 SerializedVarSendInput(dispatcher(), default_url)));
585 }
586
587 void PPB_Instance_Proxy::KeyError(PP_Instance instance,
588 PP_Var key_system,
589 PP_Var session_id,
590 int32_t media_error,
591 int32_t system_error) {
592 dispatcher()->Send(
593 new PpapiHostMsg_PPBInstance_KeyError(
594 API_ID_PPB_INSTANCE,
595 instance,
596 SerializedVarSendInput(dispatcher(), key_system),
597 SerializedVarSendInput(dispatcher(), session_id),
598 media_error,
599 system_error));
600 }
601
602 void PPB_Instance_Proxy::DeliverBlock(PP_Instance instance,
603 PP_Resource decrypted_block,
604 uint64_t request_id) {
605 dispatcher()->Send(
606 new PpapiHostMsg_PPBInstance_DeliverBlock(API_ID_PPB_INSTANCE,
607 instance,
608 decrypted_block,
609 request_id));
610 }
611
612 void PPB_Instance_Proxy::DeliverFrame(PP_Instance instance,
613 PP_Resource decrypted_frame,
614 uint64_t request_id) {
615 dispatcher()->Send(
616 new PpapiHostMsg_PPBInstance_DeliverFrame(API_ID_PPB_INSTANCE,
617 instance,
618 decrypted_frame,
619 request_id));
620 }
621
622 void PPB_Instance_Proxy::DeliverSamples(PP_Instance instance,
623 PP_Resource decrypted_samples,
624 uint64_t request_id) {
625 dispatcher()->Send(
626 new PpapiHostMsg_PPBInstance_DeliverSamples(API_ID_PPB_INSTANCE,
627 instance,
628 decrypted_samples,
629 request_id));
630 }
631
632
533 void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance, 633 void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance,
534 const HostResource& device, 634 const HostResource& device,
535 PP_Bool* result) { 635 PP_Bool* result) {
536 EnterInstanceNoLock enter(instance); 636 EnterInstanceNoLock enter(instance);
537 if (enter.succeeded()) { 637 if (enter.succeeded()) {
538 *result = enter.functions()->BindGraphics(instance, 638 *result = enter.functions()->BindGraphics(instance,
539 device.host_resource()); 639 device.host_resource());
540 } 640 }
541 } 641 }
542 642
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 const std::string& text, 872 const std::string& text,
773 uint32_t caret, 873 uint32_t caret,
774 uint32_t anchor) { 874 uint32_t anchor) {
775 EnterInstanceNoLock enter(instance); 875 EnterInstanceNoLock enter(instance);
776 if (enter.succeeded()) { 876 if (enter.succeeded()) {
777 enter.functions()->UpdateSurroundingText(instance, text.c_str(), caret, 877 enter.functions()->UpdateSurroundingText(instance, text.c_str(), caret,
778 anchor); 878 anchor);
779 } 879 }
780 } 880 }
781 881
882 void PPB_Instance_Proxy::OnHostMsgNeedKey(PP_Instance instance,
883 SerializedVarReceiveInput key_system,
884 SerializedVarReceiveInput session_id,
885 SerializedVarReceiveInput init_data) {
886 EnterInstanceNoLock enter(instance);
887 if (enter.succeeded()) {
888 enter.functions()->NeedKey(instance,
889 key_system.Get(dispatcher()),
890 session_id.Get(dispatcher()),
891 init_data.Get(dispatcher()));
892 }
893 }
894
895 void PPB_Instance_Proxy::OnHostMsgKeyAdded(
896 PP_Instance instance,
897 SerializedVarReceiveInput key_system,
898 SerializedVarReceiveInput session_id) {
899 EnterInstanceNoLock enter(instance);
900 if (enter.succeeded()) {
901 enter.functions()->KeyAdded(instance,
902 key_system.Get(dispatcher()),
903 session_id.Get(dispatcher()));
904 }
905 }
906
907 void PPB_Instance_Proxy::OnHostMsgKeyMessage(
908 PP_Instance instance,
909 SerializedVarReceiveInput key_system,
910 SerializedVarReceiveInput session_id,
911 PP_Resource message,
912 SerializedVarReceiveInput default_url) {
913 EnterInstanceNoLock enter(instance);
914 if (enter.succeeded()) {
915 enter.functions()->KeyMessage(instance,
916 key_system.Get(dispatcher()),
917 session_id.Get(dispatcher()),
918 message,
919 default_url.Get(dispatcher()));
920 }
921 }
922
923 void PPB_Instance_Proxy::OnHostMsgKeyError(
924 PP_Instance instance,
925 SerializedVarReceiveInput key_system,
926 SerializedVarReceiveInput session_id,
927 int32_t media_error,
928 int32_t system_error) {
929 EnterInstanceNoLock enter(instance);
930 if (enter.succeeded()) {
931 enter.functions()->KeyError(instance,
932 key_system.Get(dispatcher()),
933 session_id.Get(dispatcher()),
934 media_error,
935 system_error);
936 }
937 }
938
939 void PPB_Instance_Proxy::OnHostMsgDeliverBlock(PP_Instance instance,
940 PP_Resource decrypted_block,
941 uint64_t request_id) {
942 EnterInstanceNoLock enter(instance);
943 if (enter.succeeded())
944 enter.functions()->DeliverBlock(instance, decrypted_block, request_id);
945 }
946
947 void PPB_Instance_Proxy::OnHostMsgDeliverFrame(PP_Instance instance,
948 PP_Resource decrypted_frame,
949 uint64_t request_id) {
950 EnterInstanceNoLock enter(instance);
951 if (enter.succeeded())
952 enter.functions()->DeliverFrame(instance, decrypted_frame, request_id);
953 }
954
955 void PPB_Instance_Proxy::OnHostMsgDeliverSamples(PP_Instance instance,
956 PP_Resource decrypted_samples,
957 uint64_t request_id) {
958 EnterInstanceNoLock enter(instance);
959 if (enter.succeeded())
960 enter.functions()->DeliverSamples(instance, decrypted_samples, request_id);
961 }
962
782 void PPB_Instance_Proxy::OnPluginMsgMouseLockComplete(PP_Instance instance, 963 void PPB_Instance_Proxy::OnPluginMsgMouseLockComplete(PP_Instance instance,
783 int32_t result) { 964 int32_t result) {
784 // Save the mouse callback on the instance data. 965 // Save the mouse callback on the instance data.
785 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> 966 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
786 GetInstanceData(instance); 967 GetInstanceData(instance);
787 if (!data) 968 if (!data)
788 return; // Instance was probably deleted. 969 return; // Instance was probably deleted.
789 if (!TrackedCallback::IsPending(data->mouse_lock_callback)) { 970 if (!TrackedCallback::IsPending(data->mouse_lock_callback)) {
790 NOTREACHED(); 971 NOTREACHED();
791 return; 972 return;
792 } 973 }
793 TrackedCallback::ClearAndRun(&(data->mouse_lock_callback), result); 974 TrackedCallback::ClearAndRun(&(data->mouse_lock_callback), result);
794 } 975 }
795 976
796 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, 977 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result,
797 PP_Instance instance) { 978 PP_Instance instance) {
798 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( 979 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete(
799 API_ID_PPB_INSTANCE, instance, result)); 980 API_ID_PPB_INSTANCE, instance, result));
800 } 981 }
801 982
802 } // namespace proxy 983 } // namespace proxy
803 } // namespace ppapi 984 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698