| 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_tracker.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 #include "ppapi/shared_impl/resource.h" |
| 22 | 22 |
| 23 using ppapi::HostResource; | 23 namespace ppapi { |
| 24 using ppapi::Resource; | |
| 25 | |
| 26 namespace pp { | |
| 27 namespace proxy { | 24 namespace proxy { |
| 28 | 25 |
| 29 namespace { | 26 namespace { |
| 30 | 27 |
| 31 void SetInstanceAlwaysOnTop(PP_Instance pp_instance, PP_Bool on_top) { | 28 void SetInstanceAlwaysOnTop(PP_Instance pp_instance, PP_Bool on_top) { |
| 32 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(pp_instance); | 29 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(pp_instance); |
| 33 if (dispatcher) { | 30 if (dispatcher) { |
| 34 dispatcher->Send(new PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop( | 31 dispatcher->Send(new PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop( |
| 35 INTERFACE_ID_PPB_FLASH, pp_instance, on_top)); | 32 INTERFACE_ID_PPB_FLASH, pp_instance, on_top)); |
| 36 } | 33 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 dispatcher->Send(new PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset( | 146 dispatcher->Send(new PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset( |
| 150 INTERFACE_ID_PPB_FLASH, instance, t, &result)); | 147 INTERFACE_ID_PPB_FLASH, instance, t, &result)); |
| 151 return result; | 148 return result; |
| 152 } | 149 } |
| 153 | 150 |
| 154 PP_Var GetCommandLineArgs(PP_Module pp_module) { | 151 PP_Var GetCommandLineArgs(PP_Module pp_module) { |
| 155 const PPB_Var_Deprecated* var_deprecated = | 152 const PPB_Var_Deprecated* var_deprecated = |
| 156 static_cast<const PPB_Var_Deprecated*>( | 153 static_cast<const PPB_Var_Deprecated*>( |
| 157 PluginDispatcher::GetInterfaceFromDispatcher( | 154 PluginDispatcher::GetInterfaceFromDispatcher( |
| 158 PPB_VAR_DEPRECATED_INTERFACE)); | 155 PPB_VAR_DEPRECATED_INTERFACE)); |
| 159 std::string args = | 156 std::string args = ProxyModule::GetInstance()->GetFlashCommandLineArgs(); |
| 160 pp::proxy::ProxyModule::GetInstance()->GetFlashCommandLineArgs(); | |
| 161 return var_deprecated->VarFromUtf8(pp_module, args.data(), args.length()); | 157 return var_deprecated->VarFromUtf8(pp_module, args.data(), args.length()); |
| 162 } | 158 } |
| 163 | 159 |
| 164 const PPB_Flash flash_interface = { | 160 const PPB_Flash flash_interface = { |
| 165 &SetInstanceAlwaysOnTop, | 161 &SetInstanceAlwaysOnTop, |
| 166 &DrawGlyphs, | 162 &DrawGlyphs, |
| 167 &GetProxyForURL, | 163 &GetProxyForURL, |
| 168 &Navigate, | 164 &Navigate, |
| 169 &RunMessageLoop, | 165 &RunMessageLoop, |
| 170 &QuitMessageLoop, | 166 &QuitMessageLoop, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 // TODO(brettw) handle bad messages! | 221 // TODO(brettw) handle bad messages! |
| 226 return handled; | 222 return handled; |
| 227 } | 223 } |
| 228 | 224 |
| 229 void PPB_Flash_Proxy::OnMsgSetInstanceAlwaysOnTop( | 225 void PPB_Flash_Proxy::OnMsgSetInstanceAlwaysOnTop( |
| 230 PP_Instance instance, | 226 PP_Instance instance, |
| 231 PP_Bool on_top) { | 227 PP_Bool on_top) { |
| 232 ppb_flash_target()->SetInstanceAlwaysOnTop(instance, on_top); | 228 ppb_flash_target()->SetInstanceAlwaysOnTop(instance, on_top); |
| 233 } | 229 } |
| 234 | 230 |
| 235 void PPB_Flash_Proxy::OnMsgDrawGlyphs( | 231 void PPB_Flash_Proxy::OnMsgDrawGlyphs(const PPBFlash_DrawGlyphs_Params& params, |
| 236 const pp::proxy::PPBFlash_DrawGlyphs_Params& params, | 232 PP_Bool* result) { |
| 237 PP_Bool* result) { | |
| 238 *result = PP_FALSE; | 233 *result = PP_FALSE; |
| 239 | 234 |
| 240 PP_FontDescription_Dev font_desc; | 235 PP_FontDescription_Dev font_desc; |
| 241 params.font_desc.SetToPPFontDescription(dispatcher(), &font_desc, false); | 236 params.font_desc.SetToPPFontDescription(dispatcher(), &font_desc, false); |
| 242 | 237 |
| 243 if (params.glyph_indices.size() != params.glyph_advances.size() || | 238 if (params.glyph_indices.size() != params.glyph_advances.size() || |
| 244 params.glyph_indices.empty()) | 239 params.glyph_indices.empty()) |
| 245 return; | 240 return; |
| 246 | 241 |
| 247 *result = ppb_flash_target()->DrawGlyphs( | 242 *result = ppb_flash_target()->DrawGlyphs( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 ppb_flash_target()->QuitMessageLoop(instance); | 280 ppb_flash_target()->QuitMessageLoop(instance); |
| 286 } | 281 } |
| 287 | 282 |
| 288 void PPB_Flash_Proxy::OnMsgGetLocalTimeZoneOffset(PP_Instance instance, | 283 void PPB_Flash_Proxy::OnMsgGetLocalTimeZoneOffset(PP_Instance instance, |
| 289 PP_Time t, | 284 PP_Time t, |
| 290 double* result) { | 285 double* result) { |
| 291 *result = ppb_flash_target()->GetLocalTimeZoneOffset(instance, t); | 286 *result = ppb_flash_target()->GetLocalTimeZoneOffset(instance, t); |
| 292 } | 287 } |
| 293 | 288 |
| 294 } // namespace proxy | 289 } // namespace proxy |
| 295 } // namespace pp | 290 } // namespace ppapi |
| OLD | NEW |