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