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 13 matching lines...) Expand all Loading... |
24 #include "content/common/fileapi/file_system_dispatcher.h" | 24 #include "content/common/fileapi/file_system_dispatcher.h" |
25 #include "content/common/fileapi/file_system_messages.h" | 25 #include "content/common/fileapi/file_system_messages.h" |
26 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 26 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
27 #include "content/common/pepper_messages.h" | 27 #include "content/common/pepper_messages.h" |
28 #include "content/common/pepper_plugin_registry.h" | 28 #include "content/common/pepper_plugin_registry.h" |
29 #include "content/common/quota_dispatcher.h" | 29 #include "content/common/quota_dispatcher.h" |
30 #include "content/common/view_messages.h" | 30 #include "content/common/view_messages.h" |
31 #include "content/public/common/content_switches.h" | 31 #include "content/public/common/content_switches.h" |
32 #include "content/public/common/context_menu_params.h" | 32 #include "content/public/common/context_menu_params.h" |
33 #include "content/public/common/media_stream_request.h" | 33 #include "content/public/common/media_stream_request.h" |
| 34 #include "content/public/common/pepper_permissions_config.h" |
34 #include "content/public/common/referrer.h" | 35 #include "content/public/common/referrer.h" |
35 #include "content/public/renderer/content_renderer_client.h" | 36 #include "content/public/renderer/content_renderer_client.h" |
36 #include "content/public/renderer/renderer_restrict_dispatch_group.h" | 37 #include "content/public/renderer/renderer_restrict_dispatch_group.h" |
37 #include "content/renderer/browser_plugin/old/browser_plugin_constants.h" | 38 #include "content/renderer/browser_plugin/old/browser_plugin_constants.h" |
38 #include "content/renderer/browser_plugin/old/browser_plugin_registry.h" | 39 #include "content/renderer/browser_plugin/old/browser_plugin_registry.h" |
39 #include "content/renderer/gamepad_shared_memory_reader.h" | 40 #include "content/renderer/gamepad_shared_memory_reader.h" |
40 #include "content/renderer/media/audio_hardware.h" | 41 #include "content/renderer/media/audio_hardware.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" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 return false; | 127 return false; |
127 | 128 |
128 #if defined(OS_POSIX) | 129 #if defined(OS_POSIX) |
129 DCHECK_NE(-1, channel_handle.socket.fd); | 130 DCHECK_NE(-1, channel_handle.socket.fd); |
130 if (channel_handle.socket.fd == -1) | 131 if (channel_handle.socket.fd == -1) |
131 return false; | 132 return false; |
132 #endif | 133 #endif |
133 | 134 |
134 dispatcher_delegate_.reset(new PepperProxyChannelDelegateImpl); | 135 dispatcher_delegate_.reset(new PepperProxyChannelDelegateImpl); |
135 dispatcher_.reset(new ppapi::proxy::HostDispatcher( | 136 dispatcher_.reset(new ppapi::proxy::HostDispatcher( |
136 module_->pp_module(), local_get_interface, filter)); | 137 module_->pp_module(), local_get_interface, filter, permissions_)); |
137 | 138 |
138 if (!dispatcher_->InitHostWithChannel(dispatcher_delegate_.get(), | 139 if (!dispatcher_->InitHostWithChannel(dispatcher_delegate_.get(), |
139 channel_handle, | 140 channel_handle, |
140 true, // Client. | 141 true, // Client. |
141 preferences)) { | 142 preferences)) { |
142 dispatcher_.reset(); | 143 dispatcher_.reset(); |
143 dispatcher_delegate_.reset(); | 144 dispatcher_delegate_.reset(); |
144 return false; | 145 return false; |
145 } | 146 } |
146 dispatcher_->channel()->SetRestrictDispatchChannelGroup( | 147 dispatcher_->channel()->SetRestrictDispatchChannelGroup( |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 // be out of process. | 363 // be out of process. |
363 const PepperPluginInfo* info = | 364 const PepperPluginInfo* info = |
364 PepperPluginRegistry::GetInstance()->GetInfoForPlugin(webplugin_info); | 365 PepperPluginRegistry::GetInstance()->GetInfoForPlugin(webplugin_info); |
365 if (!info) { | 366 if (!info) { |
366 *pepper_plugin_was_registered = false; | 367 *pepper_plugin_was_registered = false; |
367 return scoped_refptr<webkit::ppapi::PluginModule>(); | 368 return scoped_refptr<webkit::ppapi::PluginModule>(); |
368 } else if (!info->is_out_of_process) { | 369 } else if (!info->is_out_of_process) { |
369 // In-process plugin not preloaded, it probably couldn't be initialized. | 370 // In-process plugin not preloaded, it probably couldn't be initialized. |
370 return scoped_refptr<webkit::ppapi::PluginModule>(); | 371 return scoped_refptr<webkit::ppapi::PluginModule>(); |
371 } | 372 } |
372 ppapi::PpapiPermissions permissions(info->permissions); | 373 |
| 374 ppapi::PpapiPermissions permissions = |
| 375 content::CreatePepperPermissionsForPlugin(*info); |
373 | 376 |
374 // Out of process: have the browser start the plugin process for us. | 377 // Out of process: have the browser start the plugin process for us. |
375 IPC::ChannelHandle channel_handle; | 378 IPC::ChannelHandle channel_handle; |
376 int plugin_child_id = 0; | 379 int plugin_child_id = 0; |
377 render_view_->Send(new ViewHostMsg_OpenChannelToPepperPlugin( | 380 render_view_->Send(new ViewHostMsg_OpenChannelToPepperPlugin( |
378 path, &channel_handle, &plugin_child_id)); | 381 path, &channel_handle, &plugin_child_id)); |
379 if (channel_handle.name.empty()) { | 382 if (channel_handle.name.empty()) { |
380 // Couldn't be initialized. | 383 // Couldn't be initialized. |
381 return scoped_refptr<webkit::ppapi::PluginModule>(); | 384 return scoped_refptr<webkit::ppapi::PluginModule>(); |
382 } | 385 } |
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1872 else | 1875 else |
1873 return render_view_->mouse_lock_dispatcher(); | 1876 return render_view_->mouse_lock_dispatcher(); |
1874 } | 1877 } |
1875 | 1878 |
1876 webkit_glue::ClipboardClient* | 1879 webkit_glue::ClipboardClient* |
1877 PepperPluginDelegateImpl::CreateClipboardClient() const { | 1880 PepperPluginDelegateImpl::CreateClipboardClient() const { |
1878 return new RendererClipboardClient; | 1881 return new RendererClipboardClient; |
1879 } | 1882 } |
1880 | 1883 |
1881 } // namespace content | 1884 } // namespace content |
OLD | NEW |