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 "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 #include "ppapi/c/pp_time.h" | 10 #include "ppapi/c/pp_time.h" |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 PP_URLComponents_Dev* components) { | 536 PP_URLComponents_Dev* components) { |
537 ReceiveSerializedVarReturnValue result; | 537 ReceiveSerializedVarReturnValue result; |
538 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetPluginReferrerURL( | 538 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetPluginReferrerURL( |
539 API_ID_PPB_INSTANCE, instance, &result)); | 539 API_ID_PPB_INSTANCE, instance, &result)); |
540 return PPB_URLUtil_Shared::ConvertComponentsAndReturnURL( | 540 return PPB_URLUtil_Shared::ConvertComponentsAndReturnURL( |
541 result.Return(dispatcher()), | 541 result.Return(dispatcher()), |
542 components); | 542 components); |
543 } | 543 } |
544 | 544 |
545 void PPB_Instance_Proxy::SessionCreated(PP_Instance instance, | 545 void PPB_Instance_Proxy::SessionCreated(PP_Instance instance, |
546 uint32_t reference_id, | 546 uint32_t session_id, |
547 PP_Var session_id) { | 547 PP_Var web_session_id) { |
548 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionCreated( | 548 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionCreated( |
549 API_ID_PPB_INSTANCE, | 549 API_ID_PPB_INSTANCE, |
550 instance, | 550 instance, |
551 reference_id, | 551 session_id, |
552 SerializedVarSendInput(dispatcher(), session_id))); | 552 SerializedVarSendInput(dispatcher(), web_session_id))); |
553 } | 553 } |
554 | 554 |
555 void PPB_Instance_Proxy::SessionMessage(PP_Instance instance, | 555 void PPB_Instance_Proxy::SessionMessage(PP_Instance instance, |
556 uint32_t reference_id, | 556 uint32_t session_id, |
557 PP_Var message, | 557 PP_Var message, |
558 PP_Var destination_url) { | 558 PP_Var destination_url) { |
559 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionMessage( | 559 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionMessage( |
560 API_ID_PPB_INSTANCE, | 560 API_ID_PPB_INSTANCE, |
561 instance, | 561 instance, |
562 reference_id, | 562 session_id, |
563 SerializedVarSendInput(dispatcher(), message), | 563 SerializedVarSendInput(dispatcher(), message), |
564 SerializedVarSendInput(dispatcher(), destination_url))); | 564 SerializedVarSendInput(dispatcher(), destination_url))); |
565 } | 565 } |
566 | 566 |
567 void PPB_Instance_Proxy::SessionReady(PP_Instance instance, | 567 void PPB_Instance_Proxy::SessionReady(PP_Instance instance, |
568 uint32_t reference_id) { | 568 uint32_t session_id) { |
569 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionReady( | 569 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionReady( |
570 API_ID_PPB_INSTANCE, instance, reference_id)); | 570 API_ID_PPB_INSTANCE, instance, session_id)); |
571 } | 571 } |
572 | 572 |
573 void PPB_Instance_Proxy::SessionClosed(PP_Instance instance, | 573 void PPB_Instance_Proxy::SessionClosed(PP_Instance instance, |
574 uint32_t reference_id) { | 574 uint32_t session_id) { |
575 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionClosed( | 575 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionClosed( |
576 API_ID_PPB_INSTANCE, instance, reference_id)); | 576 API_ID_PPB_INSTANCE, instance, session_id)); |
577 } | 577 } |
578 | 578 |
579 void PPB_Instance_Proxy::SessionError(PP_Instance instance, | 579 void PPB_Instance_Proxy::SessionError(PP_Instance instance, |
580 uint32_t reference_id, | 580 uint32_t session_id, |
581 int32_t media_error, | 581 int32_t media_error, |
582 int32_t system_code) { | 582 int32_t system_code) { |
583 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionError( | 583 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionError( |
584 API_ID_PPB_INSTANCE, instance, reference_id, media_error, system_code)); | 584 API_ID_PPB_INSTANCE, instance, session_id, media_error, system_code)); |
585 } | 585 } |
586 | 586 |
587 void PPB_Instance_Proxy::DeliverBlock(PP_Instance instance, | 587 void PPB_Instance_Proxy::DeliverBlock(PP_Instance instance, |
588 PP_Resource decrypted_block, | 588 PP_Resource decrypted_block, |
589 const PP_DecryptedBlockInfo* block_info) { | 589 const PP_DecryptedBlockInfo* block_info) { |
590 PP_Resource decrypted_block_host_resource = 0; | 590 PP_Resource decrypted_block_host_resource = 0; |
591 | 591 |
592 if (decrypted_block) { | 592 if (decrypted_block) { |
593 Resource* object = | 593 Resource* object = |
594 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_block); | 594 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_block); |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 return; | 1043 return; |
1044 EnterInstanceNoLock enter(instance); | 1044 EnterInstanceNoLock enter(instance); |
1045 if (enter.succeeded()) { | 1045 if (enter.succeeded()) { |
1046 result.Return(dispatcher(), | 1046 result.Return(dispatcher(), |
1047 enter.functions()->GetPluginReferrerURL(instance, NULL)); | 1047 enter.functions()->GetPluginReferrerURL(instance, NULL)); |
1048 } | 1048 } |
1049 } | 1049 } |
1050 | 1050 |
1051 void PPB_Instance_Proxy::OnHostMsgSessionCreated( | 1051 void PPB_Instance_Proxy::OnHostMsgSessionCreated( |
1052 PP_Instance instance, | 1052 PP_Instance instance, |
1053 uint32_t reference_id, | 1053 uint32_t session_id, |
1054 SerializedVarReceiveInput session_id) { | 1054 SerializedVarReceiveInput web_session_id) { |
1055 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) | 1055 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) |
1056 return; | 1056 return; |
1057 EnterInstanceNoLock enter(instance); | 1057 EnterInstanceNoLock enter(instance); |
1058 if (enter.succeeded()) { | 1058 if (enter.succeeded()) { |
1059 enter.functions()->SessionCreated( | 1059 enter.functions()->SessionCreated( |
1060 instance, reference_id, session_id.Get(dispatcher())); | 1060 instance, session_id, web_session_id.Get(dispatcher())); |
1061 } | 1061 } |
1062 } | 1062 } |
1063 | 1063 |
1064 void PPB_Instance_Proxy::OnHostMsgSessionMessage( | 1064 void PPB_Instance_Proxy::OnHostMsgSessionMessage( |
1065 PP_Instance instance, | 1065 PP_Instance instance, |
1066 uint32_t reference_id, | 1066 uint32_t session_id, |
1067 SerializedVarReceiveInput message, | 1067 SerializedVarReceiveInput message, |
1068 SerializedVarReceiveInput destination_url) { | 1068 SerializedVarReceiveInput destination_url) { |
1069 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) | 1069 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) |
1070 return; | 1070 return; |
1071 EnterInstanceNoLock enter(instance); | 1071 EnterInstanceNoLock enter(instance); |
1072 if (enter.succeeded()) { | 1072 if (enter.succeeded()) { |
1073 enter.functions()->SessionMessage(instance, | 1073 enter.functions()->SessionMessage(instance, |
1074 reference_id, | 1074 session_id, |
1075 message.Get(dispatcher()), | 1075 message.Get(dispatcher()), |
1076 destination_url.Get(dispatcher())); | 1076 destination_url.Get(dispatcher())); |
1077 } | 1077 } |
1078 } | 1078 } |
1079 | 1079 |
1080 void PPB_Instance_Proxy::OnHostMsgSessionReady(PP_Instance instance, | 1080 void PPB_Instance_Proxy::OnHostMsgSessionReady(PP_Instance instance, |
1081 uint32_t reference_id) { | 1081 uint32_t session_id) { |
1082 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) | 1082 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) |
1083 return; | 1083 return; |
1084 EnterInstanceNoLock enter(instance); | 1084 EnterInstanceNoLock enter(instance); |
1085 if (enter.succeeded()) { | 1085 if (enter.succeeded()) { |
1086 enter.functions()->SessionReady(instance, reference_id); | 1086 enter.functions()->SessionReady(instance, session_id); |
1087 } | 1087 } |
1088 } | 1088 } |
1089 | 1089 |
1090 void PPB_Instance_Proxy::OnHostMsgSessionClosed(PP_Instance instance, | 1090 void PPB_Instance_Proxy::OnHostMsgSessionClosed(PP_Instance instance, |
1091 uint32_t reference_id) { | 1091 uint32_t session_id) { |
1092 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) | 1092 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) |
1093 return; | 1093 return; |
1094 EnterInstanceNoLock enter(instance); | 1094 EnterInstanceNoLock enter(instance); |
1095 if (enter.succeeded()) { | 1095 if (enter.succeeded()) { |
1096 enter.functions()->SessionClosed(instance, reference_id); | 1096 enter.functions()->SessionClosed(instance, session_id); |
1097 } | 1097 } |
1098 } | 1098 } |
1099 | 1099 |
1100 void PPB_Instance_Proxy::OnHostMsgSessionError(PP_Instance instance, | 1100 void PPB_Instance_Proxy::OnHostMsgSessionError(PP_Instance instance, |
1101 uint32_t reference_id, | 1101 uint32_t session_id, |
1102 int32_t media_error, | 1102 int32_t media_error, |
1103 int32_t system_error) { | 1103 int32_t system_error) { |
1104 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) | 1104 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) |
1105 return; | 1105 return; |
1106 EnterInstanceNoLock enter(instance); | 1106 EnterInstanceNoLock enter(instance); |
1107 if (enter.succeeded()) { | 1107 if (enter.succeeded()) { |
1108 enter.functions()->SessionError( | 1108 enter.functions()->SessionError( |
1109 instance, reference_id, media_error, system_error); | 1109 instance, session_id, media_error, system_error); |
1110 } | 1110 } |
1111 } | 1111 } |
1112 | 1112 |
1113 void PPB_Instance_Proxy::OnHostMsgDeliverBlock( | 1113 void PPB_Instance_Proxy::OnHostMsgDeliverBlock( |
1114 PP_Instance instance, | 1114 PP_Instance instance, |
1115 PP_Resource decrypted_block, | 1115 PP_Resource decrypted_block, |
1116 const std::string& serialized_block_info) { | 1116 const std::string& serialized_block_info) { |
1117 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) | 1117 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) |
1118 return; | 1118 return; |
1119 PP_DecryptedBlockInfo block_info; | 1119 PP_DecryptedBlockInfo block_info; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 PP_Instance instance) { | 1281 PP_Instance instance) { |
1282 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 1282 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
1283 GetInstanceData(instance); | 1283 GetInstanceData(instance); |
1284 if (!data) | 1284 if (!data) |
1285 return; // Instance was probably deleted. | 1285 return; // Instance was probably deleted. |
1286 data->should_do_request_surrounding_text = false; | 1286 data->should_do_request_surrounding_text = false; |
1287 } | 1287 } |
1288 | 1288 |
1289 } // namespace proxy | 1289 } // namespace proxy |
1290 } // namespace ppapi | 1290 } // namespace ppapi |
OLD | NEW |