| 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/ppapi_messages.h" | 16 #include "ppapi/proxy/ppapi_messages.h" |
| 16 #include "ppapi/proxy/serialized_var.h" | 17 #include "ppapi/proxy/serialized_var.h" |
| 17 #include "ppapi/shared_impl/ppapi_globals.h" | 18 #include "ppapi/shared_impl/ppapi_globals.h" |
| 18 #include "ppapi/shared_impl/ppb_url_util_shared.h" | 19 #include "ppapi/shared_impl/ppb_url_util_shared.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 IPC_BEGIN_MESSAGE_MAP(PPB_Instance_Proxy, msg) | 74 IPC_BEGIN_MESSAGE_MAP(PPB_Instance_Proxy, msg) |
| 74 // Plugin -> Host messages. | 75 // Plugin -> Host messages. |
| 75 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetWindowObject, | 76 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetWindowObject, |
| 76 OnHostMsgGetWindowObject) | 77 OnHostMsgGetWindowObject) |
| 77 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetOwnerElementObject, | 78 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetOwnerElementObject, |
| 78 OnHostMsgGetOwnerElementObject) | 79 OnHostMsgGetOwnerElementObject) |
| 79 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics, | 80 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics, |
| 80 OnHostMsgBindGraphics) | 81 OnHostMsgBindGraphics) |
| 81 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame, | 82 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame, |
| 82 OnHostMsgIsFullFrame) | 83 OnHostMsgIsFullFrame) |
| 84 IPC_MESSAGE_HANDLER( |
| 85 PpapiHostMsg_PPBInstance_GetAudioHardwareOutputSampleRate, |
| 86 OnHostMsgGetAudioHardwareOutputSampleRate) |
| 87 IPC_MESSAGE_HANDLER( |
| 88 PpapiHostMsg_PPBInstance_GetAudioHardwareOutputBufferSize, |
| 89 OnHostMsgGetAudioHardwareOutputBufferSize) |
| 83 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript, | 90 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript, |
| 84 OnHostMsgExecuteScript) | 91 OnHostMsgExecuteScript) |
| 85 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDefaultCharSet, | 92 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDefaultCharSet, |
| 86 OnHostMsgGetDefaultCharSet) | 93 OnHostMsgGetDefaultCharSet) |
| 87 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PostMessage, | 94 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PostMessage, |
| 88 OnHostMsgPostMessage) | 95 OnHostMsgPostMessage) |
| 89 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_FlashSetFullscreen, | 96 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_FlashSetFullscreen, |
| 90 OnHostMsgFlashSetFullscreen) | 97 OnHostMsgFlashSetFullscreen) |
| 91 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_FlashGetScreenSize, | 98 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_FlashGetScreenSize, |
| 92 OnHostMsgFlashGetScreenSize) | 99 OnHostMsgFlashGetScreenSize) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 if (se.IsThrown()) | 183 if (se.IsThrown()) |
| 177 return PP_MakeUndefined(); | 184 return PP_MakeUndefined(); |
| 178 | 185 |
| 179 ReceiveSerializedVarReturnValue result; | 186 ReceiveSerializedVarReturnValue result; |
| 180 dispatcher()->Send(new PpapiHostMsg_PPBInstance_ExecuteScript( | 187 dispatcher()->Send(new PpapiHostMsg_PPBInstance_ExecuteScript( |
| 181 API_ID_PPB_INSTANCE, instance, | 188 API_ID_PPB_INSTANCE, instance, |
| 182 SerializedVarSendInput(dispatcher(), script), &se, &result)); | 189 SerializedVarSendInput(dispatcher(), script), &se, &result)); |
| 183 return result.Return(dispatcher()); | 190 return result.Return(dispatcher()); |
| 184 } | 191 } |
| 185 | 192 |
| 193 uint32_t PPB_Instance_Proxy::GetAudioHardwareOutputSampleRate( |
| 194 PP_Instance instance) { |
| 195 uint32_t result = PP_AUDIOSAMPLERATE_NONE; |
| 196 dispatcher()->Send( |
| 197 new PpapiHostMsg_PPBInstance_GetAudioHardwareOutputSampleRate( |
| 198 API_ID_PPB_INSTANCE, instance, &result)); |
| 199 return result; |
| 200 } |
| 201 |
| 202 uint32_t PPB_Instance_Proxy::GetAudioHardwareOutputBufferSize( |
| 203 PP_Instance instance) { |
| 204 uint32_t result = 0; |
| 205 dispatcher()->Send( |
| 206 new PpapiHostMsg_PPBInstance_GetAudioHardwareOutputBufferSize( |
| 207 API_ID_PPB_INSTANCE, instance, &result)); |
| 208 return result; |
| 209 } |
| 210 |
| 186 PP_Var PPB_Instance_Proxy::GetDefaultCharSet(PP_Instance instance) { | 211 PP_Var PPB_Instance_Proxy::GetDefaultCharSet(PP_Instance instance) { |
| 187 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 212 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| 188 if (!dispatcher) | 213 if (!dispatcher) |
| 189 return PP_MakeUndefined(); | 214 return PP_MakeUndefined(); |
| 190 | 215 |
| 191 ReceiveSerializedVarReturnValue result; | 216 ReceiveSerializedVarReturnValue result; |
| 192 dispatcher->Send(new PpapiHostMsg_PPBInstance_GetDefaultCharSet( | 217 dispatcher->Send(new PpapiHostMsg_PPBInstance_GetDefaultCharSet( |
| 193 API_ID_PPB_INSTANCE, instance, &result)); | 218 API_ID_PPB_INSTANCE, instance, &result)); |
| 194 return result.Return(dispatcher); | 219 return result.Return(dispatcher); |
| 195 } | 220 } |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance, | 422 void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance, |
| 398 const HostResource& device, | 423 const HostResource& device, |
| 399 PP_Bool* result) { | 424 PP_Bool* result) { |
| 400 EnterInstanceNoLock enter(instance, false); | 425 EnterInstanceNoLock enter(instance, false); |
| 401 if (enter.succeeded()) { | 426 if (enter.succeeded()) { |
| 402 *result = enter.functions()->BindGraphics(instance, | 427 *result = enter.functions()->BindGraphics(instance, |
| 403 device.host_resource()); | 428 device.host_resource()); |
| 404 } | 429 } |
| 405 } | 430 } |
| 406 | 431 |
| 432 void PPB_Instance_Proxy::OnHostMsgGetAudioHardwareOutputSampleRate( |
| 433 PP_Instance instance, uint32_t* result) { |
| 434 EnterInstanceNoLock enter(instance, false); |
| 435 if (enter.succeeded()) |
| 436 *result = enter.functions()->GetAudioHardwareOutputSampleRate(instance); |
| 437 } |
| 438 |
| 439 void PPB_Instance_Proxy::OnHostMsgGetAudioHardwareOutputBufferSize( |
| 440 PP_Instance instance, uint32_t* result) { |
| 441 EnterInstanceNoLock enter(instance, false); |
| 442 if (enter.succeeded()) |
| 443 *result = enter.functions()->GetAudioHardwareOutputBufferSize(instance); |
| 444 } |
| 445 |
| 407 void PPB_Instance_Proxy::OnHostMsgIsFullFrame(PP_Instance instance, | 446 void PPB_Instance_Proxy::OnHostMsgIsFullFrame(PP_Instance instance, |
| 408 PP_Bool* result) { | 447 PP_Bool* result) { |
| 409 EnterInstanceNoLock enter(instance, false); | 448 EnterInstanceNoLock enter(instance, false); |
| 410 if (enter.succeeded()) | 449 if (enter.succeeded()) |
| 411 *result = enter.functions()->IsFullFrame(instance); | 450 *result = enter.functions()->IsFullFrame(instance); |
| 412 } | 451 } |
| 413 | 452 |
| 414 void PPB_Instance_Proxy::OnHostMsgExecuteScript( | 453 void PPB_Instance_Proxy::OnHostMsgExecuteScript( |
| 415 PP_Instance instance, | 454 PP_Instance instance, |
| 416 SerializedVarReceiveInput script, | 455 SerializedVarReceiveInput script, |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 } | 616 } |
| 578 | 617 |
| 579 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, | 618 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, |
| 580 PP_Instance instance) { | 619 PP_Instance instance) { |
| 581 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( | 620 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( |
| 582 API_ID_PPB_INSTANCE, instance, result)); | 621 API_ID_PPB_INSTANCE, instance, result)); |
| 583 } | 622 } |
| 584 | 623 |
| 585 } // namespace proxy | 624 } // namespace proxy |
| 586 } // namespace ppapi | 625 } // namespace ppapi |
| OLD | NEW |