Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: content/browser/ppapi_plugin_process_host.cc

Issue 12805004: Remove mention of the nacl process in content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/process_util.h" 12 #include "base/process_util.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "content/browser/browser_child_process_host_impl.h" 14 #include "content/browser/browser_child_process_host_impl.h"
15 #include "content/browser/plugin_service_impl.h" 15 #include "content/browser/plugin_service_impl.h"
16 #include "content/browser/renderer_host/render_message_filter.h" 16 #include "content/browser/renderer_host/render_message_filter.h"
17 #include "content/common/child_process_host_impl.h" 17 #include "content/common/child_process_host_impl.h"
18 #include "content/common/child_process_messages.h" 18 #include "content/common/child_process_messages.h"
19 #include "content/public/browser/content_browser_client.h" 19 #include "content/public/browser/content_browser_client.h"
20 #include "content/public/common/content_switches.h" 20 #include "content/public/common/content_switches.h"
21 #include "content/public/common/pepper_plugin_info.h" 21 #include "content/public/common/pepper_plugin_info.h"
22 #include "content/public/common/process_type.h" 22 #include "content/public/common/process_type.h"
23 #include "ipc/ipc_switches.h" 23 #include "ipc/ipc_switches.h"
24 #include "net/base/network_change_notifier.h" 24 #include "net/base/network_change_notifier.h"
25 #include "ppapi/proxy/ppapi_messages.h" 25 #include "ppapi/proxy/ppapi_messages.h"
26 #include "ui/base/ui_base_switches.h" 26 #include "ui/base/ui_base_switches.h"
27 #include "webkit/plugins/plugin_switches.h" 27 #include "webkit/plugins/plugin_switches.h"
28 28
29 #if defined(OS_WIN)
30 #include "content/common/sandbox_win.h"
31 #include "content/public/common/sandboxed_process_launcher_delegate.h"
32 #include "sandbox/win/src/sandbox_policy.h"
33 #endif
34
29 namespace content { 35 namespace content {
30 36
37 #if defined(OS_WIN)
38 // NOTE: changes to this class need to be reviewed by the security team.
39 class PpapiPluginSandboxedProcessLauncherDelegate
40 : public content::SandboxedProcessLauncherDelegate {
41 public:
42 PpapiPluginSandboxedProcessLauncherDelegate() {}
43 virtual ~PpapiPluginSandboxedProcessLauncherDelegate() {}
44
45 virtual void PreSpawnTarget(sandbox::TargetPolicy* policy,
46 bool* success) {
47 // The Pepper process as locked-down as a renderer execpt that it can
48 // create the server side of chrome pipes.
49 sandbox::ResultCode result;
50 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_NAMED_PIPES,
51 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY,
52 L"\\\\.\\pipe\\chrome.*");
53 *success = (result == sandbox::SBOX_ALL_OK);
54 }
55 };
56 #endif // OS_WIN
57
31 class PpapiPluginProcessHost::PluginNetworkObserver 58 class PpapiPluginProcessHost::PluginNetworkObserver
32 : public net::NetworkChangeNotifier::IPAddressObserver, 59 : public net::NetworkChangeNotifier::IPAddressObserver,
33 public net::NetworkChangeNotifier::ConnectionTypeObserver { 60 public net::NetworkChangeNotifier::ConnectionTypeObserver {
34 public: 61 public:
35 explicit PluginNetworkObserver(PpapiPluginProcessHost* process_host) 62 explicit PluginNetworkObserver(PpapiPluginProcessHost* process_host)
36 : process_host_(process_host) { 63 : process_host_(process_host) {
37 net::NetworkChangeNotifier::AddIPAddressObserver(this); 64 net::NetworkChangeNotifier::AddIPAddressObserver(this);
38 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); 65 net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
39 } 66 }
40 67
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // the plugin is sandboxed, and we are not using a plugin launcher - having a 304 // the plugin is sandboxed, and we are not using a plugin launcher - having a
278 // plugin launcher means we need to use another process instead of just 305 // plugin launcher means we need to use another process instead of just
279 // forking the zygote. 306 // forking the zygote.
280 #if defined(OS_POSIX) 307 #if defined(OS_POSIX)
281 bool use_zygote = !is_broker_ && plugin_launcher.empty() && info.is_sandboxed; 308 bool use_zygote = !is_broker_ && plugin_launcher.empty() && info.is_sandboxed;
282 if (!info.is_sandboxed) 309 if (!info.is_sandboxed)
283 cmd_line->AppendSwitchASCII(switches::kNoSandbox, ""); 310 cmd_line->AppendSwitchASCII(switches::kNoSandbox, "");
284 #endif // OS_POSIX 311 #endif // OS_POSIX
285 process_->Launch( 312 process_->Launch(
286 #if defined(OS_WIN) 313 #if defined(OS_WIN)
287 base::FilePath(), 314 is_broker_ ? NULL : new PpapiPluginSandboxedProcessLauncherDelegate,
288 #elif defined(OS_POSIX) 315 #elif defined(OS_POSIX)
289 use_zygote, 316 use_zygote,
290 base::EnvironmentVector(), 317 base::EnvironmentVector(),
291 #endif 318 #endif
292 cmd_line); 319 cmd_line);
293 return true; 320 return true;
294 } 321 }
295 322
296 void PpapiPluginProcessHost::RequestPluginChannel(Client* client) { 323 void PpapiPluginProcessHost::RequestPluginChannel(Client* client) {
297 base::ProcessHandle process_handle; 324 base::ProcessHandle process_handle;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 // sent_requests_ queue should be the one that the plugin just created. 410 // sent_requests_ queue should be the one that the plugin just created.
384 Client* client = sent_requests_.front(); 411 Client* client = sent_requests_.front();
385 sent_requests_.pop(); 412 sent_requests_.pop();
386 413
387 const ChildProcessData& data = process_->GetData(); 414 const ChildProcessData& data = process_->GetData();
388 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), 415 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle),
389 data.id); 416 data.id);
390 } 417 }
391 418
392 } // namespace content 419 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/plugin_process_host.cc ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698