| 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_time.h" | 8 #include "ppapi/c/pp_time.h" |
| 9 #include "ppapi/c/pp_var.h" | 9 #include "ppapi/c/pp_var.h" |
| 10 #include "ppapi/c/ppb_audio_config.h" | 10 #include "ppapi/c/ppb_audio_config.h" |
| 11 #include "ppapi/c/ppb_instance.h" | 11 #include "ppapi/c/ppb_instance.h" |
| 12 #include "ppapi/c/ppb_messaging.h" | 12 #include "ppapi/c/ppb_messaging.h" |
| 13 #include "ppapi/c/ppb_mouse_lock.h" | 13 #include "ppapi/c/ppb_mouse_lock.h" |
| 14 #include "ppapi/proxy/enter_proxy.h" | 14 #include "ppapi/proxy/enter_proxy.h" |
| 15 #include "ppapi/proxy/host_dispatcher.h" | 15 #include "ppapi/proxy/host_dispatcher.h" |
| 16 #include "ppapi/proxy/plugin_dispatcher.h" | 16 #include "ppapi/proxy/plugin_dispatcher.h" |
| 17 #include "ppapi/proxy/plugin_proxy_delegate.h" | 17 #include "ppapi/proxy/plugin_proxy_delegate.h" |
| 18 #include "ppapi/proxy/ppapi_messages.h" | 18 #include "ppapi/proxy/ppapi_messages.h" |
| 19 #include "ppapi/proxy/ppb_flash_proxy.h" |
| 19 #include "ppapi/proxy/serialized_var.h" | 20 #include "ppapi/proxy/serialized_var.h" |
| 20 #include "ppapi/shared_impl/ppapi_globals.h" | 21 #include "ppapi/shared_impl/ppapi_globals.h" |
| 21 #include "ppapi/shared_impl/ppb_url_util_shared.h" | 22 #include "ppapi/shared_impl/ppb_url_util_shared.h" |
| 22 #include "ppapi/shared_impl/ppb_view_shared.h" | 23 #include "ppapi/shared_impl/ppb_view_shared.h" |
| 23 #include "ppapi/shared_impl/var.h" | 24 #include "ppapi/shared_impl/var.h" |
| 24 #include "ppapi/thunk/enter.h" | 25 #include "ppapi/thunk/enter.h" |
| 25 #include "ppapi/thunk/thunk.h" | 26 #include "ppapi/thunk/thunk.h" |
| 26 | 27 |
| 27 // Windows headers interfere with this file. | 28 // Windows headers interfere with this file. |
| 28 #ifdef PostMessage | 29 #ifdef PostMessage |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 OnHostMsgGetAudioHardwareOutputSampleRate) | 90 OnHostMsgGetAudioHardwareOutputSampleRate) |
| 90 IPC_MESSAGE_HANDLER( | 91 IPC_MESSAGE_HANDLER( |
| 91 PpapiHostMsg_PPBInstance_GetAudioHardwareOutputBufferSize, | 92 PpapiHostMsg_PPBInstance_GetAudioHardwareOutputBufferSize, |
| 92 OnHostMsgGetAudioHardwareOutputBufferSize) | 93 OnHostMsgGetAudioHardwareOutputBufferSize) |
| 93 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript, | 94 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript, |
| 94 OnHostMsgExecuteScript) | 95 OnHostMsgExecuteScript) |
| 95 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDefaultCharSet, | 96 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDefaultCharSet, |
| 96 OnHostMsgGetDefaultCharSet) | 97 OnHostMsgGetDefaultCharSet) |
| 97 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PostMessage, | 98 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PostMessage, |
| 98 OnHostMsgPostMessage) | 99 OnHostMsgPostMessage) |
| 99 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_FlashSetFullscreen, | |
| 100 OnHostMsgFlashSetFullscreen) | |
| 101 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_FlashGetScreenSize, | |
| 102 OnHostMsgFlashGetScreenSize) | |
| 103 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetFullscreen, | 100 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetFullscreen, |
| 104 OnHostMsgSetFullscreen) | 101 OnHostMsgSetFullscreen) |
| 105 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetScreenSize, | 102 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetScreenSize, |
| 106 OnHostMsgGetScreenSize) | 103 OnHostMsgGetScreenSize) |
| 107 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_RequestInputEvents, | 104 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_RequestInputEvents, |
| 108 OnHostMsgRequestInputEvents) | 105 OnHostMsgRequestInputEvents) |
| 109 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ClearInputEvents, | 106 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ClearInputEvents, |
| 110 OnHostMsgClearInputEvents) | 107 OnHostMsgClearInputEvents) |
| 111 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInputEvent_HandleInputEvent_ACK, | 108 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInputEvent_HandleInputEvent_ACK, |
| 112 OnMsgHandleInputEventAck) | 109 OnMsgHandleInputEventAck) |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 int32_t total, | 229 int32_t total, |
| 233 PP_Bool final_result) { | 230 PP_Bool final_result) { |
| 234 NOTIMPLEMENTED(); // Not proxied yet. | 231 NOTIMPLEMENTED(); // Not proxied yet. |
| 235 } | 232 } |
| 236 | 233 |
| 237 void PPB_Instance_Proxy::SelectedFindResultChanged(PP_Instance instance, | 234 void PPB_Instance_Proxy::SelectedFindResultChanged(PP_Instance instance, |
| 238 int32_t index) { | 235 int32_t index) { |
| 239 NOTIMPLEMENTED(); // Not proxied yet. | 236 NOTIMPLEMENTED(); // Not proxied yet. |
| 240 } | 237 } |
| 241 | 238 |
| 242 PP_Bool PPB_Instance_Proxy::FlashIsFullscreen(PP_Instance instance) { | |
| 243 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | |
| 244 GetInstanceData(instance); | |
| 245 if (!data) | |
| 246 return PP_FALSE; | |
| 247 return data->flash_fullscreen; | |
| 248 } | |
| 249 | |
| 250 PP_Var PPB_Instance_Proxy::GetFontFamilies(PP_Instance instance) { | 239 PP_Var PPB_Instance_Proxy::GetFontFamilies(PP_Instance instance) { |
| 251 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 240 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| 252 if (!dispatcher) | 241 if (!dispatcher) |
| 253 return PP_MakeUndefined(); | 242 return PP_MakeUndefined(); |
| 254 | 243 |
| 255 // Assume the font families don't change, so we can cache the result globally. | 244 // Assume the font families don't change, so we can cache the result globally. |
| 256 CR_DEFINE_STATIC_LOCAL(std::string, families, ()); | 245 CR_DEFINE_STATIC_LOCAL(std::string, families, ()); |
| 257 if (families.empty()) { | 246 if (families.empty()) { |
| 258 PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( | 247 PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( |
| 259 new PpapiHostMsg_PPBInstance_GetFontFamilies(&families)); | 248 new PpapiHostMsg_PPBInstance_GetFontFamilies(&families)); |
| 260 } | 249 } |
| 261 | 250 |
| 262 return StringVar::StringToPPVar(families); | 251 return StringVar::StringToPPVar(families); |
| 263 } | 252 } |
| 264 | 253 |
| 265 PP_Bool PPB_Instance_Proxy::SetFullscreen(PP_Instance instance, | 254 PP_Bool PPB_Instance_Proxy::SetFullscreen(PP_Instance instance, |
| 266 PP_Bool fullscreen) { | 255 PP_Bool fullscreen) { |
| 267 PP_Bool result = PP_FALSE; | 256 PP_Bool result = PP_FALSE; |
| 268 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetFullscreen( | 257 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetFullscreen( |
| 269 API_ID_PPB_INSTANCE, instance, fullscreen, &result)); | 258 API_ID_PPB_INSTANCE, instance, fullscreen, &result)); |
| 270 return result; | 259 return result; |
| 271 } | 260 } |
| 272 | 261 |
| 273 PP_Bool PPB_Instance_Proxy::FlashSetFullscreen(PP_Instance instance, | |
| 274 PP_Bool fullscreen) { | |
| 275 PP_Bool result = PP_FALSE; | |
| 276 dispatcher()->Send(new PpapiHostMsg_PPBInstance_FlashSetFullscreen( | |
| 277 API_ID_PPB_INSTANCE, instance, fullscreen, &result)); | |
| 278 return result; | |
| 279 } | |
| 280 | |
| 281 PP_Bool PPB_Instance_Proxy::GetScreenSize(PP_Instance instance, | 262 PP_Bool PPB_Instance_Proxy::GetScreenSize(PP_Instance instance, |
| 282 PP_Size* size) { | 263 PP_Size* size) { |
| 283 PP_Bool result = PP_FALSE; | 264 PP_Bool result = PP_FALSE; |
| 284 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetScreenSize( | 265 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetScreenSize( |
| 285 API_ID_PPB_INSTANCE, instance, &result, size)); | 266 API_ID_PPB_INSTANCE, instance, &result, size)); |
| 286 return result; | 267 return result; |
| 287 } | 268 } |
| 288 | 269 |
| 289 PP_Bool PPB_Instance_Proxy::FlashGetScreenSize(PP_Instance instance, | 270 thunk::PPB_Flash_API* PPB_Instance_Proxy::GetFlashAPI() { |
| 290 PP_Size* size) { | 271 InterfaceProxy* ip = dispatcher()->GetInterfaceProxy(API_ID_PPB_FLASH); |
| 291 PP_Bool result = PP_FALSE; | 272 return static_cast<PPB_Flash_Proxy*>(ip); |
| 292 dispatcher()->Send(new PpapiHostMsg_PPBInstance_FlashGetScreenSize( | |
| 293 API_ID_PPB_INSTANCE, instance, &result, size)); | |
| 294 return result; | |
| 295 } | 273 } |
| 296 | 274 |
| 297 void PPB_Instance_Proxy::SampleGamepads(PP_Instance instance, | 275 void PPB_Instance_Proxy::SampleGamepads(PP_Instance instance, |
| 298 PP_GamepadsSampleData* data) { | 276 PP_GamepadsSampleData* data) { |
| 299 NOTIMPLEMENTED(); | 277 NOTIMPLEMENTED(); |
| 300 } | 278 } |
| 301 | 279 |
| 302 int32_t PPB_Instance_Proxy::RequestInputEvents(PP_Instance instance, | 280 int32_t PPB_Instance_Proxy::RequestInputEvents(PP_Instance instance, |
| 303 uint32_t event_classes) { | 281 uint32_t event_classes) { |
| 304 dispatcher()->Send(new PpapiHostMsg_PPBInstance_RequestInputEvents( | 282 dispatcher()->Send(new PpapiHostMsg_PPBInstance_RequestInputEvents( |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 | 520 |
| 543 void PPB_Instance_Proxy::OnHostMsgSetFullscreen(PP_Instance instance, | 521 void PPB_Instance_Proxy::OnHostMsgSetFullscreen(PP_Instance instance, |
| 544 PP_Bool fullscreen, | 522 PP_Bool fullscreen, |
| 545 PP_Bool* result) { | 523 PP_Bool* result) { |
| 546 EnterInstanceNoLock enter(instance, false); | 524 EnterInstanceNoLock enter(instance, false); |
| 547 if (enter.succeeded()) | 525 if (enter.succeeded()) |
| 548 *result = enter.functions()->SetFullscreen(instance, fullscreen); | 526 *result = enter.functions()->SetFullscreen(instance, fullscreen); |
| 549 } | 527 } |
| 550 | 528 |
| 551 | 529 |
| 552 void PPB_Instance_Proxy::OnHostMsgFlashSetFullscreen(PP_Instance instance, | |
| 553 PP_Bool fullscreen, | |
| 554 PP_Bool* result) { | |
| 555 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); | |
| 556 if (enter.succeeded()) | |
| 557 *result = enter.functions()->FlashSetFullscreen(instance, fullscreen); | |
| 558 } | |
| 559 | |
| 560 void PPB_Instance_Proxy::OnHostMsgGetScreenSize(PP_Instance instance, | 530 void PPB_Instance_Proxy::OnHostMsgGetScreenSize(PP_Instance instance, |
| 561 PP_Bool* result, | 531 PP_Bool* result, |
| 562 PP_Size* size) { | 532 PP_Size* size) { |
| 563 EnterInstanceNoLock enter(instance, false); | 533 EnterInstanceNoLock enter(instance, false); |
| 564 if (enter.succeeded()) | 534 if (enter.succeeded()) |
| 565 *result = enter.functions()->GetScreenSize(instance, size); | 535 *result = enter.functions()->GetScreenSize(instance, size); |
| 566 } | 536 } |
| 567 | 537 |
| 568 void PPB_Instance_Proxy::OnHostMsgFlashGetScreenSize(PP_Instance instance, | |
| 569 PP_Bool* result, | |
| 570 PP_Size* size) { | |
| 571 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); | |
| 572 if (enter.succeeded()) | |
| 573 *result = enter.functions()->FlashGetScreenSize(instance, size); | |
| 574 } | |
| 575 | |
| 576 void PPB_Instance_Proxy::OnHostMsgRequestInputEvents(PP_Instance instance, | 538 void PPB_Instance_Proxy::OnHostMsgRequestInputEvents(PP_Instance instance, |
| 577 bool is_filtering, | 539 bool is_filtering, |
| 578 uint32_t event_classes) { | 540 uint32_t event_classes) { |
| 579 EnterInstanceNoLock enter(instance, false); | 541 EnterInstanceNoLock enter(instance, false); |
| 580 if (enter.succeeded()) { | 542 if (enter.succeeded()) { |
| 581 if (is_filtering) | 543 if (is_filtering) |
| 582 enter.functions()->RequestFilteringInputEvents(instance, event_classes); | 544 enter.functions()->RequestFilteringInputEvents(instance, event_classes); |
| 583 else | 545 else |
| 584 enter.functions()->RequestInputEvents(instance, event_classes); | 546 enter.functions()->RequestInputEvents(instance, event_classes); |
| 585 } | 547 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 } | 665 } |
| 704 | 666 |
| 705 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, | 667 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, |
| 706 PP_Instance instance) { | 668 PP_Instance instance) { |
| 707 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( | 669 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( |
| 708 API_ID_PPB_INSTANCE, instance, result)); | 670 API_ID_PPB_INSTANCE, instance, result)); |
| 709 } | 671 } |
| 710 | 672 |
| 711 } // namespace proxy | 673 } // namespace proxy |
| 712 } // namespace ppapi | 674 } // namespace ppapi |
| OLD | NEW |