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/ppapi_plugin/ppapi_thread.h" | 5 #include "content/ppapi_plugin/ppapi_thread.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
11 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "content/common/child_process.h" | 14 #include "content/common/child_process.h" |
15 #include "content/common/child_process_messages.h" | 15 #include "content/common/child_process_messages.h" |
16 #include "content/ppapi_plugin/broker_process_dispatcher.h" | 16 #include "content/ppapi_plugin/broker_process_dispatcher.h" |
17 #include "content/ppapi_plugin/plugin_process_dispatcher.h" | 17 #include "content/ppapi_plugin/plugin_process_dispatcher.h" |
18 #include "content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h" | 18 #include "content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h" |
19 #include "content/public/common/content_switches.h" | |
20 #include "content/public/common/sandbox_init.h" | 19 #include "content/public/common/sandbox_init.h" |
21 #include "ipc/ipc_channel_handle.h" | 20 #include "ipc/ipc_channel_handle.h" |
22 #include "ipc/ipc_sync_channel.h" | 21 #include "ipc/ipc_sync_channel.h" |
23 #include "ppapi/c/dev/ppp_network_state_dev.h" | 22 #include "ppapi/c/dev/ppp_network_state_dev.h" |
24 #include "ppapi/c/pp_errors.h" | 23 #include "ppapi/c/pp_errors.h" |
25 #include "ppapi/c/ppp.h" | 24 #include "ppapi/c/ppp.h" |
26 #include "ppapi/proxy/plugin_globals.h" | 25 #include "ppapi/proxy/plugin_globals.h" |
27 #include "ppapi/proxy/ppapi_messages.h" | 26 #include "ppapi/proxy/ppapi_messages.h" |
28 #include "ppapi/proxy/interface_list.h" | 27 #include "ppapi/proxy/interface_list.h" |
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
| 29 #include "webkit/plugins/plugin_switches.h" |
30 | 30 |
31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
32 #include "sandbox/src/sandbox.h" | 32 #include "sandbox/src/sandbox.h" |
33 #elif defined(OS_MACOSX) | 33 #elif defined(OS_MACOSX) |
34 #include "content/common/sandbox_init_mac.h" | 34 #include "content/common/sandbox_init_mac.h" |
35 #endif | 35 #endif |
36 | 36 |
37 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
38 extern sandbox::TargetServices* g_target_services; | 38 extern sandbox::TargetServices* g_target_services; |
39 #else | 39 #else |
40 extern void* g_target_services; | 40 extern void* g_target_services; |
41 #endif | 41 #endif |
42 | 42 |
43 typedef int32_t (*InitializeBrokerFunc) | 43 typedef int32_t (*InitializeBrokerFunc) |
44 (PP_ConnectInstance_Func* connect_instance_func); | 44 (PP_ConnectInstance_Func* connect_instance_func); |
45 | 45 |
46 PpapiThread::PpapiThread(bool is_broker) | 46 PpapiThread::PpapiThread(const CommandLine& command_line, bool is_broker) |
47 : is_broker_(is_broker), | 47 : is_broker_(is_broker), |
48 get_plugin_interface_(NULL), | 48 get_plugin_interface_(NULL), |
49 connect_instance_func_(NULL), | 49 connect_instance_func_(NULL), |
50 local_pp_module_( | 50 local_pp_module_( |
51 base::RandInt(0, std::numeric_limits<PP_Module>::max())), | 51 base::RandInt(0, std::numeric_limits<PP_Module>::max())), |
52 next_plugin_dispatcher_id_(1) { | 52 next_plugin_dispatcher_id_(1) { |
53 ppapi::proxy::PluginGlobals::Get()->set_plugin_proxy_delegate(this); | 53 ppapi::proxy::PluginGlobals* globals = ppapi::proxy::PluginGlobals::Get(); |
| 54 globals->set_plugin_proxy_delegate(this); |
| 55 globals->set_command_line( |
| 56 command_line.GetSwitchValueASCII(switches::kPpapiFlashArgs)); |
| 57 |
54 webkit_platform_support_.reset(new PpapiWebKitPlatformSupportImpl); | 58 webkit_platform_support_.reset(new PpapiWebKitPlatformSupportImpl); |
55 WebKit::initialize(webkit_platform_support_.get()); | 59 WebKit::initialize(webkit_platform_support_.get()); |
56 } | 60 } |
57 | 61 |
58 PpapiThread::~PpapiThread() { | 62 PpapiThread::~PpapiThread() { |
59 ppapi::proxy::PluginGlobals::Get()->set_plugin_proxy_delegate(NULL); | 63 ppapi::proxy::PluginGlobals::Get()->set_plugin_proxy_delegate(NULL); |
60 | 64 |
61 if (!library_.is_valid()) | 65 if (!library_.is_valid()) |
62 return; | 66 return; |
63 | 67 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 328 |
325 // From here, the dispatcher will manage its own lifetime according to the | 329 // From here, the dispatcher will manage its own lifetime according to the |
326 // lifetime of the attached channel. | 330 // lifetime of the attached channel. |
327 return true; | 331 return true; |
328 } | 332 } |
329 | 333 |
330 void PpapiThread::SavePluginName(const FilePath& path) { | 334 void PpapiThread::SavePluginName(const FilePath& path) { |
331 ppapi::proxy::PluginGlobals::Get()->set_plugin_name( | 335 ppapi::proxy::PluginGlobals::Get()->set_plugin_name( |
332 path.BaseName().AsUTF8Unsafe()); | 336 path.BaseName().AsUTF8Unsafe()); |
333 } | 337 } |
OLD | NEW |