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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_WriteClipboardData, | 119 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_WriteClipboardData, |
120 OnHostMsgWriteClipboardData) | 120 OnHostMsgWriteClipboardData) |
121 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_OpenFileRef, | 121 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_OpenFileRef, |
122 OnHostMsgOpenFileRef) | 122 OnHostMsgOpenFileRef) |
123 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QueryFileRef, | 123 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QueryFileRef, |
124 OnHostMsgQueryFileRef) | 124 OnHostMsgQueryFileRef) |
125 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetDeviceID, | 125 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetDeviceID, |
126 OnHostMsgGetDeviceID) | 126 OnHostMsgGetDeviceID) |
127 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_InvokePrinting, | 127 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_InvokePrinting, |
128 OnHostMsgInvokePrinting) | 128 OnHostMsgInvokePrinting) |
| 129 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetSetting, |
| 130 OnHostMsgGetSetting) |
129 IPC_MESSAGE_UNHANDLED(handled = false) | 131 IPC_MESSAGE_UNHANDLED(handled = false) |
130 IPC_END_MESSAGE_MAP() | 132 IPC_END_MESSAGE_MAP() |
131 // TODO(brettw) handle bad messages! | 133 // TODO(brettw) handle bad messages! |
132 return handled; | 134 return handled; |
133 } | 135 } |
134 | 136 |
135 void PPB_Flash_Proxy::SetInstanceAlwaysOnTop(PP_Instance instance, | 137 void PPB_Flash_Proxy::SetInstanceAlwaysOnTop(PP_Instance instance, |
136 PP_Bool on_top) { | 138 PP_Bool on_top) { |
137 dispatcher()->Send(new PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop( | 139 dispatcher()->Send(new PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop( |
138 API_ID_PPB_FLASH, instance, on_top)); | 140 API_ID_PPB_FLASH, instance, on_top)); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 case PP_FLASHSETTING_INCOGNITO: | 299 case PP_FLASHSETTING_INCOGNITO: |
298 return PP_MakeBool(PP_FromBool(plugin_dispatcher->incognito())); | 300 return PP_MakeBool(PP_FromBool(plugin_dispatcher->incognito())); |
299 case PP_FLASHSETTING_STAGE3DENABLED: | 301 case PP_FLASHSETTING_STAGE3DENABLED: |
300 return PP_MakeBool(PP_FromBool( | 302 return PP_MakeBool(PP_FromBool( |
301 plugin_dispatcher->preferences().is_stage3d_supported)); | 303 plugin_dispatcher->preferences().is_stage3d_supported)); |
302 case PP_FLASHSETTING_LANGUAGE: | 304 case PP_FLASHSETTING_LANGUAGE: |
303 return StringVar::StringToPPVar( | 305 return StringVar::StringToPPVar( |
304 PluginGlobals::Get()->plugin_proxy_delegate()->GetUILanguage()); | 306 PluginGlobals::Get()->plugin_proxy_delegate()->GetUILanguage()); |
305 case PP_FLASHSETTING_NUMCORES: | 307 case PP_FLASHSETTING_NUMCORES: |
306 return PP_MakeInt32(plugin_dispatcher->preferences().number_of_cpu_cores); | 308 return PP_MakeInt32(plugin_dispatcher->preferences().number_of_cpu_cores); |
| 309 case PP_FLASHSETTING_LSORESTRICTIONS: { |
| 310 ReceiveSerializedVarReturnValue result; |
| 311 dispatcher()->Send(new PpapiHostMsg_PPBFlash_GetSetting( |
| 312 API_ID_PPB_FLASH, instance, setting, &result)); |
| 313 return result.Return(dispatcher()); |
| 314 } |
307 } | 315 } |
308 return PP_MakeUndefined(); | 316 return PP_MakeUndefined(); |
309 } | 317 } |
310 | 318 |
311 PP_Bool PPB_Flash_Proxy::SetCrashData(PP_Instance instance, | 319 PP_Bool PPB_Flash_Proxy::SetCrashData(PP_Instance instance, |
312 PP_FlashCrashKey key, | 320 PP_FlashCrashKey key, |
313 PP_Var value) { | 321 PP_Var value) { |
314 switch (key) { | 322 switch (key) { |
315 case PP_FLASHCRASHKEY_URL: | 323 case PP_FLASHCRASHKEY_URL: |
316 StringVar *url_string_var(StringVar::FromPPVar(value)); | 324 StringVar *url_string_var(StringVar::FromPPVar(value)); |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 int32_t* result) { | 832 int32_t* result) { |
825 EnterInstanceNoLock enter(instance); | 833 EnterInstanceNoLock enter(instance); |
826 if (enter.failed()) { | 834 if (enter.failed()) { |
827 *result = PP_ERROR_BADARGUMENT; | 835 *result = PP_ERROR_BADARGUMENT; |
828 return; | 836 return; |
829 } | 837 } |
830 *result = enter.functions()->GetFlashAPI()->QueryFileRef( | 838 *result = enter.functions()->GetFlashAPI()->QueryFileRef( |
831 instance, host_resource.host_resource(), info); | 839 instance, host_resource.host_resource(), info); |
832 } | 840 } |
833 | 841 |
| 842 void PPB_Flash_Proxy::OnHostMsgGetSetting(PP_Instance instance, |
| 843 PP_FlashSetting setting, |
| 844 SerializedVarReturnValue id) { |
| 845 EnterInstanceNoLock enter(instance); |
| 846 if (enter.succeeded()) { |
| 847 id.Return(dispatcher(), |
| 848 enter.functions()->GetFlashAPI()->GetSetting( |
| 849 instance, setting)); |
| 850 } else { |
| 851 id.Return(dispatcher(), PP_MakeUndefined()); |
| 852 } |
| 853 } |
| 854 |
834 void PPB_Flash_Proxy::OnHostMsgGetDeviceID(PP_Instance instance, | 855 void PPB_Flash_Proxy::OnHostMsgGetDeviceID(PP_Instance instance, |
835 SerializedVarReturnValue id) { | 856 SerializedVarReturnValue id) { |
836 EnterInstanceNoLock enter(instance); | 857 EnterInstanceNoLock enter(instance); |
837 if (enter.succeeded()) { | 858 if (enter.succeeded()) { |
838 id.Return(dispatcher(), | 859 id.Return(dispatcher(), |
839 enter.functions()->GetFlashAPI()->GetDeviceID( | 860 enter.functions()->GetFlashAPI()->GetDeviceID( |
840 instance)); | 861 instance)); |
841 } else { | 862 } else { |
842 id.Return(dispatcher(), PP_MakeUndefined()); | 863 id.Return(dispatcher(), PP_MakeUndefined()); |
843 } | 864 } |
844 } | 865 } |
845 | 866 |
846 void PPB_Flash_Proxy::OnHostMsgInvokePrinting(PP_Instance instance) { | 867 void PPB_Flash_Proxy::OnHostMsgInvokePrinting(PP_Instance instance) { |
847 // This function is actually implemented in the PPB_Flash_Print interface. | 868 // This function is actually implemented in the PPB_Flash_Print interface. |
848 // It's rarely used enough that we just request this interface when needed. | 869 // It's rarely used enough that we just request this interface when needed. |
849 const PPB_Flash_Print_1_0* print_interface = | 870 const PPB_Flash_Print_1_0* print_interface = |
850 static_cast<const PPB_Flash_Print_1_0*>( | 871 static_cast<const PPB_Flash_Print_1_0*>( |
851 dispatcher()->local_get_interface()(PPB_FLASH_PRINT_INTERFACE_1_0)); | 872 dispatcher()->local_get_interface()(PPB_FLASH_PRINT_INTERFACE_1_0)); |
852 if (print_interface) | 873 if (print_interface) |
853 print_interface->InvokePrinting(instance); | 874 print_interface->InvokePrinting(instance); |
854 } | 875 } |
855 | 876 |
856 } // namespace proxy | 877 } // namespace proxy |
857 } // namespace ppapi | 878 } // namespace ppapi |
OLD | NEW |