Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: content/renderer/pepper/pepper_plugin_delegate_impl.cc

Issue 10735011: Add permissions buts for Pepper plugins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/pepper/pepper_in_process_resource_creation.cc ('k') | ppapi/host/ppapi_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 // be out of process. 294 // be out of process.
294 const PepperPluginInfo* info = 295 const PepperPluginInfo* info =
295 PepperPluginRegistry::GetInstance()->GetInfoForPlugin(webplugin_info); 296 PepperPluginRegistry::GetInstance()->GetInfoForPlugin(webplugin_info);
296 if (!info) { 297 if (!info) {
297 *pepper_plugin_was_registered = false; 298 *pepper_plugin_was_registered = false;
298 return scoped_refptr<webkit::ppapi::PluginModule>(); 299 return scoped_refptr<webkit::ppapi::PluginModule>();
299 } else if (!info->is_out_of_process) { 300 } else if (!info->is_out_of_process) {
300 // In-process plugin not preloaded, it probably couldn't be initialized. 301 // In-process plugin not preloaded, it probably couldn't be initialized.
301 return scoped_refptr<webkit::ppapi::PluginModule>(); 302 return scoped_refptr<webkit::ppapi::PluginModule>();
302 } 303 }
304 ppapi::PpapiPermissions permissions(info->permissions);
303 305
304 // Out of process: have the browser start the plugin process for us. 306 // Out of process: have the browser start the plugin process for us.
305 IPC::ChannelHandle channel_handle; 307 IPC::ChannelHandle channel_handle;
306 int plugin_child_id = 0; 308 int plugin_child_id = 0;
307 render_view_->Send(new ViewHostMsg_OpenChannelToPepperPlugin( 309 render_view_->Send(new ViewHostMsg_OpenChannelToPepperPlugin(
308 path, &channel_handle, &plugin_child_id)); 310 path, &channel_handle, &plugin_child_id));
309 if (channel_handle.name.empty()) { 311 if (channel_handle.name.empty()) {
310 // Couldn't be initialized. 312 // Couldn't be initialized.
311 return scoped_refptr<webkit::ppapi::PluginModule>(); 313 return scoped_refptr<webkit::ppapi::PluginModule>();
312 } 314 }
313 315
314 scoped_refptr<PepperHungPluginFilter> hung_filter( 316 scoped_refptr<PepperHungPluginFilter> hung_filter(
315 new PepperHungPluginFilter(path, render_view_->routing_id(), 317 new PepperHungPluginFilter(path, render_view_->routing_id(),
316 plugin_child_id)); 318 plugin_child_id));
317 319
318 // Create a new HostDispatcher for the proxying, and hook it to a new 320 // Create a new HostDispatcher for the proxying, and hook it to a new
319 // PluginModule. Note that AddLiveModule must be called before any early 321 // PluginModule. Note that AddLiveModule must be called before any early
320 // returns since the module's destructor will remove itself. 322 // returns since the module's destructor will remove itself.
321 module = new webkit::ppapi::PluginModule(info->name, path, 323 module = new webkit::ppapi::PluginModule(
322 PepperPluginRegistry::GetInstance()); 324 info->name, path,
325 PepperPluginRegistry::GetInstance(),
326 permissions);
323 PepperPluginRegistry::GetInstance()->AddLiveModule(path, module); 327 PepperPluginRegistry::GetInstance()->AddLiveModule(path, module);
324 scoped_ptr<HostDispatcherWrapper> dispatcher(new HostDispatcherWrapper); 328 scoped_ptr<HostDispatcherWrapper> dispatcher(new HostDispatcherWrapper);
325 if (!dispatcher->Init( 329 if (!dispatcher->Init(
326 channel_handle, 330 channel_handle,
327 module->pp_module(), 331 module->pp_module(),
328 webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc(), 332 webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc(),
329 GetPreferences(), 333 GetPreferences(),
330 hung_filter.get())) 334 hung_filter.get()))
331 return scoped_refptr<webkit::ppapi::PluginModule>(); 335 return scoped_refptr<webkit::ppapi::PluginModule>();
332 module->InitAsProxied(dispatcher.release()); 336 module->InitAsProxied(dispatcher.release());
(...skipping 13 matching lines...) Expand all
346 350
347 FilePath path(kBrowserPluginPath); 351 FilePath path(kBrowserPluginPath);
348 scoped_refptr<PepperHungPluginFilter> hung_filter( 352 scoped_refptr<PepperHungPluginFilter> hung_filter(
349 new PepperHungPluginFilter(path, 353 new PepperHungPluginFilter(path,
350 render_view_->routing_id(), 354 render_view_->routing_id(),
351 guest_process_id)); 355 guest_process_id));
352 // Create a new HostDispatcher for the proxying, and hook it to a new 356 // Create a new HostDispatcher for the proxying, and hook it to a new
353 // PluginModule. 357 // PluginModule.
354 module = new webkit::ppapi::PluginModule(kBrowserPluginName, 358 module = new webkit::ppapi::PluginModule(kBrowserPluginName,
355 path, 359 path,
356 registry); 360 registry,
361 ppapi::PpapiPermissions());
357 RenderThreadImpl::current()->browser_plugin_registry()->AddModule( 362 RenderThreadImpl::current()->browser_plugin_registry()->AddModule(
358 guest_process_id, module); 363 guest_process_id, module);
359 scoped_ptr<HostDispatcherWrapper> dispatcher(new HostDispatcherWrapper); 364 scoped_ptr<HostDispatcherWrapper> dispatcher(new HostDispatcherWrapper);
360 if (!dispatcher->Init( 365 if (!dispatcher->Init(
361 channel_handle, 366 channel_handle,
362 module->pp_module(), 367 module->pp_module(),
363 webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc(), 368 webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc(),
364 GetPreferences(), 369 GetPreferences(),
365 hung_filter.get())) 370 hung_filter.get()))
366 return scoped_refptr<webkit::ppapi::PluginModule>(); 371 return scoped_refptr<webkit::ppapi::PluginModule>();
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 if (last_mouse_event_target_ == instance) 664 if (last_mouse_event_target_ == instance)
660 last_mouse_event_target_ = NULL; 665 last_mouse_event_target_ = NULL;
661 if (focused_plugin_ == instance) 666 if (focused_plugin_ == instance)
662 PluginFocusChanged(instance, false); 667 PluginFocusChanged(instance, false);
663 } 668 }
664 669
665 scoped_ptr< ::ppapi::thunk::ResourceCreationAPI> 670 scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>
666 PepperPluginDelegateImpl::CreateResourceCreationAPI( 671 PepperPluginDelegateImpl::CreateResourceCreationAPI(
667 webkit::ppapi::PluginInstance* instance) { 672 webkit::ppapi::PluginInstance* instance) {
668 return scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>( 673 return scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>(
669 new PepperInProcessResourceCreation(render_view_, instance)); 674 new PepperInProcessResourceCreation(render_view_, instance,
675 instance->module()->permissions()));
670 } 676 }
671 677
672 SkBitmap* PepperPluginDelegateImpl::GetSadPluginBitmap() { 678 SkBitmap* PepperPluginDelegateImpl::GetSadPluginBitmap() {
673 return GetContentClient()->renderer()->GetSadPluginBitmap(); 679 return GetContentClient()->renderer()->GetSadPluginBitmap();
674 } 680 }
675 681
676 WebKit::WebPlugin* PepperPluginDelegateImpl::CreatePluginReplacement( 682 WebKit::WebPlugin* PepperPluginDelegateImpl::CreatePluginReplacement(
677 const FilePath& file_path) { 683 const FilePath& file_path) {
678 return GetContentClient()->renderer()->CreatePluginReplacement( 684 return GetContentClient()->renderer()->CreatePluginReplacement(
679 render_view_, file_path); 685 render_view_, file_path);
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1729 else 1735 else
1730 return render_view_->mouse_lock_dispatcher(); 1736 return render_view_->mouse_lock_dispatcher();
1731 } 1737 }
1732 1738
1733 webkit_glue::ClipboardClient* 1739 webkit_glue::ClipboardClient*
1734 PepperPluginDelegateImpl::CreateClipboardClient() const { 1740 PepperPluginDelegateImpl::CreateClipboardClient() const {
1735 return new RendererClipboardClient; 1741 return new RendererClipboardClient;
1736 } 1742 }
1737 1743
1738 } // namespace content 1744 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_in_process_resource_creation.cc ('k') | ppapi/host/ppapi_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698