Chromium Code Reviews| 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/ppapi_plugin_process_host.h" | 5 #include "content/browser/ppapi_plugin_process_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | |
| 9 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
| 10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 12 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
| 14 #include "base/path_service.h" | |
| 13 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 14 #include "content/browser/browser_child_process_host_impl.h" | 16 #include "content/browser/browser_child_process_host_impl.h" |
| 15 #include "content/browser/plugin_service_impl.h" | 17 #include "content/browser/plugin_service_impl.h" |
| 16 #include "content/browser/renderer_host/render_message_filter.h" | 18 #include "content/browser/renderer_host/render_message_filter.h" |
| 17 #include "content/common/child_process_host_impl.h" | 19 #include "content/common/child_process_host_impl.h" |
| 18 #include "content/common/child_process_messages.h" | 20 #include "content/common/child_process_messages.h" |
| 19 #include "content/public/browser/content_browser_client.h" | 21 #include "content/public/browser/content_browser_client.h" |
| 20 #include "content/public/common/content_constants.h" | 22 #include "content/public/common/content_constants.h" |
| 21 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
| 22 #include "content/public/common/pepper_plugin_info.h" | 24 #include "content/public/common/pepper_plugin_info.h" |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 VLOG(1) << "Pepper plugin exe path is empty."; | 301 VLOG(1) << "Pepper plugin exe path is empty."; |
| 300 return false; | 302 return false; |
| 301 } | 303 } |
| 302 | 304 |
| 303 CommandLine* cmd_line = new CommandLine(exe_path); | 305 CommandLine* cmd_line = new CommandLine(exe_path); |
| 304 cmd_line->AppendSwitchASCII(switches::kProcessType, | 306 cmd_line->AppendSwitchASCII(switches::kProcessType, |
| 305 is_broker_ ? switches::kPpapiBrokerProcess | 307 is_broker_ ? switches::kPpapiBrokerProcess |
| 306 : switches::kPpapiPluginProcess); | 308 : switches::kPpapiPluginProcess); |
| 307 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); | 309 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
| 308 | 310 |
| 311 #if defined(OS_CHROMEOS) | |
| 312 // On Chrome OS need to pass primary user homedir. | |
|
Will Drewry
2014/04/08 15:55:04
What does PPAPI use the home dir for? What sort o
Nikita (slow)
2014/04/08 16:40:08
This doesn't change how it is implemented right no
| |
| 313 base::FilePath homedir; | |
| 314 PathService::Get(base::DIR_HOME, &homedir); | |
| 315 cmd_line->AppendSwitchASCII(switches::kHomedir, homedir.value().c_str()); | |
| 316 #endif | |
| 317 | |
| 309 // These switches are forwarded to both plugin and broker pocesses. | 318 // These switches are forwarded to both plugin and broker pocesses. |
| 310 static const char* kCommonForwardSwitches[] = { | 319 static const char* kCommonForwardSwitches[] = { |
| 311 switches::kVModule | 320 switches::kVModule |
| 312 }; | 321 }; |
| 313 cmd_line->CopySwitchesFrom(browser_command_line, kCommonForwardSwitches, | 322 cmd_line->CopySwitchesFrom(browser_command_line, kCommonForwardSwitches, |
| 314 arraysize(kCommonForwardSwitches)); | 323 arraysize(kCommonForwardSwitches)); |
| 315 | 324 |
| 316 if (!is_broker_) { | 325 if (!is_broker_) { |
| 317 static const char* kPluginForwardSwitches[] = { | 326 static const char* kPluginForwardSwitches[] = { |
| 318 switches::kDisableSeccompFilterSandbox, | 327 switches::kDisableSeccompFilterSandbox, |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 458 // sent_requests_ queue should be the one that the plugin just created. | 467 // sent_requests_ queue should be the one that the plugin just created. |
| 459 Client* client = sent_requests_.front(); | 468 Client* client = sent_requests_.front(); |
| 460 sent_requests_.pop(); | 469 sent_requests_.pop(); |
| 461 | 470 |
| 462 const ChildProcessData& data = process_->GetData(); | 471 const ChildProcessData& data = process_->GetData(); |
| 463 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), | 472 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), |
| 464 data.id); | 473 data.id); |
| 465 } | 474 } |
| 466 | 475 |
| 467 } // namespace content | 476 } // namespace content |
| OLD | NEW |