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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 #include "ipc/ipc_channel_handle.h" | 61 #include "ipc/ipc_channel_handle.h" |
62 #include "media/video/capture/video_capture_proxy.h" | 62 #include "media/video/capture/video_capture_proxy.h" |
63 #include "ppapi/c/dev/pp_video_dev.h" | 63 #include "ppapi/c/dev/pp_video_dev.h" |
64 #include "ppapi/c/pp_errors.h" | 64 #include "ppapi/c/pp_errors.h" |
65 #include "ppapi/c/private/ppb_flash.h" | 65 #include "ppapi/c/private/ppb_flash.h" |
66 #include "ppapi/proxy/host_dispatcher.h" | 66 #include "ppapi/proxy/host_dispatcher.h" |
67 #include "ppapi/proxy/pepper_file_messages.h" | 67 #include "ppapi/proxy/pepper_file_messages.h" |
68 #include "ppapi/proxy/ppapi_messages.h" | 68 #include "ppapi/proxy/ppapi_messages.h" |
69 #include "ppapi/shared_impl/file_path.h" | 69 #include "ppapi/shared_impl/file_path.h" |
70 #include "ppapi/shared_impl/platform_file.h" | 70 #include "ppapi/shared_impl/platform_file.h" |
| 71 #include "ppapi/shared_impl/ppapi_permissions.h" |
71 #include "ppapi/shared_impl/ppapi_preferences.h" | 72 #include "ppapi/shared_impl/ppapi_preferences.h" |
72 #include "ppapi/shared_impl/ppb_device_ref_shared.h" | 73 #include "ppapi/shared_impl/ppb_device_ref_shared.h" |
73 #include "ppapi/thunk/enter.h" | 74 #include "ppapi/thunk/enter.h" |
74 #include "ppapi/thunk/ppb_tcp_server_socket_private_api.h" | 75 #include "ppapi/thunk/ppb_tcp_server_socket_private_api.h" |
75 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 76 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
76 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 77 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
77 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserComplet
ion.h" | 78 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserComplet
ion.h" |
78 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.
h" | 79 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.
h" |
79 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 80 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
80 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 81 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 // be out of process. | 230 // be out of process. |
230 const PepperPluginInfo* info = | 231 const PepperPluginInfo* info = |
231 PepperPluginRegistry::GetInstance()->GetInfoForPlugin(webplugin_info); | 232 PepperPluginRegistry::GetInstance()->GetInfoForPlugin(webplugin_info); |
232 if (!info) { | 233 if (!info) { |
233 *pepper_plugin_was_registered = false; | 234 *pepper_plugin_was_registered = false; |
234 return scoped_refptr<webkit::ppapi::PluginModule>(); | 235 return scoped_refptr<webkit::ppapi::PluginModule>(); |
235 } else if (!info->is_out_of_process) { | 236 } else if (!info->is_out_of_process) { |
236 // In-process plugin not preloaded, it probably couldn't be initialized. | 237 // In-process plugin not preloaded, it probably couldn't be initialized. |
237 return scoped_refptr<webkit::ppapi::PluginModule>(); | 238 return scoped_refptr<webkit::ppapi::PluginModule>(); |
238 } | 239 } |
| 240 ppapi::PpapiPermissions permissions(info->permissions); |
239 | 241 |
240 // Out of process: have the browser start the plugin process for us. | 242 // Out of process: have the browser start the plugin process for us. |
241 IPC::ChannelHandle channel_handle; | 243 IPC::ChannelHandle channel_handle; |
242 int plugin_child_id = 0; | 244 int plugin_child_id = 0; |
243 render_view_->Send(new ViewHostMsg_OpenChannelToPepperPlugin( | 245 render_view_->Send(new ViewHostMsg_OpenChannelToPepperPlugin( |
244 path, &channel_handle, &plugin_child_id)); | 246 path, &channel_handle, &plugin_child_id)); |
245 if (channel_handle.name.empty()) { | 247 if (channel_handle.name.empty()) { |
246 // Couldn't be initialized. | 248 // Couldn't be initialized. |
247 return scoped_refptr<webkit::ppapi::PluginModule>(); | 249 return scoped_refptr<webkit::ppapi::PluginModule>(); |
248 } | 250 } |
249 | 251 |
250 scoped_refptr<PepperHungPluginFilter> hung_filter( | 252 scoped_refptr<PepperHungPluginFilter> hung_filter( |
251 new PepperHungPluginFilter(path, render_view_->routing_id(), | 253 new PepperHungPluginFilter(path, render_view_->routing_id(), |
252 plugin_child_id)); | 254 plugin_child_id)); |
253 | 255 |
254 // Create a new HostDispatcher for the proxying, and hook it to a new | 256 // Create a new HostDispatcher for the proxying, and hook it to a new |
255 // PluginModule. Note that AddLiveModule must be called before any early | 257 // PluginModule. Note that AddLiveModule must be called before any early |
256 // returns since the module's destructor will remove itself. | 258 // returns since the module's destructor will remove itself. |
257 module = new webkit::ppapi::PluginModule(info->name, path, | 259 module = new webkit::ppapi::PluginModule( |
258 PepperPluginRegistry::GetInstance()); | 260 info->name, path, |
| 261 PepperPluginRegistry::GetInstance(), |
| 262 permissions); |
259 PepperPluginRegistry::GetInstance()->AddLiveModule(path, module); | 263 PepperPluginRegistry::GetInstance()->AddLiveModule(path, module); |
260 scoped_ptr<HostDispatcherWrapper> dispatcher(new HostDispatcherWrapper); | 264 scoped_ptr<HostDispatcherWrapper> dispatcher(new HostDispatcherWrapper); |
261 if (!dispatcher->Init( | 265 if (!dispatcher->Init( |
262 channel_handle, | 266 channel_handle, |
263 module->pp_module(), | 267 module->pp_module(), |
264 webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc(), | 268 webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc(), |
265 GetPreferences(), | 269 GetPreferences(), |
266 hung_filter.get())) | 270 hung_filter.get())) |
267 return scoped_refptr<webkit::ppapi::PluginModule>(); | 271 return scoped_refptr<webkit::ppapi::PluginModule>(); |
268 module->InitAsProxied(dispatcher.release()); | 272 module->InitAsProxied(dispatcher.release()); |
(...skipping 13 matching lines...) Expand all Loading... |
282 | 286 |
283 FilePath path(kBrowserPluginPath); | 287 FilePath path(kBrowserPluginPath); |
284 scoped_refptr<PepperHungPluginFilter> hung_filter( | 288 scoped_refptr<PepperHungPluginFilter> hung_filter( |
285 new PepperHungPluginFilter(path, | 289 new PepperHungPluginFilter(path, |
286 render_view_->routing_id(), | 290 render_view_->routing_id(), |
287 guest_process_id)); | 291 guest_process_id)); |
288 // Create a new HostDispatcher for the proxying, and hook it to a new | 292 // Create a new HostDispatcher for the proxying, and hook it to a new |
289 // PluginModule. | 293 // PluginModule. |
290 module = new webkit::ppapi::PluginModule(kBrowserPluginName, | 294 module = new webkit::ppapi::PluginModule(kBrowserPluginName, |
291 path, | 295 path, |
292 registry); | 296 registry, |
| 297 ppapi::PpapiPermissions()); |
293 RenderThreadImpl::current()->browser_plugin_registry()->AddModule( | 298 RenderThreadImpl::current()->browser_plugin_registry()->AddModule( |
294 guest_process_id, module); | 299 guest_process_id, module); |
295 scoped_ptr<HostDispatcherWrapper> dispatcher(new HostDispatcherWrapper); | 300 scoped_ptr<HostDispatcherWrapper> dispatcher(new HostDispatcherWrapper); |
296 if (!dispatcher->Init( | 301 if (!dispatcher->Init( |
297 channel_handle, | 302 channel_handle, |
298 module->pp_module(), | 303 module->pp_module(), |
299 webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc(), | 304 webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc(), |
300 GetPreferences(), | 305 GetPreferences(), |
301 hung_filter.get())) | 306 hung_filter.get())) |
302 return scoped_refptr<webkit::ppapi::PluginModule>(); | 307 return scoped_refptr<webkit::ppapi::PluginModule>(); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 if (last_mouse_event_target_ == instance) | 600 if (last_mouse_event_target_ == instance) |
596 last_mouse_event_target_ = NULL; | 601 last_mouse_event_target_ = NULL; |
597 if (focused_plugin_ == instance) | 602 if (focused_plugin_ == instance) |
598 PluginFocusChanged(instance, false); | 603 PluginFocusChanged(instance, false); |
599 } | 604 } |
600 | 605 |
601 scoped_ptr< ::ppapi::thunk::ResourceCreationAPI> | 606 scoped_ptr< ::ppapi::thunk::ResourceCreationAPI> |
602 PepperPluginDelegateImpl::CreateResourceCreationAPI( | 607 PepperPluginDelegateImpl::CreateResourceCreationAPI( |
603 webkit::ppapi::PluginInstance* instance) { | 608 webkit::ppapi::PluginInstance* instance) { |
604 return scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>( | 609 return scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>( |
605 new PepperInProcessResourceCreation(render_view_, instance)); | 610 new PepperInProcessResourceCreation(render_view_, instance, |
| 611 instance->module()->permissions())); |
606 } | 612 } |
607 | 613 |
608 SkBitmap* PepperPluginDelegateImpl::GetSadPluginBitmap() { | 614 SkBitmap* PepperPluginDelegateImpl::GetSadPluginBitmap() { |
609 return GetContentClient()->renderer()->GetSadPluginBitmap(); | 615 return GetContentClient()->renderer()->GetSadPluginBitmap(); |
610 } | 616 } |
611 | 617 |
612 WebKit::WebPlugin* PepperPluginDelegateImpl::CreatePluginReplacement( | 618 WebKit::WebPlugin* PepperPluginDelegateImpl::CreatePluginReplacement( |
613 const FilePath& file_path) { | 619 const FilePath& file_path) { |
614 return GetContentClient()->renderer()->CreatePluginReplacement( | 620 return GetContentClient()->renderer()->CreatePluginReplacement( |
615 render_view_, file_path); | 621 render_view_, file_path); |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1713 else | 1719 else |
1714 return render_view_->mouse_lock_dispatcher(); | 1720 return render_view_->mouse_lock_dispatcher(); |
1715 } | 1721 } |
1716 | 1722 |
1717 webkit_glue::ClipboardClient* | 1723 webkit_glue::ClipboardClient* |
1718 PepperPluginDelegateImpl::CreateClipboardClient() const { | 1724 PepperPluginDelegateImpl::CreateClipboardClient() const { |
1719 return new RendererClipboardClient; | 1725 return new RendererClipboardClient; |
1720 } | 1726 } |
1721 | 1727 |
1722 } // namespace content | 1728 } // namespace content |
OLD | NEW |