| 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 "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_audio_config.h" |
| 9 #include "ppapi/c/ppb_instance.h" | 10 #include "ppapi/c/ppb_instance.h" |
| 10 #include "ppapi/c/ppb_messaging.h" | 11 #include "ppapi/c/ppb_messaging.h" |
| 11 #include "ppapi/c/ppb_mouse_lock.h" | 12 #include "ppapi/c/ppb_mouse_lock.h" |
| 12 #include "ppapi/proxy/enter_proxy.h" | 13 #include "ppapi/proxy/enter_proxy.h" |
| 13 #include "ppapi/proxy/host_dispatcher.h" | 14 #include "ppapi/proxy/host_dispatcher.h" |
| 14 #include "ppapi/proxy/plugin_dispatcher.h" | 15 #include "ppapi/proxy/plugin_dispatcher.h" |
| 15 #include "ppapi/proxy/plugin_proxy_delegate.h" | 16 #include "ppapi/proxy/plugin_proxy_delegate.h" |
| 16 #include "ppapi/proxy/ppapi_messages.h" | 17 #include "ppapi/proxy/ppapi_messages.h" |
| 17 #include "ppapi/proxy/serialized_var.h" | 18 #include "ppapi/proxy/serialized_var.h" |
| 18 #include "ppapi/shared_impl/ppapi_globals.h" | 19 #include "ppapi/shared_impl/ppapi_globals.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 IPC_BEGIN_MESSAGE_MAP(PPB_Instance_Proxy, msg) | 76 IPC_BEGIN_MESSAGE_MAP(PPB_Instance_Proxy, msg) |
| 76 // Plugin -> Host messages. | 77 // Plugin -> Host messages. |
| 77 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetWindowObject, | 78 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetWindowObject, |
| 78 OnHostMsgGetWindowObject) | 79 OnHostMsgGetWindowObject) |
| 79 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetOwnerElementObject, | 80 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetOwnerElementObject, |
| 80 OnHostMsgGetOwnerElementObject) | 81 OnHostMsgGetOwnerElementObject) |
| 81 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics, | 82 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics, |
| 82 OnHostMsgBindGraphics) | 83 OnHostMsgBindGraphics) |
| 83 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame, | 84 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame, |
| 84 OnHostMsgIsFullFrame) | 85 OnHostMsgIsFullFrame) |
| 86 IPC_MESSAGE_HANDLER( |
| 87 PpapiHostMsg_PPBInstance_GetAudioHardwareOutputSampleRate, |
| 88 OnHostMsgGetAudioHardwareOutputSampleRate) |
| 89 IPC_MESSAGE_HANDLER( |
| 90 PpapiHostMsg_PPBInstance_GetAudioHardwareOutputBufferSize, |
| 91 OnHostMsgGetAudioHardwareOutputBufferSize) |
| 85 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript, | 92 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript, |
| 86 OnHostMsgExecuteScript) | 93 OnHostMsgExecuteScript) |
| 87 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDefaultCharSet, | 94 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDefaultCharSet, |
| 88 OnHostMsgGetDefaultCharSet) | 95 OnHostMsgGetDefaultCharSet) |
| 89 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PostMessage, | 96 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PostMessage, |
| 90 OnHostMsgPostMessage) | 97 OnHostMsgPostMessage) |
| 91 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_FlashSetFullscreen, | 98 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_FlashSetFullscreen, |
| 92 OnHostMsgFlashSetFullscreen) | 99 OnHostMsgFlashSetFullscreen) |
| 93 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_FlashGetScreenSize, | 100 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_FlashGetScreenSize, |
| 94 OnHostMsgFlashGetScreenSize) | 101 OnHostMsgFlashGetScreenSize) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 if (se.IsThrown()) | 185 if (se.IsThrown()) |
| 179 return PP_MakeUndefined(); | 186 return PP_MakeUndefined(); |
| 180 | 187 |
| 181 ReceiveSerializedVarReturnValue result; | 188 ReceiveSerializedVarReturnValue result; |
| 182 dispatcher()->Send(new PpapiHostMsg_PPBInstance_ExecuteScript( | 189 dispatcher()->Send(new PpapiHostMsg_PPBInstance_ExecuteScript( |
| 183 API_ID_PPB_INSTANCE, instance, | 190 API_ID_PPB_INSTANCE, instance, |
| 184 SerializedVarSendInput(dispatcher(), script), &se, &result)); | 191 SerializedVarSendInput(dispatcher(), script), &se, &result)); |
| 185 return result.Return(dispatcher()); | 192 return result.Return(dispatcher()); |
| 186 } | 193 } |
| 187 | 194 |
| 195 uint32_t PPB_Instance_Proxy::GetAudioHardwareOutputSampleRate( |
| 196 PP_Instance instance) { |
| 197 uint32_t result = PP_AUDIOSAMPLERATE_NONE; |
| 198 dispatcher()->Send( |
| 199 new PpapiHostMsg_PPBInstance_GetAudioHardwareOutputSampleRate( |
| 200 API_ID_PPB_INSTANCE, instance, &result)); |
| 201 return result; |
| 202 } |
| 203 |
| 204 uint32_t PPB_Instance_Proxy::GetAudioHardwareOutputBufferSize( |
| 205 PP_Instance instance) { |
| 206 uint32_t result = 0; |
| 207 dispatcher()->Send( |
| 208 new PpapiHostMsg_PPBInstance_GetAudioHardwareOutputBufferSize( |
| 209 API_ID_PPB_INSTANCE, instance, &result)); |
| 210 return result; |
| 211 } |
| 212 |
| 188 PP_Var PPB_Instance_Proxy::GetDefaultCharSet(PP_Instance instance) { | 213 PP_Var PPB_Instance_Proxy::GetDefaultCharSet(PP_Instance instance) { |
| 189 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 214 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| 190 if (!dispatcher) | 215 if (!dispatcher) |
| 191 return PP_MakeUndefined(); | 216 return PP_MakeUndefined(); |
| 192 | 217 |
| 193 ReceiveSerializedVarReturnValue result; | 218 ReceiveSerializedVarReturnValue result; |
| 194 dispatcher->Send(new PpapiHostMsg_PPBInstance_GetDefaultCharSet( | 219 dispatcher->Send(new PpapiHostMsg_PPBInstance_GetDefaultCharSet( |
| 195 API_ID_PPB_INSTANCE, instance, &result)); | 220 API_ID_PPB_INSTANCE, instance, &result)); |
| 196 return result.Return(dispatcher); | 221 return result.Return(dispatcher); |
| 197 } | 222 } |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance, | 439 void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance, |
| 415 const HostResource& device, | 440 const HostResource& device, |
| 416 PP_Bool* result) { | 441 PP_Bool* result) { |
| 417 EnterInstanceNoLock enter(instance, false); | 442 EnterInstanceNoLock enter(instance, false); |
| 418 if (enter.succeeded()) { | 443 if (enter.succeeded()) { |
| 419 *result = enter.functions()->BindGraphics(instance, | 444 *result = enter.functions()->BindGraphics(instance, |
| 420 device.host_resource()); | 445 device.host_resource()); |
| 421 } | 446 } |
| 422 } | 447 } |
| 423 | 448 |
| 449 void PPB_Instance_Proxy::OnHostMsgGetAudioHardwareOutputSampleRate( |
| 450 PP_Instance instance, uint32_t* result) { |
| 451 EnterInstanceNoLock enter(instance, false); |
| 452 if (enter.succeeded()) |
| 453 *result = enter.functions()->GetAudioHardwareOutputSampleRate(instance); |
| 454 } |
| 455 |
| 456 void PPB_Instance_Proxy::OnHostMsgGetAudioHardwareOutputBufferSize( |
| 457 PP_Instance instance, uint32_t* result) { |
| 458 EnterInstanceNoLock enter(instance, false); |
| 459 if (enter.succeeded()) |
| 460 *result = enter.functions()->GetAudioHardwareOutputBufferSize(instance); |
| 461 } |
| 462 |
| 424 void PPB_Instance_Proxy::OnHostMsgIsFullFrame(PP_Instance instance, | 463 void PPB_Instance_Proxy::OnHostMsgIsFullFrame(PP_Instance instance, |
| 425 PP_Bool* result) { | 464 PP_Bool* result) { |
| 426 EnterInstanceNoLock enter(instance, false); | 465 EnterInstanceNoLock enter(instance, false); |
| 427 if (enter.succeeded()) | 466 if (enter.succeeded()) |
| 428 *result = enter.functions()->IsFullFrame(instance); | 467 *result = enter.functions()->IsFullFrame(instance); |
| 429 } | 468 } |
| 430 | 469 |
| 431 void PPB_Instance_Proxy::OnHostMsgExecuteScript( | 470 void PPB_Instance_Proxy::OnHostMsgExecuteScript( |
| 432 PP_Instance instance, | 471 PP_Instance instance, |
| 433 SerializedVarReceiveInput script, | 472 SerializedVarReceiveInput script, |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 } | 634 } |
| 596 | 635 |
| 597 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, | 636 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, |
| 598 PP_Instance instance) { | 637 PP_Instance instance) { |
| 599 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( | 638 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( |
| 600 API_ID_PPB_INSTANCE, instance, result)); | 639 API_ID_PPB_INSTANCE, instance, result)); |
| 601 } | 640 } |
| 602 | 641 |
| 603 } // namespace proxy | 642 } // namespace proxy |
| 604 } // namespace ppapi | 643 } // namespace ppapi |
| OLD | NEW |