OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/ppapi_broker_process_host.h" | 5 #include "content/browser/ppapi_broker_process_host.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "content/browser/plugin_service.h" | 11 #include "content/browser/plugin_service.h" |
12 #include "content/browser/renderer_host/render_message_filter.h" | 12 #include "content/browser/renderer_host/render_message_filter.h" |
13 #include "content/common/content_switches.h" | 13 #include "content/common/content_switches.h" |
14 #include "content/common/pepper_plugin_registry.h" | 14 #include "content/common/pepper_plugin_registry.h" |
15 #include "ipc/ipc_switches.h" | 15 #include "ipc/ipc_switches.h" |
16 #include "ppapi/proxy/ppapi_messages.h" | 16 #include "ppapi/proxy/ppapi_messages.h" |
17 | 17 |
18 PpapiBrokerProcessHost::PpapiBrokerProcessHost() | 18 PpapiBrokerProcessHost::PpapiBrokerProcessHost() |
19 : BrowserChildProcessHost(ChildProcessInfo::PPAPI_BROKER_PROCESS) { | 19 : BrowserChildProcessHost(ChildProcessInfo::PPAPI_BROKER_PROCESS) { |
20 } | 20 } |
21 | 21 |
22 PpapiBrokerProcessHost::~PpapiBrokerProcessHost() { | 22 PpapiBrokerProcessHost::~PpapiBrokerProcessHost() { |
23 CancelRequests(); | 23 CancelRequests(); |
24 } | 24 } |
25 | 25 |
26 bool PpapiBrokerProcessHost::Init(const PepperPluginInfo& info) { | 26 bool PpapiBrokerProcessHost::Init(const PepperPluginInfo& info) { |
27 broker_path_ = info.path; | 27 broker_path_ = info.path; |
28 set_name(UTF8ToWide(info.name)); | 28 set_name(UTF8ToUTF16(info.name)); |
29 set_version(UTF8ToWide(info.version)); | 29 set_version(UTF8ToUTF16(info.version)); |
30 | 30 |
31 if (!CreateChannel()) | 31 if (!CreateChannel()) |
32 return false; | 32 return false; |
33 | 33 |
34 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 34 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
35 // Use the same launcher mechanism as ppapi plugins. | 35 // Use the same launcher mechanism as ppapi plugins. |
36 CommandLine::StringType plugin_launcher = | 36 CommandLine::StringType plugin_launcher = |
37 browser_command_line.GetSwitchValueNative(switches::kPpapiPluginLauncher); | 37 browser_command_line.GetSwitchValueNative(switches::kPpapiPluginLauncher); |
38 | 38 |
39 FilePath exe_path = ChildProcessHost::GetChildPath(plugin_launcher.empty()); | 39 FilePath exe_path = ChildProcessHost::GetChildPath(plugin_launcher.empty()); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 ::DuplicateHandle(::GetCurrentProcess(), broker_process, | 168 ::DuplicateHandle(::GetCurrentProcess(), broker_process, |
169 renderer_process, &renderers_broker_handle, | 169 renderer_process, &renderers_broker_handle, |
170 0, FALSE, DUPLICATE_SAME_ACCESS); | 170 0, FALSE, DUPLICATE_SAME_ACCESS); |
171 #elif defined(OS_POSIX) | 171 #elif defined(OS_POSIX) |
172 // Don't need to duplicate anything on POSIX since it's just a PID. | 172 // Don't need to duplicate anything on POSIX since it's just a PID. |
173 base::ProcessHandle renderers_broker_handle = broker_process; | 173 base::ProcessHandle renderers_broker_handle = broker_process; |
174 #endif | 174 #endif |
175 | 175 |
176 client->OnChannelOpened(renderers_broker_handle, channel_handle); | 176 client->OnChannelOpened(renderers_broker_handle, channel_handle); |
177 } | 177 } |
OLD | NEW |