| 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 "content/renderer/pepper/pepper_plugin_delegate_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "content/common/gpu/client/context_provider_command_buffer.h" | 28 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 29 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 29 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 30 #include "content/common/pepper_messages.h" | 30 #include "content/common/pepper_messages.h" |
| 31 #include "content/common/pepper_plugin_registry.h" | 31 #include "content/common/pepper_plugin_registry.h" |
| 32 #include "content/common/sandbox_util.h" | 32 #include "content/common/sandbox_util.h" |
| 33 #include "content/common/view_messages.h" | 33 #include "content/common/view_messages.h" |
| 34 #include "content/public/common/content_switches.h" | 34 #include "content/public/common/content_switches.h" |
| 35 #include "content/public/common/context_menu_params.h" | 35 #include "content/public/common/context_menu_params.h" |
| 36 #include "content/public/common/media_stream_request.h" | 36 #include "content/public/common/media_stream_request.h" |
| 37 #include "content/public/common/referrer.h" | 37 #include "content/public/common/referrer.h" |
| 38 #include "content/public/common/webplugininfo.h" |
| 38 #include "content/public/renderer/content_renderer_client.h" | 39 #include "content/public/renderer/content_renderer_client.h" |
| 39 #include "content/public/renderer/renderer_restrict_dispatch_group.h" | 40 #include "content/public/renderer/renderer_restrict_dispatch_group.h" |
| 40 #include "content/renderer/gamepad_shared_memory_reader.h" | 41 #include "content/renderer/gamepad_shared_memory_reader.h" |
| 41 #include "content/renderer/media/media_stream_dispatcher.h" | 42 #include "content/renderer/media/media_stream_dispatcher.h" |
| 42 #include "content/renderer/media/pepper_platform_video_decoder_impl.h" | 43 #include "content/renderer/media/pepper_platform_video_decoder_impl.h" |
| 43 #include "content/renderer/p2p/socket_dispatcher.h" | 44 #include "content/renderer/p2p/socket_dispatcher.h" |
| 44 #include "content/renderer/pepper/content_renderer_pepper_host_factory.h" | 45 #include "content/renderer/pepper/content_renderer_pepper_host_factory.h" |
| 45 #include "content/renderer/pepper/pepper_broker_impl.h" | 46 #include "content/renderer/pepper/pepper_broker_impl.h" |
| 46 #include "content/renderer/pepper/pepper_browser_connection.h" | 47 #include "content/renderer/pepper/pepper_browser_connection.h" |
| 47 #include "content/renderer/pepper/pepper_device_enumeration_event_handler.h" | 48 #include "content/renderer/pepper/pepper_device_enumeration_event_handler.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 #include "third_party/WebKit/public/web/WebScreenInfo.h" | 95 #include "third_party/WebKit/public/web/WebScreenInfo.h" |
| 95 #include "third_party/WebKit/public/web/WebView.h" | 96 #include "third_party/WebKit/public/web/WebView.h" |
| 96 #include "ui/gfx/size.h" | 97 #include "ui/gfx/size.h" |
| 97 #include "url/gurl.h" | 98 #include "url/gurl.h" |
| 98 #include "webkit/plugins/ppapi/plugin_module.h" | 99 #include "webkit/plugins/ppapi/plugin_module.h" |
| 99 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 100 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 100 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" | 101 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" |
| 101 #include "webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h" | 102 #include "webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h" |
| 102 #include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h" | 103 #include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h" |
| 103 #include "webkit/plugins/ppapi/resource_helper.h" | 104 #include "webkit/plugins/ppapi/resource_helper.h" |
| 104 #include "webkit/plugins/webplugininfo.h" | |
| 105 | 105 |
| 106 using WebKit::WebView; | 106 using WebKit::WebView; |
| 107 using WebKit::WebFrame; | 107 using WebKit::WebFrame; |
| 108 | 108 |
| 109 namespace content { | 109 namespace content { |
| 110 | 110 |
| 111 namespace { | 111 namespace { |
| 112 | 112 |
| 113 // This class wraps a dispatcher and has the same lifetime. A dispatcher has | 113 // This class wraps a dispatcher and has the same lifetime. A dispatcher has |
| 114 // the same lifetime as a plugin module, which is longer than any particular | 114 // the same lifetime as a plugin module, which is longer than any particular |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 base::PlatformFileError error_code) { | 299 base::PlatformFileError error_code) { |
| 300 base::PlatformFile invalid_file = base::kInvalidPlatformFileValue; | 300 base::PlatformFile invalid_file = base::kInvalidPlatformFileValue; |
| 301 callback.Run(error_code, | 301 callback.Run(error_code, |
| 302 base::PassPlatformFile(&invalid_file), | 302 base::PassPlatformFile(&invalid_file), |
| 303 quota::kQuotaLimitTypeUnknown, | 303 quota::kQuotaLimitTypeUnknown, |
| 304 webkit::ppapi::PluginDelegate::NotifyCloseFileCallback()); | 304 webkit::ppapi::PluginDelegate::NotifyCloseFileCallback()); |
| 305 } | 305 } |
| 306 | 306 |
| 307 void CreateHostForInProcessModule(RenderViewImpl* render_view, | 307 void CreateHostForInProcessModule(RenderViewImpl* render_view, |
| 308 webkit::ppapi::PluginModule* module, | 308 webkit::ppapi::PluginModule* module, |
| 309 const webkit::WebPluginInfo& webplugin_info) { | 309 const WebPluginInfo& webplugin_info) { |
| 310 // First time an in-process plugin was used, make a host for it. | 310 // First time an in-process plugin was used, make a host for it. |
| 311 const PepperPluginInfo* info = | 311 const PepperPluginInfo* info = |
| 312 PepperPluginRegistry::GetInstance()->GetInfoForPlugin(webplugin_info); | 312 PepperPluginRegistry::GetInstance()->GetInfoForPlugin(webplugin_info); |
| 313 DCHECK(!info->is_out_of_process); | 313 DCHECK(!info->is_out_of_process); |
| 314 | 314 |
| 315 ppapi::PpapiPermissions perms( | 315 ppapi::PpapiPermissions perms( |
| 316 PepperPluginRegistry::GetInstance()->GetInfoForPlugin( | 316 PepperPluginRegistry::GetInstance()->GetInfoForPlugin( |
| 317 webplugin_info)->permissions); | 317 webplugin_info)->permissions); |
| 318 RendererPpapiHostImpl* host_impl = | 318 RendererPpapiHostImpl* host_impl = |
| 319 RendererPpapiHostImpl::CreateOnModuleForInProcess( | 319 RendererPpapiHostImpl::CreateOnModuleForInProcess( |
| (...skipping 20 matching lines...) Expand all Loading... |
| 340 last_mouse_event_target_(NULL), | 340 last_mouse_event_target_(NULL), |
| 341 device_enumeration_event_handler_( | 341 device_enumeration_event_handler_( |
| 342 new PepperDeviceEnumerationEventHandler()) { | 342 new PepperDeviceEnumerationEventHandler()) { |
| 343 } | 343 } |
| 344 | 344 |
| 345 PepperPluginDelegateImpl::~PepperPluginDelegateImpl() { | 345 PepperPluginDelegateImpl::~PepperPluginDelegateImpl() { |
| 346 DCHECK(mouse_lock_instances_.empty()); | 346 DCHECK(mouse_lock_instances_.empty()); |
| 347 } | 347 } |
| 348 | 348 |
| 349 WebKit::WebPlugin* PepperPluginDelegateImpl::CreatePepperWebPlugin( | 349 WebKit::WebPlugin* PepperPluginDelegateImpl::CreatePepperWebPlugin( |
| 350 const webkit::WebPluginInfo& webplugin_info, | 350 const WebPluginInfo& webplugin_info, |
| 351 const WebKit::WebPluginParams& params) { | 351 const WebKit::WebPluginParams& params) { |
| 352 bool pepper_plugin_was_registered = false; | 352 bool pepper_plugin_was_registered = false; |
| 353 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( | 353 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( |
| 354 CreatePepperPluginModule(webplugin_info, &pepper_plugin_was_registered)); | 354 CreatePepperPluginModule(webplugin_info, &pepper_plugin_was_registered)); |
| 355 | 355 |
| 356 if (pepper_plugin_was_registered) { | 356 if (pepper_plugin_was_registered) { |
| 357 if (!pepper_module.get()) | 357 if (!pepper_module.get()) |
| 358 return NULL; | 358 return NULL; |
| 359 return new webkit::ppapi::WebPluginImpl( | 359 return new webkit::ppapi::WebPluginImpl( |
| 360 pepper_module.get(), params, AsWeakPtr()); | 360 pepper_module.get(), params, AsWeakPtr()); |
| 361 } | 361 } |
| 362 | 362 |
| 363 return NULL; | 363 return NULL; |
| 364 } | 364 } |
| 365 | 365 |
| 366 scoped_refptr<webkit::ppapi::PluginModule> | 366 scoped_refptr<webkit::ppapi::PluginModule> |
| 367 PepperPluginDelegateImpl::CreatePepperPluginModule( | 367 PepperPluginDelegateImpl::CreatePepperPluginModule( |
| 368 const webkit::WebPluginInfo& webplugin_info, | 368 const WebPluginInfo& webplugin_info, |
| 369 bool* pepper_plugin_was_registered) { | 369 bool* pepper_plugin_was_registered) { |
| 370 *pepper_plugin_was_registered = true; | 370 *pepper_plugin_was_registered = true; |
| 371 | 371 |
| 372 // See if a module has already been loaded for this plugin. | 372 // See if a module has already been loaded for this plugin. |
| 373 base::FilePath path(webplugin_info.path); | 373 base::FilePath path(webplugin_info.path); |
| 374 scoped_refptr<webkit::ppapi::PluginModule> module = | 374 scoped_refptr<webkit::ppapi::PluginModule> module = |
| 375 PepperPluginRegistry::GetInstance()->GetLiveModule(path); | 375 PepperPluginRegistry::GetInstance()->GetLiveModule(path); |
| 376 if (module.get()) { | 376 if (module.get()) { |
| 377 if (!module->GetEmbedderState()) { | 377 if (!module->GetEmbedderState()) { |
| 378 // If the module exists and no embedder state was associated with it, | 378 // If the module exists and no embedder state was associated with it, |
| (...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1712 should_close_source); | 1712 should_close_source); |
| 1713 } | 1713 } |
| 1714 | 1714 |
| 1715 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const { | 1715 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const { |
| 1716 RendererPpapiHostImpl* host = | 1716 RendererPpapiHostImpl* host = |
| 1717 RendererPpapiHostImpl::GetForPPInstance(instance); | 1717 RendererPpapiHostImpl::GetForPPInstance(instance); |
| 1718 return host && host->IsRunningInProcess(); | 1718 return host && host->IsRunningInProcess(); |
| 1719 } | 1719 } |
| 1720 | 1720 |
| 1721 } // namespace content | 1721 } // namespace content |
| OLD | NEW |