| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ResolveRelativeToDocument, | 168 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ResolveRelativeToDocument, |
| 169 OnHostMsgResolveRelativeToDocument) | 169 OnHostMsgResolveRelativeToDocument) |
| 170 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanRequest, | 170 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanRequest, |
| 171 OnHostMsgDocumentCanRequest) | 171 OnHostMsgDocumentCanRequest) |
| 172 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanAccessDocument, | 172 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanAccessDocument, |
| 173 OnHostMsgDocumentCanAccessDocument) | 173 OnHostMsgDocumentCanAccessDocument) |
| 174 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginInstanceURL, | 174 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginInstanceURL, |
| 175 OnHostMsgGetPluginInstanceURL) | 175 OnHostMsgGetPluginInstanceURL) |
| 176 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginReferrerURL, | 176 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginReferrerURL, |
| 177 OnHostMsgGetPluginReferrerURL) | 177 OnHostMsgGetPluginReferrerURL) |
| 178 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_NeedKey, | |
| 179 OnHostMsgNeedKey) | |
| 180 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyAdded, | 178 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyAdded, |
| 181 OnHostMsgKeyAdded) | 179 OnHostMsgKeyAdded) |
| 182 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyMessage, | 180 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyMessage, |
| 183 OnHostMsgKeyMessage) | 181 OnHostMsgKeyMessage) |
| 184 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyError, | 182 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyError, |
| 185 OnHostMsgKeyError) | 183 OnHostMsgKeyError) |
| 186 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverBlock, | 184 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverBlock, |
| 187 OnHostMsgDeliverBlock) | 185 OnHostMsgDeliverBlock) |
| 188 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DecoderInitializeDone, | 186 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DecoderInitializeDone, |
| 189 OnHostMsgDecoderInitializeDone) | 187 OnHostMsgDecoderInitializeDone) |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 PP_Instance instance, | 530 PP_Instance instance, |
| 533 PP_URLComponents_Dev* components) { | 531 PP_URLComponents_Dev* components) { |
| 534 ReceiveSerializedVarReturnValue result; | 532 ReceiveSerializedVarReturnValue result; |
| 535 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetPluginReferrerURL( | 533 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetPluginReferrerURL( |
| 536 API_ID_PPB_INSTANCE, instance, &result)); | 534 API_ID_PPB_INSTANCE, instance, &result)); |
| 537 return PPB_URLUtil_Shared::ConvertComponentsAndReturnURL( | 535 return PPB_URLUtil_Shared::ConvertComponentsAndReturnURL( |
| 538 result.Return(dispatcher()), | 536 result.Return(dispatcher()), |
| 539 components); | 537 components); |
| 540 } | 538 } |
| 541 | 539 |
| 542 void PPB_Instance_Proxy::NeedKey(PP_Instance instance, | |
| 543 PP_Var key_system, | |
| 544 PP_Var session_id, | |
| 545 PP_Var init_data) { | |
| 546 dispatcher()->Send( | |
| 547 new PpapiHostMsg_PPBInstance_NeedKey( | |
| 548 API_ID_PPB_INSTANCE, | |
| 549 instance, | |
| 550 SerializedVarSendInput(dispatcher(), key_system), | |
| 551 SerializedVarSendInput(dispatcher(), session_id), | |
| 552 SerializedVarSendInput(dispatcher(), init_data))); | |
| 553 } | |
| 554 | |
| 555 void PPB_Instance_Proxy::KeyAdded(PP_Instance instance, | 540 void PPB_Instance_Proxy::KeyAdded(PP_Instance instance, |
| 556 PP_Var key_system, | 541 PP_Var key_system, |
| 557 PP_Var session_id) { | 542 PP_Var session_id) { |
| 558 dispatcher()->Send( | 543 dispatcher()->Send( |
| 559 new PpapiHostMsg_PPBInstance_KeyAdded( | 544 new PpapiHostMsg_PPBInstance_KeyAdded( |
| 560 API_ID_PPB_INSTANCE, | 545 API_ID_PPB_INSTANCE, |
| 561 instance, | 546 instance, |
| 562 SerializedVarSendInput(dispatcher(), key_system), | 547 SerializedVarSendInput(dispatcher(), key_system), |
| 563 SerializedVarSendInput(dispatcher(), session_id))); | 548 SerializedVarSendInput(dispatcher(), session_id))); |
| 564 } | 549 } |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 SerializedVarReturnValue result) { | 1035 SerializedVarReturnValue result) { |
| 1051 if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV)) | 1036 if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV)) |
| 1052 return; | 1037 return; |
| 1053 EnterInstanceNoLock enter(instance); | 1038 EnterInstanceNoLock enter(instance); |
| 1054 if (enter.succeeded()) { | 1039 if (enter.succeeded()) { |
| 1055 result.Return(dispatcher(), | 1040 result.Return(dispatcher(), |
| 1056 enter.functions()->GetPluginReferrerURL(instance, NULL)); | 1041 enter.functions()->GetPluginReferrerURL(instance, NULL)); |
| 1057 } | 1042 } |
| 1058 } | 1043 } |
| 1059 | 1044 |
| 1060 void PPB_Instance_Proxy::OnHostMsgNeedKey(PP_Instance instance, | |
| 1061 SerializedVarReceiveInput key_system, | |
| 1062 SerializedVarReceiveInput session_id, | |
| 1063 SerializedVarReceiveInput init_data) { | |
| 1064 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) | |
| 1065 return; | |
| 1066 EnterInstanceNoLock enter(instance); | |
| 1067 if (enter.succeeded()) { | |
| 1068 enter.functions()->NeedKey(instance, | |
| 1069 key_system.Get(dispatcher()), | |
| 1070 session_id.Get(dispatcher()), | |
| 1071 init_data.Get(dispatcher())); | |
| 1072 } | |
| 1073 } | |
| 1074 | |
| 1075 void PPB_Instance_Proxy::OnHostMsgKeyAdded( | 1045 void PPB_Instance_Proxy::OnHostMsgKeyAdded( |
| 1076 PP_Instance instance, | 1046 PP_Instance instance, |
| 1077 SerializedVarReceiveInput key_system, | 1047 SerializedVarReceiveInput key_system, |
| 1078 SerializedVarReceiveInput session_id) { | 1048 SerializedVarReceiveInput session_id) { |
| 1079 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) | 1049 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) |
| 1080 return; | 1050 return; |
| 1081 EnterInstanceNoLock enter(instance); | 1051 EnterInstanceNoLock enter(instance); |
| 1082 if (enter.succeeded()) { | 1052 if (enter.succeeded()) { |
| 1083 enter.functions()->KeyAdded(instance, | 1053 enter.functions()->KeyAdded(instance, |
| 1084 key_system.Get(dispatcher()), | 1054 key_system.Get(dispatcher()), |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 PP_Instance instance) { | 1263 PP_Instance instance) { |
| 1294 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 1264 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
| 1295 GetInstanceData(instance); | 1265 GetInstanceData(instance); |
| 1296 if (!data) | 1266 if (!data) |
| 1297 return; // Instance was probably deleted. | 1267 return; // Instance was probably deleted. |
| 1298 data->should_do_request_surrounding_text = false; | 1268 data->should_do_request_surrounding_text = false; |
| 1299 } | 1269 } |
| 1300 | 1270 |
| 1301 } // namespace proxy | 1271 } // namespace proxy |
| 1302 } // namespace ppapi | 1272 } // namespace ppapi |
| OLD | NEW |