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/browser/plugin_process_host.h" | 5 #include "content/browser/plugin_process_host.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
10 #include <utility> // for pair<> | 10 #include <utility> // for pair<> |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // explicit mprotect calls. Some plug-ins still rely on this quaint and | 160 // explicit mprotect calls. Some plug-ins still rely on this quaint and |
161 // archaic "feature." See http://crbug.com/93551. | 161 // archaic "feature." See http://crbug.com/93551. |
162 int flags = ChildProcessHost::CHILD_ALLOW_HEAP_EXECUTION; | 162 int flags = ChildProcessHost::CHILD_ALLOW_HEAP_EXECUTION; |
163 #elif defined(OS_LINUX) | 163 #elif defined(OS_LINUX) |
164 int flags = plugin_launcher.empty() ? ChildProcessHost::CHILD_ALLOW_SELF : | 164 int flags = plugin_launcher.empty() ? ChildProcessHost::CHILD_ALLOW_SELF : |
165 ChildProcessHost::CHILD_NORMAL; | 165 ChildProcessHost::CHILD_NORMAL; |
166 #else | 166 #else |
167 int flags = ChildProcessHost::CHILD_NORMAL; | 167 int flags = ChildProcessHost::CHILD_NORMAL; |
168 #endif | 168 #endif |
169 | 169 |
170 FilePath exe_path = ChildProcessHost::GetChildPath(flags); | 170 base::FilePath exe_path = ChildProcessHost::GetChildPath(flags); |
171 if (exe_path.empty()) | 171 if (exe_path.empty()) |
172 return false; | 172 return false; |
173 | 173 |
174 CommandLine* cmd_line = new CommandLine(exe_path); | 174 CommandLine* cmd_line = new CommandLine(exe_path); |
175 // Put the process type and plugin path first so they're easier to see | 175 // Put the process type and plugin path first so they're easier to see |
176 // in process listings using native process management tools. | 176 // in process listings using native process management tools. |
177 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kPluginProcess); | 177 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kPluginProcess); |
178 cmd_line->AppendSwitchPath(switches::kPluginPath, info.path); | 178 cmd_line->AppendSwitchPath(switches::kPluginPath, info.path); |
179 | 179 |
180 // Propagate the following switches to the plugin command line (along with | 180 // Propagate the following switches to the plugin command line (along with |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 } | 231 } |
232 } | 232 } |
233 env.push_back(std::pair<std::string, std::string>( | 233 env.push_back(std::pair<std::string, std::string>( |
234 kDYLDInsertLibrariesKey, interpose_list)); | 234 kDYLDInsertLibrariesKey, interpose_list)); |
235 } | 235 } |
236 #endif | 236 #endif |
237 #endif | 237 #endif |
238 | 238 |
239 process_->Launch( | 239 process_->Launch( |
240 #if defined(OS_WIN) | 240 #if defined(OS_WIN) |
241 FilePath(), | 241 base::FilePath(), |
242 #elif defined(OS_POSIX) | 242 #elif defined(OS_POSIX) |
243 false, | 243 false, |
244 env, | 244 env, |
245 #endif | 245 #endif |
246 cmd_line); | 246 cmd_line); |
247 | 247 |
248 // The plugin needs to be shutdown gracefully, i.e. NP_Shutdown needs to be | 248 // The plugin needs to be shutdown gracefully, i.e. NP_Shutdown needs to be |
249 // called on the plugin. The plugin process exits when it receives the | 249 // called on the plugin. The plugin process exits when it receives the |
250 // OnChannelError notification indicating that the browser plugin channel has | 250 // OnChannelError notification indicating that the browser plugin channel has |
251 // been destroyed. | 251 // been destroyed. |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 void PluginProcessHost::OnChannelCreated( | 402 void PluginProcessHost::OnChannelCreated( |
403 const IPC::ChannelHandle& channel_handle) { | 403 const IPC::ChannelHandle& channel_handle) { |
404 Client* client = sent_requests_.front(); | 404 Client* client = sent_requests_.front(); |
405 | 405 |
406 if (client) | 406 if (client) |
407 client->OnChannelOpened(channel_handle); | 407 client->OnChannelOpened(channel_handle); |
408 sent_requests_.pop_front(); | 408 sent_requests_.pop_front(); |
409 } | 409 } |
410 | 410 |
411 } // namespace content | 411 } // namespace content |
OLD | NEW |