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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 | 516 |
539 void PPB_Instance_Proxy::OnHostMsgSetFullscreen(PP_Instance instance, | 517 void PPB_Instance_Proxy::OnHostMsgSetFullscreen(PP_Instance instance, |
540 PP_Bool fullscreen, | 518 PP_Bool fullscreen, |
541 PP_Bool* result) { | 519 PP_Bool* result) { |
542 EnterInstanceNoLock enter(instance, false); | 520 EnterInstanceNoLock enter(instance, false); |
543 if (enter.succeeded()) | 521 if (enter.succeeded()) |
544 *result = enter.functions()->SetFullscreen(instance, fullscreen); | 522 *result = enter.functions()->SetFullscreen(instance, fullscreen); |
545 } | 523 } |
546 | 524 |
547 | 525 |
548 void PPB_Instance_Proxy::OnHostMsgFlashSetFullscreen(PP_Instance instance, | |
549 PP_Bool fullscreen, | |
550 PP_Bool* result) { | |
551 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); | |
552 if (enter.succeeded()) | |
553 *result = enter.functions()->FlashSetFullscreen(instance, fullscreen); | |
554 } | |
555 | |
556 void PPB_Instance_Proxy::OnHostMsgGetScreenSize(PP_Instance instance, | 526 void PPB_Instance_Proxy::OnHostMsgGetScreenSize(PP_Instance instance, |
557 PP_Bool* result, | 527 PP_Bool* result, |
558 PP_Size* size) { | 528 PP_Size* size) { |
559 EnterInstanceNoLock enter(instance, false); | 529 EnterInstanceNoLock enter(instance, false); |
560 if (enter.succeeded()) | 530 if (enter.succeeded()) |
561 *result = enter.functions()->GetScreenSize(instance, size); | 531 *result = enter.functions()->GetScreenSize(instance, size); |
562 } | 532 } |
563 | 533 |
564 void PPB_Instance_Proxy::OnHostMsgFlashGetScreenSize(PP_Instance instance, | |
565 PP_Bool* result, | |
566 PP_Size* size) { | |
567 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); | |
568 if (enter.succeeded()) | |
569 *result = enter.functions()->FlashGetScreenSize(instance, size); | |
570 } | |
571 | |
572 void PPB_Instance_Proxy::OnHostMsgRequestInputEvents(PP_Instance instance, | 534 void PPB_Instance_Proxy::OnHostMsgRequestInputEvents(PP_Instance instance, |
573 bool is_filtering, | 535 bool is_filtering, |
574 uint32_t event_classes) { | 536 uint32_t event_classes) { |
575 EnterInstanceNoLock enter(instance, false); | 537 EnterInstanceNoLock enter(instance, false); |
576 if (enter.succeeded()) { | 538 if (enter.succeeded()) { |
577 if (is_filtering) | 539 if (is_filtering) |
578 enter.functions()->RequestFilteringInputEvents(instance, event_classes); | 540 enter.functions()->RequestFilteringInputEvents(instance, event_classes); |
579 else | 541 else |
580 enter.functions()->RequestInputEvents(instance, event_classes); | 542 enter.functions()->RequestInputEvents(instance, event_classes); |
581 } | 543 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 } | 661 } |
700 | 662 |
701 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, | 663 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result, |
702 PP_Instance instance) { | 664 PP_Instance instance) { |
703 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( | 665 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete( |
704 API_ID_PPB_INSTANCE, instance, result)); | 666 API_ID_PPB_INSTANCE, instance, result)); |
705 } | 667 } |
706 | 668 |
707 } // namespace proxy | 669 } // namespace proxy |
708 } // namespace ppapi | 670 } // namespace ppapi |
OLD | NEW |