OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_var.h" | 8 #include "ppapi/c/pp_var.h" |
9 #include "ppapi/c/ppb_instance.h" | 9 #include "ppapi/c/ppb_instance.h" |
10 #include "ppapi/c/ppb_messaging.h" | 10 #include "ppapi/c/ppb_messaging.h" |
11 #include "ppapi/c/ppb_mouse_lock.h" | 11 #include "ppapi/c/ppb_mouse_lock.h" |
12 #include "ppapi/proxy/enter_proxy.h" | 12 #include "ppapi/proxy/enter_proxy.h" |
13 #include "ppapi/proxy/host_dispatcher.h" | 13 #include "ppapi/proxy/host_dispatcher.h" |
14 #include "ppapi/proxy/plugin_dispatcher.h" | 14 #include "ppapi/proxy/plugin_dispatcher.h" |
15 #include "ppapi/proxy/ppapi_messages.h" | 15 #include "ppapi/proxy/ppapi_messages.h" |
16 #include "ppapi/proxy/serialized_var.h" | 16 #include "ppapi/proxy/serialized_var.h" |
17 #include "ppapi/shared_impl/ppapi_globals.h" | 17 #include "ppapi/shared_impl/ppapi_globals.h" |
18 #include "ppapi/shared_impl/ppb_url_util_shared.h" | 18 #include "ppapi/shared_impl/ppb_url_util_shared.h" |
| 19 #include "ppapi/shared_impl/ppb_view_shared.h" |
19 #include "ppapi/thunk/enter.h" | 20 #include "ppapi/thunk/enter.h" |
20 #include "ppapi/thunk/thunk.h" | 21 #include "ppapi/thunk/thunk.h" |
21 | 22 |
22 // Windows headers interfere with this file. | 23 // Windows headers interfere with this file. |
23 #ifdef PostMessage | 24 #ifdef PostMessage |
24 #undef PostMessage | 25 #undef PostMessage |
25 #endif | 26 #endif |
26 | 27 |
27 using ppapi::thunk::EnterFunctionNoLock; | 28 using ppapi::thunk::EnterFunctionNoLock; |
28 using ppapi::thunk::EnterResourceNoLock; | 29 using ppapi::thunk::EnterResourceNoLock; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // Prevent the dispatcher from going away during a call to ExecuteScript. | 66 // Prevent the dispatcher from going away during a call to ExecuteScript. |
66 // This must happen OUTSIDE of ExecuteScript since the SerializedVars use | 67 // This must happen OUTSIDE of ExecuteScript since the SerializedVars use |
67 // the dispatcher upon return of the function (converting the | 68 // the dispatcher upon return of the function (converting the |
68 // SerializedVarReturnValue/OutParam to a SerializedVar in the destructor). | 69 // SerializedVarReturnValue/OutParam to a SerializedVar in the destructor). |
69 ScopedModuleReference death_grip(dispatcher()); | 70 ScopedModuleReference death_grip(dispatcher()); |
70 | 71 |
71 bool handled = true; | 72 bool handled = true; |
72 IPC_BEGIN_MESSAGE_MAP(PPB_Instance_Proxy, msg) | 73 IPC_BEGIN_MESSAGE_MAP(PPB_Instance_Proxy, msg) |
73 // Plugin -> Host messages. | 74 // Plugin -> Host messages. |
74 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetWindowObject, | 75 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetWindowObject, |
75 OnMsgGetWindowObject) | 76 OnHostMsgGetWindowObject) |
76 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetOwnerElementObject, | 77 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetOwnerElementObject, |
77 OnMsgGetOwnerElementObject) | 78 OnHostMsgGetOwnerElementObject) |
78 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics, | 79 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics, |
79 OnMsgBindGraphics) | 80 OnHostMsgBindGraphics) |
80 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame, | 81 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame, |
81 OnMsgIsFullFrame) | 82 OnHostMsgIsFullFrame) |
82 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript, | 83 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript, |
83 OnMsgExecuteScript) | 84 OnHostMsgExecuteScript) |
84 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDefaultCharSet, | 85 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDefaultCharSet, |
85 OnMsgGetDefaultCharSet) | 86 OnHostMsgGetDefaultCharSet) |
86 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_Log, | 87 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_Log, |
87 OnMsgLog) | 88 OnHostMsgLog) |
88 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_LogWithSource, | 89 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_LogWithSource, |
89 OnMsgLogWithSource) | 90 OnHostMsgLogWithSource) |
90 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PostMessage, | 91 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PostMessage, |
91 OnMsgPostMessage) | 92 OnHostMsgPostMessage) |
92 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_FlashSetFullscreen, | 93 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_FlashSetFullscreen, |
93 OnMsgFlashSetFullscreen) | 94 OnHostMsgFlashSetFullscreen) |
94 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_FlashGetScreenSize, | 95 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_FlashGetScreenSize, |
95 OnMsgFlashGetScreenSize) | 96 OnHostMsgFlashGetScreenSize) |
96 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetFullscreen, | 97 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetFullscreen, |
97 OnMsgSetFullscreen) | 98 OnHostMsgSetFullscreen) |
98 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetScreenSize, | 99 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetScreenSize, |
99 OnMsgGetScreenSize) | 100 OnHostMsgGetScreenSize) |
100 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_RequestInputEvents, | 101 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_RequestInputEvents, |
101 OnMsgRequestInputEvents) | 102 OnHostMsgRequestInputEvents) |
102 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ClearInputEvents, | 103 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ClearInputEvents, |
103 OnMsgClearInputEvents) | 104 OnHostMsgClearInputEvents) |
104 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_LockMouse, | 105 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_LockMouse, |
105 OnMsgLockMouse) | 106 OnHostMsgLockMouse) |
106 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UnlockMouse, | 107 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UnlockMouse, |
107 OnMsgUnlockMouse) | 108 OnHostMsgUnlockMouse) |
108 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ResolveRelativeToDocument, | 109 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ResolveRelativeToDocument, |
109 OnMsgResolveRelativeToDocument) | 110 OnHostMsgResolveRelativeToDocument) |
110 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanRequest, | 111 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanRequest, |
111 OnMsgDocumentCanRequest) | 112 OnHostMsgDocumentCanRequest) |
112 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanAccessDocument, | 113 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanAccessDocument, |
113 OnMsgDocumentCanAccessDocument) | 114 OnHostMsgDocumentCanAccessDocument) |
114 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDocumentURL, | 115 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDocumentURL, |
115 OnMsgGetDocumentURL) | 116 OnHostMsgGetDocumentURL) |
116 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginInstanceURL, | 117 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginInstanceURL, |
117 OnMsgGetPluginInstanceURL) | 118 OnHostMsgGetPluginInstanceURL) |
118 | 119 |
119 // Host -> Plugin messages. | 120 // Host -> Plugin messages. |
120 IPC_MESSAGE_HANDLER(PpapiMsg_PPBInstance_MouseLockComplete, | 121 IPC_MESSAGE_HANDLER(PpapiMsg_PPBInstance_MouseLockComplete, |
121 OnMsgMouseLockComplete) | 122 OnPluginMsgMouseLockComplete) |
122 | 123 |
123 IPC_MESSAGE_UNHANDLED(handled = false) | 124 IPC_MESSAGE_UNHANDLED(handled = false) |
124 IPC_END_MESSAGE_MAP() | 125 IPC_END_MESSAGE_MAP() |
125 return handled; | 126 return handled; |
126 } | 127 } |
127 | 128 |
128 PPB_Instance_FunctionAPI* PPB_Instance_Proxy::AsPPB_Instance_FunctionAPI() { | 129 PPB_Instance_FunctionAPI* PPB_Instance_Proxy::AsPPB_Instance_FunctionAPI() { |
129 return this; | 130 return this; |
130 } | 131 } |
131 | 132 |
(...skipping 11 matching lines...) Expand all Loading... |
143 return result; | 144 return result; |
144 } | 145 } |
145 | 146 |
146 PP_Bool PPB_Instance_Proxy::IsFullFrame(PP_Instance instance) { | 147 PP_Bool PPB_Instance_Proxy::IsFullFrame(PP_Instance instance) { |
147 PP_Bool result = PP_FALSE; | 148 PP_Bool result = PP_FALSE; |
148 dispatcher()->Send(new PpapiHostMsg_PPBInstance_IsFullFrame( | 149 dispatcher()->Send(new PpapiHostMsg_PPBInstance_IsFullFrame( |
149 API_ID_PPB_INSTANCE, instance, &result)); | 150 API_ID_PPB_INSTANCE, instance, &result)); |
150 return result; | 151 return result; |
151 } | 152 } |
152 | 153 |
| 154 PP_Resource PPB_Instance_Proxy::GetView(PP_Instance instance) { |
| 155 const ViewData* view = GetViewData(instance); |
| 156 if (!view) |
| 157 return 0; |
| 158 return (new PPB_View_Shared(PPB_View_Shared::InitAsProxy(), instance, |
| 159 *view))->GetReference(); |
| 160 } |
| 161 |
| 162 const ViewData* PPB_Instance_Proxy::GetViewData(PP_Instance instance) { |
| 163 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
| 164 GetInstanceData(instance); |
| 165 if (!data) |
| 166 return NULL; |
| 167 return &data->view; |
| 168 } |
| 169 |
153 PP_Var PPB_Instance_Proxy::GetWindowObject(PP_Instance instance) { | 170 PP_Var PPB_Instance_Proxy::GetWindowObject(PP_Instance instance) { |
154 ReceiveSerializedVarReturnValue result; | 171 ReceiveSerializedVarReturnValue result; |
155 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetWindowObject( | 172 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetWindowObject( |
156 API_ID_PPB_INSTANCE, instance, &result)); | 173 API_ID_PPB_INSTANCE, instance, &result)); |
157 return result.Return(dispatcher()); | 174 return result.Return(dispatcher()); |
158 } | 175 } |
159 | 176 |
160 PP_Var PPB_Instance_Proxy::GetOwnerElementObject(PP_Instance instance) { | 177 PP_Var PPB_Instance_Proxy::GetOwnerElementObject(PP_Instance instance) { |
161 ReceiveSerializedVarReturnValue result; | 178 ReceiveSerializedVarReturnValue result; |
162 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetOwnerElementObject( | 179 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetOwnerElementObject( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 int32_t total, | 228 int32_t total, |
212 PP_Bool final_result) { | 229 PP_Bool final_result) { |
213 NOTIMPLEMENTED(); // Not proxied yet. | 230 NOTIMPLEMENTED(); // Not proxied yet. |
214 } | 231 } |
215 | 232 |
216 void PPB_Instance_Proxy::SelectedFindResultChanged(PP_Instance instance, | 233 void PPB_Instance_Proxy::SelectedFindResultChanged(PP_Instance instance, |
217 int32_t index) { | 234 int32_t index) { |
218 NOTIMPLEMENTED(); // Not proxied yet. | 235 NOTIMPLEMENTED(); // Not proxied yet. |
219 } | 236 } |
220 | 237 |
221 PP_Bool PPB_Instance_Proxy::IsFullscreen(PP_Instance instance) { | |
222 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | |
223 GetInstanceData(instance); | |
224 if (!data) | |
225 return PP_FALSE; | |
226 return data->fullscreen; | |
227 } | |
228 | |
229 PP_Bool PPB_Instance_Proxy::FlashIsFullscreen(PP_Instance instance) { | 238 PP_Bool PPB_Instance_Proxy::FlashIsFullscreen(PP_Instance instance) { |
230 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 239 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
231 GetInstanceData(instance); | 240 GetInstanceData(instance); |
232 if (!data) | 241 if (!data) |
233 return PP_FALSE; | 242 return PP_FALSE; |
234 return data->flash_fullscreen; | 243 return data->flash_fullscreen; |
235 } | 244 } |
236 | 245 |
237 PP_Bool PPB_Instance_Proxy::SetFullscreen(PP_Instance instance, | 246 PP_Bool PPB_Instance_Proxy::SetFullscreen(PP_Instance instance, |
238 PP_Bool fullscreen) { | 247 PP_Bool fullscreen) { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 dispatcher()->Send(new PpapiHostMsg_PPBInstance_LockMouse( | 394 dispatcher()->Send(new PpapiHostMsg_PPBInstance_LockMouse( |
386 API_ID_PPB_INSTANCE, instance)); | 395 API_ID_PPB_INSTANCE, instance)); |
387 return PP_OK_COMPLETIONPENDING; | 396 return PP_OK_COMPLETIONPENDING; |
388 } | 397 } |
389 | 398 |
390 void PPB_Instance_Proxy::UnlockMouse(PP_Instance instance) { | 399 void PPB_Instance_Proxy::UnlockMouse(PP_Instance instance) { |
391 dispatcher()->Send(new PpapiHostMsg_PPBInstance_UnlockMouse( | 400 dispatcher()->Send(new PpapiHostMsg_PPBInstance_UnlockMouse( |
392 API_ID_PPB_INSTANCE, instance)); | 401 API_ID_PPB_INSTANCE, instance)); |
393 } | 402 } |
394 | 403 |
395 void PPB_Instance_Proxy::OnMsgGetWindowObject( | 404 void PPB_Instance_Proxy::OnHostMsgGetWindowObject( |
396 PP_Instance instance, | 405 PP_Instance instance, |
397 SerializedVarReturnValue result) { | 406 SerializedVarReturnValue result) { |
398 EnterInstanceNoLock enter(instance, false); | 407 EnterInstanceNoLock enter(instance, false); |
399 if (enter.succeeded()) | 408 if (enter.succeeded()) |
400 result.Return(dispatcher(), enter.functions()->GetWindowObject(instance)); | 409 result.Return(dispatcher(), enter.functions()->GetWindowObject(instance)); |
401 } | 410 } |
402 | 411 |
403 void PPB_Instance_Proxy::OnMsgGetOwnerElementObject( | 412 void PPB_Instance_Proxy::OnHostMsgGetOwnerElementObject( |
404 PP_Instance instance, | 413 PP_Instance instance, |
405 SerializedVarReturnValue result) { | 414 SerializedVarReturnValue result) { |
406 EnterInstanceNoLock enter(instance, false); | 415 EnterInstanceNoLock enter(instance, false); |
407 if (enter.succeeded()) { | 416 if (enter.succeeded()) { |
408 result.Return(dispatcher(), | 417 result.Return(dispatcher(), |
409 enter.functions()->GetOwnerElementObject(instance)); | 418 enter.functions()->GetOwnerElementObject(instance)); |
410 } | 419 } |
411 } | 420 } |
412 | 421 |
413 void PPB_Instance_Proxy::OnMsgBindGraphics(PP_Instance instance, | 422 void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance, |
414 const HostResource& device, | 423 const HostResource& device, |
415 PP_Bool* result) { | 424 PP_Bool* result) { |
416 EnterInstanceNoLock enter(instance, false); | 425 EnterInstanceNoLock enter(instance, false); |
417 if (enter.succeeded()) { | 426 if (enter.succeeded()) { |
418 *result = enter.functions()->BindGraphics(instance, | 427 *result = enter.functions()->BindGraphics(instance, |
419 device.host_resource()); | 428 device.host_resource()); |
420 } | 429 } |
421 } | 430 } |
422 | 431 |
423 void PPB_Instance_Proxy::OnMsgIsFullFrame(PP_Instance instance, | 432 void PPB_Instance_Proxy::OnHostMsgIsFullFrame(PP_Instance instance, |
424 PP_Bool* result) { | 433 PP_Bool* result) { |
425 EnterInstanceNoLock enter(instance, false); | 434 EnterInstanceNoLock enter(instance, false); |
426 if (enter.succeeded()) | 435 if (enter.succeeded()) |
427 *result = enter.functions()->IsFullFrame(instance); | 436 *result = enter.functions()->IsFullFrame(instance); |
428 } | 437 } |
429 | 438 |
430 void PPB_Instance_Proxy::OnMsgExecuteScript( | 439 void PPB_Instance_Proxy::OnHostMsgExecuteScript( |
431 PP_Instance instance, | 440 PP_Instance instance, |
432 SerializedVarReceiveInput script, | 441 SerializedVarReceiveInput script, |
433 SerializedVarOutParam out_exception, | 442 SerializedVarOutParam out_exception, |
434 SerializedVarReturnValue result) { | 443 SerializedVarReturnValue result) { |
435 EnterInstanceNoLock enter(instance, false); | 444 EnterInstanceNoLock enter(instance, false); |
436 if (enter.failed()) | 445 if (enter.failed()) |
437 return; | 446 return; |
438 | 447 |
439 if (dispatcher()->IsPlugin()) | 448 if (dispatcher()->IsPlugin()) |
440 NOTREACHED(); | 449 NOTREACHED(); |
441 else | 450 else |
442 static_cast<HostDispatcher*>(dispatcher())->set_allow_plugin_reentrancy(); | 451 static_cast<HostDispatcher*>(dispatcher())->set_allow_plugin_reentrancy(); |
443 | 452 |
444 result.Return(dispatcher(), enter.functions()->ExecuteScript( | 453 result.Return(dispatcher(), enter.functions()->ExecuteScript( |
445 instance, | 454 instance, |
446 script.Get(dispatcher()), | 455 script.Get(dispatcher()), |
447 out_exception.OutParam(dispatcher()))); | 456 out_exception.OutParam(dispatcher()))); |
448 } | 457 } |
449 | 458 |
450 void PPB_Instance_Proxy::OnMsgGetDefaultCharSet( | 459 void PPB_Instance_Proxy::OnHostMsgGetDefaultCharSet( |
451 PP_Instance instance, | 460 PP_Instance instance, |
452 SerializedVarReturnValue result) { | 461 SerializedVarReturnValue result) { |
453 EnterInstanceNoLock enter(instance, false); | 462 EnterInstanceNoLock enter(instance, false); |
454 if (enter.succeeded()) | 463 if (enter.succeeded()) |
455 result.Return(dispatcher(), enter.functions()->GetDefaultCharSet(instance)); | 464 result.Return(dispatcher(), enter.functions()->GetDefaultCharSet(instance)); |
456 } | 465 } |
457 | 466 |
458 void PPB_Instance_Proxy::OnMsgLog(PP_Instance instance, | 467 void PPB_Instance_Proxy::OnHostMsgLog(PP_Instance instance, |
459 int log_level, | 468 int log_level, |
460 SerializedVarReceiveInput value) { | 469 SerializedVarReceiveInput value) { |
461 EnterInstanceNoLock enter(instance, false); | 470 EnterInstanceNoLock enter(instance, false); |
462 if (enter.succeeded()) | 471 if (enter.succeeded()) |
463 enter.functions()->Log(instance, log_level, value.Get(dispatcher())); | 472 enter.functions()->Log(instance, log_level, value.Get(dispatcher())); |
464 } | 473 } |
465 | 474 |
466 void PPB_Instance_Proxy::OnMsgLogWithSource(PP_Instance instance, | 475 void PPB_Instance_Proxy::OnHostMsgLogWithSource( |
467 int log_level, | 476 PP_Instance instance, |
468 SerializedVarReceiveInput source, | 477 int log_level, |
469 SerializedVarReceiveInput value) { | 478 SerializedVarReceiveInput source, |
| 479 SerializedVarReceiveInput value) { |
470 EnterInstanceNoLock enter(instance, false); | 480 EnterInstanceNoLock enter(instance, false); |
471 if (enter.succeeded()) { | 481 if (enter.succeeded()) { |
472 enter.functions()->LogWithSource(instance, log_level, | 482 enter.functions()->LogWithSource(instance, log_level, |
473 source.Get(dispatcher()), | 483 source.Get(dispatcher()), |
474 value.Get(dispatcher())); | 484 value.Get(dispatcher())); |
475 } | 485 } |
476 } | 486 } |
477 | 487 |
478 void PPB_Instance_Proxy::OnMsgSetFullscreen(PP_Instance instance, | 488 void PPB_Instance_Proxy::OnHostMsgSetFullscreen(PP_Instance instance, |
479 PP_Bool fullscreen, | 489 PP_Bool fullscreen, |
480 PP_Bool* result) { | 490 PP_Bool* result) { |
481 EnterInstanceNoLock enter(instance, false); | 491 EnterInstanceNoLock enter(instance, false); |
482 if (enter.succeeded()) | 492 if (enter.succeeded()) |
483 *result = enter.functions()->SetFullscreen(instance, fullscreen); | 493 *result = enter.functions()->SetFullscreen(instance, fullscreen); |
484 } | 494 } |
485 | 495 |
486 | 496 |
487 void PPB_Instance_Proxy::OnMsgFlashSetFullscreen(PP_Instance instance, | 497 void PPB_Instance_Proxy::OnHostMsgFlashSetFullscreen(PP_Instance instance, |
488 PP_Bool fullscreen, | 498 PP_Bool fullscreen, |
489 PP_Bool* result) { | 499 PP_Bool* result) { |
490 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); | 500 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); |
491 if (enter.succeeded()) | 501 if (enter.succeeded()) |
492 *result = enter.functions()->FlashSetFullscreen(instance, fullscreen); | 502 *result = enter.functions()->FlashSetFullscreen(instance, fullscreen); |
493 } | 503 } |
494 | 504 |
495 void PPB_Instance_Proxy::OnMsgGetScreenSize(PP_Instance instance, | 505 void PPB_Instance_Proxy::OnHostMsgGetScreenSize(PP_Instance instance, |
496 PP_Bool* result, | 506 PP_Bool* result, |
497 PP_Size* size) { | 507 PP_Size* size) { |
498 EnterInstanceNoLock enter(instance, false); | 508 EnterInstanceNoLock enter(instance, false); |
499 if (enter.succeeded()) | 509 if (enter.succeeded()) |
500 *result = enter.functions()->GetScreenSize(instance, size); | 510 *result = enter.functions()->GetScreenSize(instance, size); |
501 } | 511 } |
502 | 512 |
503 void PPB_Instance_Proxy::OnMsgFlashGetScreenSize(PP_Instance instance, | 513 void PPB_Instance_Proxy::OnHostMsgFlashGetScreenSize(PP_Instance instance, |
504 PP_Bool* result, | 514 PP_Bool* result, |
505 PP_Size* size) { | 515 PP_Size* size) { |
506 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); | 516 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); |
507 if (enter.succeeded()) | 517 if (enter.succeeded()) |
508 *result = enter.functions()->FlashGetScreenSize(instance, size); | 518 *result = enter.functions()->FlashGetScreenSize(instance, size); |
509 } | 519 } |
510 | 520 |
511 void PPB_Instance_Proxy::OnMsgRequestInputEvents(PP_Instance instance, | 521 void PPB_Instance_Proxy::OnHostMsgRequestInputEvents(PP_Instance instance, |
512 bool is_filtering, | 522 bool is_filtering, |
513 uint32_t event_classes) { | 523 uint32_t event_classes) { |
514 EnterInstanceNoLock enter(instance, false); | 524 EnterInstanceNoLock enter(instance, false); |
515 if (enter.succeeded()) { | 525 if (enter.succeeded()) { |
516 if (is_filtering) | 526 if (is_filtering) |
517 enter.functions()->RequestFilteringInputEvents(instance, event_classes); | 527 enter.functions()->RequestFilteringInputEvents(instance, event_classes); |
518 else | 528 else |
519 enter.functions()->RequestInputEvents(instance, event_classes); | 529 enter.functions()->RequestInputEvents(instance, event_classes); |
520 } | 530 } |
521 } | 531 } |
522 | 532 |
523 void PPB_Instance_Proxy::OnMsgClearInputEvents(PP_Instance instance, | 533 void PPB_Instance_Proxy::OnHostMsgClearInputEvents(PP_Instance instance, |
524 uint32_t event_classes) { | 534 uint32_t event_classes) { |
525 EnterInstanceNoLock enter(instance, false); | 535 EnterInstanceNoLock enter(instance, false); |
526 if (enter.succeeded()) | 536 if (enter.succeeded()) |
527 enter.functions()->ClearInputEventRequest(instance, event_classes); | 537 enter.functions()->ClearInputEventRequest(instance, event_classes); |
528 } | 538 } |
529 | 539 |
530 void PPB_Instance_Proxy::OnMsgPostMessage(PP_Instance instance, | 540 void PPB_Instance_Proxy::OnHostMsgPostMessage(PP_Instance instance, |
531 SerializedVarReceiveInput message) { | 541 SerializedVarReceiveInput message) { |
532 EnterInstanceNoLock enter(instance, false); | 542 EnterInstanceNoLock enter(instance, false); |
533 if (enter.succeeded()) | 543 if (enter.succeeded()) |
534 enter.functions()->PostMessage(instance, message.Get(dispatcher())); | 544 enter.functions()->PostMessage(instance, message.Get(dispatcher())); |
535 } | 545 } |
536 | 546 |
537 void PPB_Instance_Proxy::OnMsgLockMouse(PP_Instance instance) { | 547 void PPB_Instance_Proxy::OnHostMsgLockMouse(PP_Instance instance) { |
538 EnterHostFunctionForceCallback<PPB_Instance_FunctionAPI> enter( | 548 EnterHostFunctionForceCallback<PPB_Instance_FunctionAPI> enter( |
539 instance, callback_factory_, | 549 instance, callback_factory_, |
540 &PPB_Instance_Proxy::MouseLockCompleteInHost, instance); | 550 &PPB_Instance_Proxy::MouseLockCompleteInHost, instance); |
541 if (enter.succeeded()) | 551 if (enter.succeeded()) |
542 enter.SetResult(enter.functions()->LockMouse(instance, enter.callback())); | 552 enter.SetResult(enter.functions()->LockMouse(instance, enter.callback())); |
543 } | 553 } |
544 | 554 |
545 void PPB_Instance_Proxy::OnMsgUnlockMouse(PP_Instance instance) { | 555 void PPB_Instance_Proxy::OnHostMsgUnlockMouse(PP_Instance instance) { |
546 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true); | 556 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true); |
547 if (enter.succeeded()) | 557 if (enter.succeeded()) |
548 enter.functions()->UnlockMouse(instance); | 558 enter.functions()->UnlockMouse(instance); |
549 } | 559 } |
550 | 560 |
551 void PPB_Instance_Proxy::OnMsgResolveRelativeToDocument( | 561 void PPB_Instance_Proxy::OnHostMsgResolveRelativeToDocument( |
552 PP_Instance instance, | 562 PP_Instance instance, |
553 SerializedVarReceiveInput relative, | 563 SerializedVarReceiveInput relative, |
554 SerializedVarReturnValue result) { | 564 SerializedVarReturnValue result) { |
555 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true); | 565 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true); |
556 if (enter.succeeded()) { | 566 if (enter.succeeded()) { |
557 result.Return(dispatcher(), | 567 result.Return(dispatcher(), |
558 enter.functions()->ResolveRelativeToDocument( | 568 enter.functions()->ResolveRelativeToDocument( |
559 instance, relative.Get(dispatcher()), NULL)); | 569 instance, relative.Get(dispatcher()), NULL)); |
560 } | 570 } |
561 } | 571 } |
562 | 572 |
563 void PPB_Instance_Proxy::OnMsgDocumentCanRequest(PP_Instance instance, | 573 void PPB_Instance_Proxy::OnHostMsgDocumentCanRequest( |
564 SerializedVarReceiveInput url, | 574 PP_Instance instance, |
565 PP_Bool* result) { | 575 SerializedVarReceiveInput url, |
| 576 PP_Bool* result) { |
566 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true); | 577 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true); |
567 if (enter.succeeded()) { | 578 if (enter.succeeded()) { |
568 *result = enter.functions()->DocumentCanRequest(instance, | 579 *result = enter.functions()->DocumentCanRequest(instance, |
569 url.Get(dispatcher())); | 580 url.Get(dispatcher())); |
570 } | 581 } |
571 } | 582 } |
572 | 583 |
573 void PPB_Instance_Proxy::OnMsgDocumentCanAccessDocument(PP_Instance active, | 584 void PPB_Instance_Proxy::OnHostMsgDocumentCanAccessDocument(PP_Instance active, |
574 PP_Instance target, | 585 PP_Instance target, |
575 PP_Bool* result) { | 586 PP_Bool* result) { |
576 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(active, true); | 587 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(active, true); |
577 if (enter.succeeded()) | 588 if (enter.succeeded()) |
578 *result = enter.functions()->DocumentCanAccessDocument(active, target); | 589 *result = enter.functions()->DocumentCanAccessDocument(active, target); |
579 } | 590 } |
580 | 591 |
581 void PPB_Instance_Proxy::OnMsgGetDocumentURL(PP_Instance instance, | 592 void PPB_Instance_Proxy::OnHostMsgGetDocumentURL(PP_Instance instance, |
582 SerializedVarReturnValue result) { | 593 SerializedVarReturnValue result
) { |
583 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true); | 594 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true); |
584 if (enter.succeeded()) { | 595 if (enter.succeeded()) { |
585 result.Return(dispatcher(), | 596 result.Return(dispatcher(), |
586 enter.functions()->GetDocumentURL(instance, NULL)); | 597 enter.functions()->GetDocumentURL(instance, NULL)); |
587 } | 598 } |
588 } | 599 } |
589 | 600 |
590 void PPB_Instance_Proxy::OnMsgGetPluginInstanceURL( | 601 void PPB_Instance_Proxy::OnHostMsgGetPluginInstanceURL( |
591 PP_Instance instance, | 602 PP_Instance instance, |
592 SerializedVarReturnValue result) { | 603 SerializedVarReturnValue result) { |
593 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true); | 604 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, true); |
594 if (enter.succeeded()) { | 605 if (enter.succeeded()) { |
595 result.Return(dispatcher(), | 606 result.Return(dispatcher(), |
596 enter.functions()->GetPluginInstanceURL(instance, NULL)); | 607 enter.functions()->GetPluginInstanceURL(instance, NULL)); |
597 } | 608 } |
598 } | 609 } |
599 | 610 |
600 void PPB_Instance_Proxy::OnMsgMouseLockComplete(PP_Instance instance, | 611 void PPB_Instance_Proxy::OnPluginMsgMouseLockComplete(PP_Instance instance, |
601 int32_t result) { | 612 int32_t result) { |
602 // Save the mouse callback on the instance data. | 613 // Save the mouse callback on the instance data. |
603 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 614 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
604 GetInstanceData(instance); | 615 GetInstanceData(instance); |
605 if (!data) | 616 if (!data) |
606 return; // Instance was probably deleted. | 617 return; // Instance was probably deleted. |
607 if (!data->mouse_lock_callback.func) { | 618 if (!data->mouse_lock_callback.func) { |
608 NOTREACHED(); | 619 NOTREACHED(); |
609 return; | 620 return; |
610 } | 621 } |
611 PP_RunAndClearCompletionCallback(&data->mouse_lock_callback, result); | 622 PP_RunAndClearCompletionCallback(&data->mouse_lock_callback, result); |
612 } | 623 } |
613 | 624 |
614 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, | 625 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, |
615 PP_Instance instance) { | 626 PP_Instance instance) { |
616 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( | 627 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( |
617 API_ID_PPB_INSTANCE, instance, result)); | 628 API_ID_PPB_INSTANCE, instance, result)); |
618 } | 629 } |
619 | 630 |
620 } // namespace proxy | 631 } // namespace proxy |
621 } // namespace ppapi | 632 } // namespace ppapi |
OLD | NEW |