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_plugin_process_host.h" | 5 #include "content/browser/ppapi_plugin_process_host.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 // We already have an open channel, send a request right away to plugin. | 95 // We already have an open channel, send a request right away to plugin. |
96 RequestPluginChannel(client); | 96 RequestPluginChannel(client); |
97 } | 97 } |
98 | 98 |
99 PpapiPluginProcessHost::PpapiPluginProcessHost(net::HostResolver* host_resolver) | 99 PpapiPluginProcessHost::PpapiPluginProcessHost(net::HostResolver* host_resolver) |
100 : BrowserChildProcessHost(content::PROCESS_TYPE_PPAPI_PLUGIN), | 100 : BrowserChildProcessHost(content::PROCESS_TYPE_PPAPI_PLUGIN), |
101 filter_(new PepperMessageFilter(host_resolver)), | 101 filter_(new PepperMessageFilter(host_resolver)), |
102 network_observer_(new PluginNetworkObserver(this)), | 102 network_observer_(new PluginNetworkObserver(this)), |
103 is_broker_(false), | 103 is_broker_(false), |
104 process_id_(ChildProcessInfo::GenerateChildProcessUniqueId()) { | 104 process_id_(ChildProcessHost::GenerateChildProcessUniqueId()) { |
105 AddFilter(filter_.get()); | 105 AddFilter(filter_.get()); |
106 } | 106 } |
107 | 107 |
108 PpapiPluginProcessHost::PpapiPluginProcessHost() | 108 PpapiPluginProcessHost::PpapiPluginProcessHost() |
109 : BrowserChildProcessHost(content::PROCESS_TYPE_PPAPI_BROKER), | 109 : BrowserChildProcessHost(content::PROCESS_TYPE_PPAPI_BROKER), |
110 is_broker_(true), | 110 is_broker_(true), |
111 process_id_(ChildProcessInfo::GenerateChildProcessUniqueId()) { | 111 process_id_(ChildProcessHost::GenerateChildProcessUniqueId()) { |
112 } | 112 } |
113 | 113 |
114 bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) { | 114 bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) { |
115 plugin_path_ = info.path; | 115 plugin_path_ = info.path; |
116 if (info.name.empty()) { | 116 if (info.name.empty()) { |
117 set_name(plugin_path_.BaseName().LossyDisplayName()); | 117 set_name(plugin_path_.BaseName().LossyDisplayName()); |
118 } else { | 118 } else { |
119 set_name(UTF8ToUTF16(info.name)); | 119 set_name(UTF8ToUTF16(info.name)); |
120 } | 120 } |
121 set_version(UTF8ToUTF16(info.version)); | |
122 | 121 |
123 if (!CreateChannel()) | 122 if (!CreateChannel()) |
124 return false; | 123 return false; |
125 | 124 |
126 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 125 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
127 CommandLine::StringType plugin_launcher = | 126 CommandLine::StringType plugin_launcher = |
128 browser_command_line.GetSwitchValueNative(switches::kPpapiPluginLauncher); | 127 browser_command_line.GetSwitchValueNative(switches::kPpapiPluginLauncher); |
129 | 128 |
130 #if defined(OS_LINUX) | 129 #if defined(OS_LINUX) |
131 int flags = plugin_launcher.empty() ? ChildProcessHost::CHILD_ALLOW_SELF : | 130 int flags = plugin_launcher.empty() ? ChildProcessHost::CHILD_ALLOW_SELF : |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 ::DuplicateHandle(::GetCurrentProcess(), plugin_process, | 280 ::DuplicateHandle(::GetCurrentProcess(), plugin_process, |
282 renderer_process, &renderers_plugin_handle, | 281 renderer_process, &renderers_plugin_handle, |
283 0, FALSE, DUPLICATE_SAME_ACCESS); | 282 0, FALSE, DUPLICATE_SAME_ACCESS); |
284 #elif defined(OS_POSIX) | 283 #elif defined(OS_POSIX) |
285 // Don't need to duplicate anything on POSIX since it's just a PID. | 284 // Don't need to duplicate anything on POSIX since it's just a PID. |
286 base::ProcessHandle renderers_plugin_handle = plugin_process; | 285 base::ProcessHandle renderers_plugin_handle = plugin_process; |
287 #endif | 286 #endif |
288 | 287 |
289 client->OnChannelOpened(renderers_plugin_handle, channel_handle); | 288 client->OnChannelOpened(renderers_plugin_handle, channel_handle); |
290 } | 289 } |
OLD | NEW |