| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/c/dev/ppb_font_dev.h" | 10 #include "ppapi/c/dev/ppb_font_dev.h" |
| 11 #include "ppapi/c/dev/ppb_var_deprecated.h" | 11 #include "ppapi/c/dev/ppb_var_deprecated.h" |
| 12 #include "ppapi/c/pp_errors.h" | 12 #include "ppapi/c/pp_errors.h" |
| 13 #include "ppapi/c/pp_resource.h" | 13 #include "ppapi/c/pp_resource.h" |
| 14 #include "ppapi/c/private/ppb_flash.h" | 14 #include "ppapi/c/private/ppb_flash.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_resource.h" | 17 #include "ppapi/proxy/plugin_resource_tracker.h" |
| 18 #include "ppapi/proxy/ppapi_messages.h" | 18 #include "ppapi/proxy/ppapi_messages.h" |
| 19 #include "ppapi/proxy/proxy_module.h" | 19 #include "ppapi/proxy/proxy_module.h" |
| 20 #include "ppapi/proxy/serialized_var.h" | 20 #include "ppapi/proxy/serialized_var.h" |
| 21 #include "ppapi/shared_impl/resource.h" |
| 21 | 22 |
| 22 using ppapi::HostResource; | 23 using ppapi::HostResource; |
| 24 using ppapi::Resource; |
| 23 | 25 |
| 24 namespace pp { | 26 namespace pp { |
| 25 namespace proxy { | 27 namespace proxy { |
| 26 | 28 |
| 27 namespace { | 29 namespace { |
| 28 | 30 |
| 29 void SetInstanceAlwaysOnTop(PP_Instance pp_instance, PP_Bool on_top) { | 31 void SetInstanceAlwaysOnTop(PP_Instance pp_instance, PP_Bool on_top) { |
| 30 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(pp_instance); | 32 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(pp_instance); |
| 31 if (dispatcher) { | 33 if (dispatcher) { |
| 32 dispatcher->Send(new PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop( | 34 dispatcher->Send(new PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop( |
| 33 INTERFACE_ID_PPB_FLASH, pp_instance, on_top)); | 35 INTERFACE_ID_PPB_FLASH, pp_instance, on_top)); |
| 34 } | 36 } |
| 35 } | 37 } |
| 36 | 38 |
| 37 PP_Bool DrawGlyphs(PP_Instance instance, | 39 PP_Bool DrawGlyphs(PP_Instance instance, |
| 38 PP_Resource pp_image_data, | 40 PP_Resource pp_image_data, |
| 39 const PP_FontDescription_Dev* font_desc, | 41 const PP_FontDescription_Dev* font_desc, |
| 40 uint32_t color, | 42 uint32_t color, |
| 41 PP_Point position, | 43 PP_Point position, |
| 42 PP_Rect clip, | 44 PP_Rect clip, |
| 43 const float transformation[3][3], | 45 const float transformation[3][3], |
| 44 uint32_t glyph_count, | 46 uint32_t glyph_count, |
| 45 const uint16_t glyph_indices[], | 47 const uint16_t glyph_indices[], |
| 46 const PP_Point glyph_advances[]) { | 48 const PP_Point glyph_advances[]) { |
| 47 PluginResource* image_data = PluginResourceTracker::GetInstance()-> | 49 Resource* image_data = PluginResourceTracker::GetInstance()->GetResource( |
| 48 GetResourceObject(pp_image_data); | 50 pp_image_data); |
| 49 if (!image_data) | 51 if (!image_data) |
| 50 return PP_FALSE; | 52 return PP_FALSE; |
| 51 // The instance parameter isn't strictly necessary but we check that it | 53 // The instance parameter isn't strictly necessary but we check that it |
| 52 // matches anyway. | 54 // matches anyway. |
| 53 if (image_data->instance() != instance) | 55 if (image_data->pp_instance() != instance) |
| 54 return PP_FALSE; | 56 return PP_FALSE; |
| 55 | 57 |
| 56 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance( | 58 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance( |
| 57 image_data->instance()); | 59 image_data->pp_instance()); |
| 58 if (!dispatcher) | 60 if (!dispatcher) |
| 59 return PP_FALSE; | 61 return PP_FALSE; |
| 60 | 62 |
| 61 PPBFlash_DrawGlyphs_Params params; | 63 PPBFlash_DrawGlyphs_Params params; |
| 62 params.image_data = image_data->host_resource(); | 64 params.image_data = image_data->host_resource(); |
| 63 params.font_desc.SetFromPPFontDescription(dispatcher, *font_desc, true); | 65 params.font_desc.SetFromPPFontDescription(dispatcher, *font_desc, true); |
| 64 params.color = color; | 66 params.color = color; |
| 65 params.position = position; | 67 params.position = position; |
| 66 params.clip = clip; | 68 params.clip = clip; |
| 67 for (int i = 0; i < 3; i++) { | 69 for (int i = 0; i < 3; i++) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 89 | 91 |
| 90 ReceiveSerializedVarReturnValue result; | 92 ReceiveSerializedVarReturnValue result; |
| 91 dispatcher->Send(new PpapiHostMsg_PPBFlash_GetProxyForURL( | 93 dispatcher->Send(new PpapiHostMsg_PPBFlash_GetProxyForURL( |
| 92 INTERFACE_ID_PPB_FLASH, instance, url, &result)); | 94 INTERFACE_ID_PPB_FLASH, instance, url, &result)); |
| 93 return result.Return(dispatcher); | 95 return result.Return(dispatcher); |
| 94 } | 96 } |
| 95 | 97 |
| 96 int32_t Navigate(PP_Resource request_id, | 98 int32_t Navigate(PP_Resource request_id, |
| 97 const char* target, | 99 const char* target, |
| 98 bool from_user_action) { | 100 bool from_user_action) { |
| 99 PluginResource* request_object = | 101 Resource* request_object = |
| 100 PluginResourceTracker::GetInstance()->GetResourceObject(request_id); | 102 PluginResourceTracker::GetInstance()->GetResource(request_id); |
| 101 if (!request_object) | 103 if (!request_object) |
| 102 return PP_ERROR_BADRESOURCE; | 104 return PP_ERROR_BADRESOURCE; |
| 103 | 105 |
| 104 PluginDispatcher* dispatcher = | 106 PluginDispatcher* dispatcher = |
| 105 PluginDispatcher::GetForInstance(request_object->instance()); | 107 PluginDispatcher::GetForInstance(request_object->pp_instance()); |
| 106 if (!dispatcher) | 108 if (!dispatcher) |
| 107 return PP_ERROR_FAILED; | 109 return PP_ERROR_FAILED; |
| 108 | 110 |
| 109 int32_t result = PP_ERROR_FAILED; | 111 int32_t result = PP_ERROR_FAILED; |
| 110 dispatcher->Send(new PpapiHostMsg_PPBFlash_Navigate( | 112 dispatcher->Send(new PpapiHostMsg_PPBFlash_Navigate( |
| 111 INTERFACE_ID_PPB_FLASH, | 113 INTERFACE_ID_PPB_FLASH, |
| 112 request_object->host_resource(), target, from_user_action, | 114 request_object->host_resource(), target, from_user_action, |
| 113 &result)); | 115 &result)); |
| 114 return result; | 116 return result; |
| 115 } | 117 } |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 } | 286 } |
| 285 | 287 |
| 286 void PPB_Flash_Proxy::OnMsgGetLocalTimeZoneOffset(PP_Instance instance, | 288 void PPB_Flash_Proxy::OnMsgGetLocalTimeZoneOffset(PP_Instance instance, |
| 287 PP_Time t, | 289 PP_Time t, |
| 288 double* result) { | 290 double* result) { |
| 289 *result = ppb_flash_target()->GetLocalTimeZoneOffset(instance, t); | 291 *result = ppb_flash_target()->GetLocalTimeZoneOffset(instance, t); |
| 290 } | 292 } |
| 291 | 293 |
| 292 } // namespace proxy | 294 } // namespace proxy |
| 293 } // namespace pp | 295 } // namespace pp |
| OLD | NEW |