| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_PromiseResolved, | 178 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PromiseResolved, |
| 179 OnHostMsgPromiseResolved) | 179 OnHostMsgPromiseResolved) |
| 180 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PromiseResolvedWithSession, | 180 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PromiseResolvedWithSession, |
| 181 OnHostMsgPromiseResolvedWithSession) | 181 OnHostMsgPromiseResolvedWithSession) |
| 182 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PromiseResolvedWithKeyIds, |
| 183 OnHostMsgPromiseResolvedWithKeyIds) |
| 182 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PromiseRejected, | 184 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PromiseRejected, |
| 183 OnHostMsgPromiseRejected) | 185 OnHostMsgPromiseRejected) |
| 184 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionMessage, | 186 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionMessage, |
| 185 OnHostMsgSessionMessage) | 187 OnHostMsgSessionMessage) |
| 188 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionKeysChange, |
| 189 OnHostMsgSessionKeysChange) |
| 190 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionExpirationChange, |
| 191 OnHostMsgSessionExpirationChange) |
| 186 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionReady, | 192 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionReady, |
| 187 OnHostMsgSessionReady) | 193 OnHostMsgSessionReady) |
| 188 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionClosed, | 194 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionClosed, |
| 189 OnHostMsgSessionClosed) | 195 OnHostMsgSessionClosed) |
| 190 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionError, | 196 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionError, |
| 191 OnHostMsgSessionError) | 197 OnHostMsgSessionError) |
| 192 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverBlock, | 198 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverBlock, |
| 193 OnHostMsgDeliverBlock) | 199 OnHostMsgDeliverBlock) |
| 194 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DecoderInitializeDone, | 200 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DecoderInitializeDone, |
| 195 OnHostMsgDecoderInitializeDone) | 201 OnHostMsgDecoderInitializeDone) |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 void PPB_Instance_Proxy::PromiseResolvedWithSession(PP_Instance instance, | 576 void PPB_Instance_Proxy::PromiseResolvedWithSession(PP_Instance instance, |
| 571 uint32 promise_id, | 577 uint32 promise_id, |
| 572 PP_Var web_session_id_var) { | 578 PP_Var web_session_id_var) { |
| 573 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PromiseResolvedWithSession( | 579 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PromiseResolvedWithSession( |
| 574 API_ID_PPB_INSTANCE, | 580 API_ID_PPB_INSTANCE, |
| 575 instance, | 581 instance, |
| 576 promise_id, | 582 promise_id, |
| 577 SerializedVarSendInput(dispatcher(), web_session_id_var))); | 583 SerializedVarSendInput(dispatcher(), web_session_id_var))); |
| 578 } | 584 } |
| 579 | 585 |
| 586 void PPB_Instance_Proxy::PromiseResolvedWithKeyIds(PP_Instance instance, |
| 587 uint32 promise_id, |
| 588 PP_Var key_ids_var) { |
| 589 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PromiseResolvedWithKeyIds( |
| 590 API_ID_PPB_INSTANCE, |
| 591 instance, |
| 592 promise_id, |
| 593 SerializedVarSendInput(dispatcher(), key_ids_var))); |
| 594 } |
| 595 |
| 580 void PPB_Instance_Proxy::PromiseRejected(PP_Instance instance, | 596 void PPB_Instance_Proxy::PromiseRejected(PP_Instance instance, |
| 581 uint32 promise_id, | 597 uint32 promise_id, |
| 582 PP_CdmExceptionCode exception_code, | 598 PP_CdmExceptionCode exception_code, |
| 583 uint32 system_code, | 599 uint32 system_code, |
| 584 PP_Var error_description_var) { | 600 PP_Var error_description_var) { |
| 585 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PromiseRejected( | 601 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PromiseRejected( |
| 586 API_ID_PPB_INSTANCE, | 602 API_ID_PPB_INSTANCE, |
| 587 instance, | 603 instance, |
| 588 promise_id, | 604 promise_id, |
| 589 exception_code, | 605 exception_code, |
| 590 system_code, | 606 system_code, |
| 591 SerializedVarSendInput(dispatcher(), error_description_var))); | 607 SerializedVarSendInput(dispatcher(), error_description_var))); |
| 592 } | 608 } |
| 593 | 609 |
| 594 void PPB_Instance_Proxy::SessionMessage(PP_Instance instance, | 610 void PPB_Instance_Proxy::SessionMessage(PP_Instance instance, |
| 595 PP_Var web_session_id_var, | 611 PP_Var web_session_id_var, |
| 596 PP_Var message_var, | 612 PP_Var message_var, |
| 597 PP_Var destination_url_var) { | 613 PP_Var destination_url_var) { |
| 598 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionMessage( | 614 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionMessage( |
| 599 API_ID_PPB_INSTANCE, | 615 API_ID_PPB_INSTANCE, |
| 600 instance, | 616 instance, |
| 601 SerializedVarSendInput(dispatcher(), web_session_id_var), | 617 SerializedVarSendInput(dispatcher(), web_session_id_var), |
| 602 SerializedVarSendInput(dispatcher(), message_var), | 618 SerializedVarSendInput(dispatcher(), message_var), |
| 603 SerializedVarSendInput(dispatcher(), destination_url_var))); | 619 SerializedVarSendInput(dispatcher(), destination_url_var))); |
| 604 } | 620 } |
| 605 | 621 |
| 622 void PPB_Instance_Proxy::SessionKeysChange(PP_Instance instance, |
| 623 PP_Var web_session_id_var, |
| 624 PP_Bool has_additional_usable_key) { |
| 625 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionKeysChange( |
| 626 API_ID_PPB_INSTANCE, |
| 627 instance, |
| 628 SerializedVarSendInput(dispatcher(), web_session_id_var), |
| 629 has_additional_usable_key)); |
| 630 } |
| 631 |
| 632 void PPB_Instance_Proxy::SessionExpirationChange(PP_Instance instance, |
| 633 PP_Var web_session_id_var, |
| 634 PP_Time new_expiry_time) { |
| 635 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionExpirationChange( |
| 636 API_ID_PPB_INSTANCE, |
| 637 instance, |
| 638 SerializedVarSendInput(dispatcher(), web_session_id_var), |
| 639 new_expiry_time)); |
| 640 } |
| 641 |
| 606 void PPB_Instance_Proxy::SessionReady(PP_Instance instance, | 642 void PPB_Instance_Proxy::SessionReady(PP_Instance instance, |
| 607 PP_Var web_session_id_var) { | 643 PP_Var web_session_id_var) { |
| 608 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionReady( | 644 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionReady( |
| 609 API_ID_PPB_INSTANCE, | 645 API_ID_PPB_INSTANCE, |
| 610 instance, | 646 instance, |
| 611 SerializedVarSendInput(dispatcher(), web_session_id_var))); | 647 SerializedVarSendInput(dispatcher(), web_session_id_var))); |
| 612 } | 648 } |
| 613 | 649 |
| 614 void PPB_Instance_Proxy::SessionClosed(PP_Instance instance, | 650 void PPB_Instance_Proxy::SessionClosed(PP_Instance instance, |
| 615 PP_Var web_session_id_var) { | 651 PP_Var web_session_id_var) { |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 SerializedVarReceiveInput web_session_id) { | 1227 SerializedVarReceiveInput web_session_id) { |
| 1192 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) | 1228 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) |
| 1193 return; | 1229 return; |
| 1194 EnterInstanceNoLock enter(instance); | 1230 EnterInstanceNoLock enter(instance); |
| 1195 if (enter.succeeded()) { | 1231 if (enter.succeeded()) { |
| 1196 enter.functions()->PromiseResolvedWithSession( | 1232 enter.functions()->PromiseResolvedWithSession( |
| 1197 instance, promise_id, web_session_id.Get(dispatcher())); | 1233 instance, promise_id, web_session_id.Get(dispatcher())); |
| 1198 } | 1234 } |
| 1199 } | 1235 } |
| 1200 | 1236 |
| 1237 void PPB_Instance_Proxy::OnHostMsgPromiseResolvedWithKeyIds( |
| 1238 PP_Instance instance, |
| 1239 uint32_t promise_id, |
| 1240 SerializedVarReceiveInput key_ids) { |
| 1241 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) |
| 1242 return; |
| 1243 EnterInstanceNoLock enter(instance); |
| 1244 if (enter.succeeded()) { |
| 1245 enter.functions()->PromiseResolvedWithKeyIds( |
| 1246 instance, promise_id, key_ids.Get(dispatcher())); |
| 1247 } |
| 1248 } |
| 1249 |
| 1201 void PPB_Instance_Proxy::OnHostMsgPromiseRejected( | 1250 void PPB_Instance_Proxy::OnHostMsgPromiseRejected( |
| 1202 PP_Instance instance, | 1251 PP_Instance instance, |
| 1203 uint32_t promise_id, | 1252 uint32_t promise_id, |
| 1204 PP_CdmExceptionCode exception_code, | 1253 PP_CdmExceptionCode exception_code, |
| 1205 uint32_t system_code, | 1254 uint32_t system_code, |
| 1206 SerializedVarReceiveInput error_description) { | 1255 SerializedVarReceiveInput error_description) { |
| 1207 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) | 1256 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) |
| 1208 return; | 1257 return; |
| 1209 EnterInstanceNoLock enter(instance); | 1258 EnterInstanceNoLock enter(instance); |
| 1210 if (enter.succeeded()) { | 1259 if (enter.succeeded()) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1225 return; | 1274 return; |
| 1226 EnterInstanceNoLock enter(instance); | 1275 EnterInstanceNoLock enter(instance); |
| 1227 if (enter.succeeded()) { | 1276 if (enter.succeeded()) { |
| 1228 enter.functions()->SessionMessage(instance, | 1277 enter.functions()->SessionMessage(instance, |
| 1229 web_session_id.Get(dispatcher()), | 1278 web_session_id.Get(dispatcher()), |
| 1230 message.Get(dispatcher()), | 1279 message.Get(dispatcher()), |
| 1231 destination_url.Get(dispatcher())); | 1280 destination_url.Get(dispatcher())); |
| 1232 } | 1281 } |
| 1233 } | 1282 } |
| 1234 | 1283 |
| 1284 void PPB_Instance_Proxy::OnHostMsgSessionKeysChange( |
| 1285 PP_Instance instance, |
| 1286 SerializedVarReceiveInput web_session_id, |
| 1287 PP_Bool has_additional_usable_key) { |
| 1288 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) |
| 1289 return; |
| 1290 EnterInstanceNoLock enter(instance); |
| 1291 if (enter.succeeded()) { |
| 1292 enter.functions()->SessionKeysChange( |
| 1293 instance, web_session_id.Get(dispatcher()), has_additional_usable_key); |
| 1294 } |
| 1295 } |
| 1296 |
| 1297 void PPB_Instance_Proxy::OnHostMsgSessionExpirationChange( |
| 1298 PP_Instance instance, |
| 1299 SerializedVarReceiveInput web_session_id, |
| 1300 PP_Time new_expiry_time) { |
| 1301 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) |
| 1302 return; |
| 1303 EnterInstanceNoLock enter(instance); |
| 1304 if (enter.succeeded()) { |
| 1305 enter.functions()->SessionExpirationChange( |
| 1306 instance, web_session_id.Get(dispatcher()), new_expiry_time); |
| 1307 } |
| 1308 } |
| 1309 |
| 1235 void PPB_Instance_Proxy::OnHostMsgSessionReady( | 1310 void PPB_Instance_Proxy::OnHostMsgSessionReady( |
| 1236 PP_Instance instance, | 1311 PP_Instance instance, |
| 1237 SerializedVarReceiveInput web_session_id) { | 1312 SerializedVarReceiveInput web_session_id) { |
| 1238 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) | 1313 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) |
| 1239 return; | 1314 return; |
| 1240 EnterInstanceNoLock enter(instance); | 1315 EnterInstanceNoLock enter(instance); |
| 1241 if (enter.succeeded()) { | 1316 if (enter.succeeded()) { |
| 1242 enter.functions()->SessionReady(instance, web_session_id.Get(dispatcher())); | 1317 enter.functions()->SessionReady(instance, web_session_id.Get(dispatcher())); |
| 1243 } | 1318 } |
| 1244 } | 1319 } |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1436 PP_Instance instance) { | 1511 PP_Instance instance) { |
| 1437 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 1512 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
| 1438 GetInstanceData(instance); | 1513 GetInstanceData(instance); |
| 1439 if (!data) | 1514 if (!data) |
| 1440 return; // Instance was probably deleted. | 1515 return; // Instance was probably deleted. |
| 1441 data->should_do_request_surrounding_text = false; | 1516 data->should_do_request_surrounding_text = false; |
| 1442 } | 1517 } |
| 1443 | 1518 |
| 1444 } // namespace proxy | 1519 } // namespace proxy |
| 1445 } // namespace ppapi | 1520 } // namespace ppapi |
| OLD | NEW |