| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 OnHostMsgSetInstanceAlwaysOnTop) | 104 OnHostMsgSetInstanceAlwaysOnTop) |
| 105 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_DrawGlyphs, | 105 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_DrawGlyphs, |
| 106 OnHostMsgDrawGlyphs) | 106 OnHostMsgDrawGlyphs) |
| 107 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_Navigate, OnHostMsgNavigate) | 107 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_Navigate, OnHostMsgNavigate) |
| 108 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset, | 108 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset, |
| 109 OnHostMsgGetLocalTimeZoneOffset) | 109 OnHostMsgGetLocalTimeZoneOffset) |
| 110 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_IsRectTopmost, | 110 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_IsRectTopmost, |
| 111 OnHostMsgIsRectTopmost) | 111 OnHostMsgIsRectTopmost) |
| 112 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_InvokePrinting, | 112 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_InvokePrinting, |
| 113 OnHostMsgInvokePrinting) | 113 OnHostMsgInvokePrinting) |
| 114 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetSetting, | |
| 115 OnHostMsgGetSetting) | |
| 116 IPC_MESSAGE_UNHANDLED(handled = false) | 114 IPC_MESSAGE_UNHANDLED(handled = false) |
| 117 IPC_END_MESSAGE_MAP() | 115 IPC_END_MESSAGE_MAP() |
| 118 // TODO(brettw) handle bad messages! | 116 // TODO(brettw) handle bad messages! |
| 119 return handled; | 117 return handled; |
| 120 } | 118 } |
| 121 | 119 |
| 122 void PPB_Flash_Proxy::SetInstanceAlwaysOnTop(PP_Instance instance, | 120 void PPB_Flash_Proxy::SetInstanceAlwaysOnTop(PP_Instance instance, |
| 123 PP_Bool on_top) { | 121 PP_Bool on_top) { |
| 124 dispatcher()->Send(new PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop( | 122 dispatcher()->Send(new PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop( |
| 125 API_ID_PPB_FLASH, instance, on_top)); | 123 API_ID_PPB_FLASH, instance, on_top)); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } | 243 } |
| 246 | 244 |
| 247 PP_Bool PPB_Flash_Proxy::IsRectTopmost(PP_Instance instance, | 245 PP_Bool PPB_Flash_Proxy::IsRectTopmost(PP_Instance instance, |
| 248 const PP_Rect* rect) { | 246 const PP_Rect* rect) { |
| 249 PP_Bool result = PP_FALSE; | 247 PP_Bool result = PP_FALSE; |
| 250 dispatcher()->Send(new PpapiHostMsg_PPBFlash_IsRectTopmost( | 248 dispatcher()->Send(new PpapiHostMsg_PPBFlash_IsRectTopmost( |
| 251 API_ID_PPB_FLASH, instance, *rect, &result)); | 249 API_ID_PPB_FLASH, instance, *rect, &result)); |
| 252 return result; | 250 return result; |
| 253 } | 251 } |
| 254 | 252 |
| 255 PP_Var PPB_Flash_Proxy::GetSetting(PP_Instance instance, | |
| 256 PP_FlashSetting setting) { | |
| 257 PluginDispatcher* plugin_dispatcher = | |
| 258 static_cast<PluginDispatcher*>(dispatcher()); | |
| 259 switch (setting) { | |
| 260 case PP_FLASHSETTING_3DENABLED: | |
| 261 return PP_MakeBool(PP_FromBool( | |
| 262 plugin_dispatcher->preferences().is_3d_supported)); | |
| 263 case PP_FLASHSETTING_INCOGNITO: | |
| 264 return PP_MakeBool(PP_FromBool(plugin_dispatcher->incognito())); | |
| 265 case PP_FLASHSETTING_STAGE3DENABLED: | |
| 266 return PP_MakeBool(PP_FromBool( | |
| 267 plugin_dispatcher->preferences().is_stage3d_supported)); | |
| 268 case PP_FLASHSETTING_LANGUAGE: | |
| 269 return StringVar::StringToPPVar( | |
| 270 PluginGlobals::Get()->GetUILanguage()); | |
| 271 case PP_FLASHSETTING_NUMCORES: | |
| 272 return PP_MakeInt32(plugin_dispatcher->preferences().number_of_cpu_cores); | |
| 273 case PP_FLASHSETTING_LSORESTRICTIONS: { | |
| 274 ReceiveSerializedVarReturnValue result; | |
| 275 dispatcher()->Send(new PpapiHostMsg_PPBFlash_GetSetting( | |
| 276 API_ID_PPB_FLASH, instance, setting, &result)); | |
| 277 return result.Return(dispatcher()); | |
| 278 } | |
| 279 } | |
| 280 return PP_MakeUndefined(); | |
| 281 } | |
| 282 | |
| 283 void PPB_Flash_Proxy::OnHostMsgSetInstanceAlwaysOnTop(PP_Instance instance, | 253 void PPB_Flash_Proxy::OnHostMsgSetInstanceAlwaysOnTop(PP_Instance instance, |
| 284 PP_Bool on_top) { | 254 PP_Bool on_top) { |
| 285 EnterInstanceNoLock enter(instance); | 255 EnterInstanceNoLock enter(instance); |
| 286 if (enter.succeeded()) | 256 if (enter.succeeded()) |
| 287 enter.functions()->GetFlashAPI()->SetInstanceAlwaysOnTop(instance, on_top); | 257 enter.functions()->GetFlashAPI()->SetInstanceAlwaysOnTop(instance, on_top); |
| 288 } | 258 } |
| 289 | 259 |
| 290 void PPB_Flash_Proxy::OnHostMsgDrawGlyphs( | 260 void PPB_Flash_Proxy::OnHostMsgDrawGlyphs( |
| 291 PP_Instance instance, | 261 PP_Instance instance, |
| 292 const PPBFlash_DrawGlyphs_Params& params, | 262 const PPBFlash_DrawGlyphs_Params& params, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 void PPB_Flash_Proxy::OnHostMsgIsRectTopmost(PP_Instance instance, | 333 void PPB_Flash_Proxy::OnHostMsgIsRectTopmost(PP_Instance instance, |
| 364 PP_Rect rect, | 334 PP_Rect rect, |
| 365 PP_Bool* result) { | 335 PP_Bool* result) { |
| 366 EnterInstanceNoLock enter(instance); | 336 EnterInstanceNoLock enter(instance); |
| 367 if (enter.succeeded()) | 337 if (enter.succeeded()) |
| 368 *result = enter.functions()->GetFlashAPI()->IsRectTopmost(instance, &rect); | 338 *result = enter.functions()->GetFlashAPI()->IsRectTopmost(instance, &rect); |
| 369 else | 339 else |
| 370 *result = PP_FALSE; | 340 *result = PP_FALSE; |
| 371 } | 341 } |
| 372 | 342 |
| 373 void PPB_Flash_Proxy::OnHostMsgGetSetting(PP_Instance instance, | |
| 374 PP_FlashSetting setting, | |
| 375 SerializedVarReturnValue id) { | |
| 376 EnterInstanceNoLock enter(instance); | |
| 377 if (enter.succeeded()) { | |
| 378 id.Return(dispatcher(), | |
| 379 enter.functions()->GetFlashAPI()->GetSetting( | |
| 380 instance, setting)); | |
| 381 } else { | |
| 382 id.Return(dispatcher(), PP_MakeUndefined()); | |
| 383 } | |
| 384 } | |
| 385 | |
| 386 void PPB_Flash_Proxy::OnHostMsgInvokePrinting(PP_Instance instance) { | 343 void PPB_Flash_Proxy::OnHostMsgInvokePrinting(PP_Instance instance) { |
| 387 // This function is actually implemented in the PPB_Flash_Print interface. | 344 // This function is actually implemented in the PPB_Flash_Print interface. |
| 388 // It's rarely used enough that we just request this interface when needed. | 345 // It's rarely used enough that we just request this interface when needed. |
| 389 const PPB_Flash_Print_1_0* print_interface = | 346 const PPB_Flash_Print_1_0* print_interface = |
| 390 static_cast<const PPB_Flash_Print_1_0*>( | 347 static_cast<const PPB_Flash_Print_1_0*>( |
| 391 dispatcher()->local_get_interface()(PPB_FLASH_PRINT_INTERFACE_1_0)); | 348 dispatcher()->local_get_interface()(PPB_FLASH_PRINT_INTERFACE_1_0)); |
| 392 if (print_interface) | 349 if (print_interface) |
| 393 print_interface->InvokePrinting(instance); | 350 print_interface->InvokePrinting(instance); |
| 394 } | 351 } |
| 395 | 352 |
| 396 } // namespace proxy | 353 } // namespace proxy |
| 397 } // namespace ppapi | 354 } // namespace ppapi |
| OLD | NEW |