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_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 L"\\\\.\\pipe\\chrome.*"); | 67 L"\\\\.\\pipe\\chrome.*"); |
68 *success = (result == sandbox::SBOX_ALL_OK); | 68 *success = (result == sandbox::SBOX_ALL_OK); |
69 } | 69 } |
70 | 70 |
71 #elif defined(OS_POSIX) | 71 #elif defined(OS_POSIX) |
72 bool ShouldUseZygote() override { | 72 bool ShouldUseZygote() override { |
73 const base::CommandLine& browser_command_line = | 73 const base::CommandLine& browser_command_line = |
74 *base::CommandLine::ForCurrentProcess(); | 74 *base::CommandLine::ForCurrentProcess(); |
75 base::CommandLine::StringType plugin_launcher = browser_command_line | 75 base::CommandLine::StringType plugin_launcher = browser_command_line |
76 .GetSwitchValueNative(switches::kPpapiPluginLauncher); | 76 .GetSwitchValueNative(switches::kPpapiPluginLauncher); |
77 return !is_broker_ && plugin_launcher.empty() && info_.is_sandboxed; | 77 return !is_broker_ && plugin_launcher.empty(); |
78 } | 78 } |
79 base::ScopedFD TakeIpcFd() override { return ipc_fd_.Pass(); } | 79 base::ScopedFD TakeIpcFd() override { return ipc_fd_.Pass(); } |
80 #endif // OS_WIN | 80 #endif // OS_WIN |
81 | 81 |
82 private: | 82 private: |
83 #if defined(OS_POSIX) | 83 #if defined(OS_POSIX) |
84 const PepperPluginInfo& info_; | 84 const PepperPluginInfo& info_; |
85 base::ScopedFD ipc_fd_; | 85 base::ScopedFD ipc_fd_; |
86 #endif // OS_POSIX | 86 #endif // OS_POSIX |
87 bool is_broker_; | 87 bool is_broker_; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 std::string locale = GetContentClient()->browser()->GetApplicationLocale(); | 370 std::string locale = GetContentClient()->browser()->GetApplicationLocale(); |
371 if (!locale.empty()) { | 371 if (!locale.empty()) { |
372 // Pass on the locale so the plugin will know what language we're using. | 372 // Pass on the locale so the plugin will know what language we're using. |
373 cmd_line->AppendSwitchASCII(switches::kLang, locale); | 373 cmd_line->AppendSwitchASCII(switches::kLang, locale); |
374 } | 374 } |
375 | 375 |
376 if (!plugin_launcher.empty()) | 376 if (!plugin_launcher.empty()) |
377 cmd_line->PrependWrapper(plugin_launcher); | 377 cmd_line->PrependWrapper(plugin_launcher); |
378 | 378 |
379 // On posix, never use the zygote for the broker. Also, only use the zygote if | 379 // On posix, never use the zygote for the broker. Also, only use the zygote if |
380 // the plugin is sandboxed, and we are not using a plugin launcher - having a | 380 // we are not using a plugin launcher - having a plugin launcher means we need |
381 // plugin launcher means we need to use another process instead of just | 381 // to use another process instead of just forking the zygote. |
382 // forking the zygote. | |
383 #if defined(OS_POSIX) | |
384 if (!info.is_sandboxed) | |
385 cmd_line->AppendSwitchASCII(switches::kNoSandbox, std::string()); | |
386 #endif // OS_POSIX | |
387 process_->Launch( | 382 process_->Launch( |
388 new PpapiPluginSandboxedProcessLauncherDelegate(is_broker_, | 383 new PpapiPluginSandboxedProcessLauncherDelegate(is_broker_, |
389 info, | 384 info, |
390 process_->GetHost()), | 385 process_->GetHost()), |
391 cmd_line, | 386 cmd_line, |
392 true); | 387 true); |
393 return true; | 388 return true; |
394 } | 389 } |
395 | 390 |
396 void PpapiPluginProcessHost::RequestPluginChannel(Client* client) { | 391 void PpapiPluginProcessHost::RequestPluginChannel(Client* client) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 // sent_requests_ queue should be the one that the plugin just created. | 480 // sent_requests_ queue should be the one that the plugin just created. |
486 Client* client = sent_requests_.front(); | 481 Client* client = sent_requests_.front(); |
487 sent_requests_.pop(); | 482 sent_requests_.pop(); |
488 | 483 |
489 const ChildProcessData& data = process_->GetData(); | 484 const ChildProcessData& data = process_->GetData(); |
490 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), | 485 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), |
491 data.id); | 486 data.id); |
492 } | 487 } |
493 | 488 |
494 } // namespace content | 489 } // namespace content |
OLD | NEW |