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_flash_proxy.h" | 5 #include "ppapi/proxy/ppb_flash_proxy.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 OnHostMsgSetInstanceAlwaysOnTop) | 107 OnHostMsgSetInstanceAlwaysOnTop) |
108 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_DrawGlyphs, | 108 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_DrawGlyphs, |
109 OnHostMsgDrawGlyphs) | 109 OnHostMsgDrawGlyphs) |
110 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetProxyForURL, | 110 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetProxyForURL, |
111 OnHostMsgGetProxyForURL) | 111 OnHostMsgGetProxyForURL) |
112 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_Navigate, OnHostMsgNavigate) | 112 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_Navigate, OnHostMsgNavigate) |
113 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset, | 113 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset, |
114 OnHostMsgGetLocalTimeZoneOffset) | 114 OnHostMsgGetLocalTimeZoneOffset) |
115 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_IsRectTopmost, | 115 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_IsRectTopmost, |
116 OnHostMsgIsRectTopmost) | 116 OnHostMsgIsRectTopmost) |
117 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_FlashSetFullscreen, | |
118 OnHostMsgFlashSetFullscreen) | |
119 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_FlashGetScreenSize, | |
120 OnHostMsgFlashGetScreenSize) | |
121 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_OpenFileRef, | 117 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_OpenFileRef, |
122 OnHostMsgOpenFileRef) | 118 OnHostMsgOpenFileRef) |
123 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QueryFileRef, | 119 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QueryFileRef, |
124 OnHostMsgQueryFileRef) | 120 OnHostMsgQueryFileRef) |
125 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_InvokePrinting, | 121 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_InvokePrinting, |
126 OnHostMsgInvokePrinting) | 122 OnHostMsgInvokePrinting) |
127 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetSetting, | 123 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetSetting, |
128 OnHostMsgGetSetting) | 124 OnHostMsgGetSetting) |
129 IPC_MESSAGE_UNHANDLED(handled = false) | 125 IPC_MESSAGE_UNHANDLED(handled = false) |
130 IPC_END_MESSAGE_MAP() | 126 IPC_END_MESSAGE_MAP() |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 if (enter.failed()) | 484 if (enter.failed()) |
489 return PP_ERROR_BADRESOURCE; | 485 return PP_ERROR_BADRESOURCE; |
490 | 486 |
491 int32_t result = PP_ERROR_FAILED; | 487 int32_t result = PP_ERROR_FAILED; |
492 dispatcher()->Send(new PpapiHostMsg_PPBFlash_QueryFileRef( | 488 dispatcher()->Send(new PpapiHostMsg_PPBFlash_QueryFileRef( |
493 API_ID_PPB_FLASH, instance, enter.resource()->host_resource(), info, | 489 API_ID_PPB_FLASH, instance, enter.resource()->host_resource(), info, |
494 &result)); | 490 &result)); |
495 return result; | 491 return result; |
496 } | 492 } |
497 | 493 |
498 PP_Bool PPB_Flash_Proxy::FlashIsFullscreen(PP_Instance instance) { | |
499 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | |
500 GetInstanceData(instance); | |
501 if (!data) | |
502 return PP_FALSE; | |
503 return data->flash_fullscreen; | |
504 } | |
505 | |
506 PP_Bool PPB_Flash_Proxy::FlashSetFullscreen(PP_Instance instance, | |
507 PP_Bool fullscreen) { | |
508 PP_Bool result = PP_FALSE; | |
509 dispatcher()->Send(new PpapiHostMsg_PPBFlash_FlashSetFullscreen( | |
510 API_ID_PPB_FLASH, instance, fullscreen, &result)); | |
511 return result; | |
512 } | |
513 | |
514 PP_Bool PPB_Flash_Proxy::FlashGetScreenSize(PP_Instance instance, | |
515 PP_Size* size) { | |
516 PP_Bool result = PP_FALSE; | |
517 dispatcher()->Send(new PpapiHostMsg_PPBFlash_FlashGetScreenSize( | |
518 API_ID_PPB_FLASH, instance, &result, size)); | |
519 return result; | |
520 } | |
521 | |
522 void PPB_Flash_Proxy::OnHostMsgSetInstanceAlwaysOnTop(PP_Instance instance, | 494 void PPB_Flash_Proxy::OnHostMsgSetInstanceAlwaysOnTop(PP_Instance instance, |
523 PP_Bool on_top) { | 495 PP_Bool on_top) { |
524 EnterInstanceNoLock enter(instance); | 496 EnterInstanceNoLock enter(instance); |
525 if (enter.succeeded()) | 497 if (enter.succeeded()) |
526 enter.functions()->GetFlashAPI()->SetInstanceAlwaysOnTop(instance, on_top); | 498 enter.functions()->GetFlashAPI()->SetInstanceAlwaysOnTop(instance, on_top); |
527 } | 499 } |
528 | 500 |
529 void PPB_Flash_Proxy::OnHostMsgDrawGlyphs( | 501 void PPB_Flash_Proxy::OnHostMsgDrawGlyphs( |
530 PP_Instance instance, | 502 PP_Instance instance, |
531 const PPBFlash_DrawGlyphs_Params& params, | 503 const PPBFlash_DrawGlyphs_Params& params, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 void PPB_Flash_Proxy::OnHostMsgIsRectTopmost(PP_Instance instance, | 587 void PPB_Flash_Proxy::OnHostMsgIsRectTopmost(PP_Instance instance, |
616 PP_Rect rect, | 588 PP_Rect rect, |
617 PP_Bool* result) { | 589 PP_Bool* result) { |
618 EnterInstanceNoLock enter(instance); | 590 EnterInstanceNoLock enter(instance); |
619 if (enter.succeeded()) | 591 if (enter.succeeded()) |
620 *result = enter.functions()->GetFlashAPI()->IsRectTopmost(instance, &rect); | 592 *result = enter.functions()->GetFlashAPI()->IsRectTopmost(instance, &rect); |
621 else | 593 else |
622 *result = PP_FALSE; | 594 *result = PP_FALSE; |
623 } | 595 } |
624 | 596 |
625 void PPB_Flash_Proxy::OnHostMsgFlashSetFullscreen(PP_Instance instance, | |
626 PP_Bool fullscreen, | |
627 PP_Bool* result) { | |
628 EnterInstanceNoLock enter(instance); | |
629 if (enter.succeeded()) { | |
630 *result = enter.functions()->GetFlashAPI()->FlashSetFullscreen( | |
631 instance, fullscreen); | |
632 } else { | |
633 *result = PP_FALSE; | |
634 } | |
635 } | |
636 | |
637 void PPB_Flash_Proxy::OnHostMsgFlashGetScreenSize(PP_Instance instance, | |
638 PP_Bool* result, | |
639 PP_Size* size) { | |
640 EnterInstanceNoLock enter(instance); | |
641 if (enter.succeeded()) { | |
642 *result = enter.functions()->GetFlashAPI()->FlashGetScreenSize( | |
643 instance, size); | |
644 } else { | |
645 size->width = 0; | |
646 size->height = 0; | |
647 } | |
648 } | |
649 | |
650 void PPB_Flash_Proxy::OnHostMsgOpenFileRef( | 597 void PPB_Flash_Proxy::OnHostMsgOpenFileRef( |
651 PP_Instance instance, | 598 PP_Instance instance, |
652 const HostResource& host_resource, | 599 const HostResource& host_resource, |
653 int32_t mode, | 600 int32_t mode, |
654 IPC::PlatformFileForTransit* file_handle, | 601 IPC::PlatformFileForTransit* file_handle, |
655 int32_t* result) { | 602 int32_t* result) { |
656 EnterInstanceNoLock enter(instance); | 603 EnterInstanceNoLock enter(instance); |
657 if (enter.failed()) { | 604 if (enter.failed()) { |
658 *result = PP_ERROR_BADARGUMENT; | 605 *result = PP_ERROR_BADARGUMENT; |
659 return; | 606 return; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 // It's rarely used enough that we just request this interface when needed. | 645 // It's rarely used enough that we just request this interface when needed. |
699 const PPB_Flash_Print_1_0* print_interface = | 646 const PPB_Flash_Print_1_0* print_interface = |
700 static_cast<const PPB_Flash_Print_1_0*>( | 647 static_cast<const PPB_Flash_Print_1_0*>( |
701 dispatcher()->local_get_interface()(PPB_FLASH_PRINT_INTERFACE_1_0)); | 648 dispatcher()->local_get_interface()(PPB_FLASH_PRINT_INTERFACE_1_0)); |
702 if (print_interface) | 649 if (print_interface) |
703 print_interface->InvokePrinting(instance); | 650 print_interface->InvokePrinting(instance); |
704 } | 651 } |
705 | 652 |
706 } // namespace proxy | 653 } // namespace proxy |
707 } // namespace ppapi | 654 } // namespace ppapi |
OLD | NEW |