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

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

Issue 1415483008: Get rid of SandboxedProcessLauncherDelegate::PreSandbox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove curly braces Created 5 years, 1 month 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
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"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #endif // OS_POSIX 52 #endif // OS_POSIX
53 is_broker_(is_broker) {} 53 is_broker_(is_broker) {}
54 54
55 ~PpapiPluginSandboxedProcessLauncherDelegate() override {} 55 ~PpapiPluginSandboxedProcessLauncherDelegate() override {}
56 56
57 #if defined(OS_WIN) 57 #if defined(OS_WIN)
58 bool ShouldSandbox() override { 58 bool ShouldSandbox() override {
59 return !is_broker_; 59 return !is_broker_;
60 } 60 }
61 61
62 void PreSpawnTarget(sandbox::TargetPolicy* policy, bool* success) override { 62 bool PreSpawnTarget(sandbox::TargetPolicy* policy) override {
63 if (is_broker_) 63 if (is_broker_)
64 return; 64 return true;
65 *success = false; 65
66 // The Pepper process is as locked-down as a renderer except that it can 66 // The Pepper process is as locked-down as a renderer except that it can
67 // create the server side of Chrome pipes. 67 // create the server side of Chrome pipes.
68 sandbox::ResultCode result; 68 sandbox::ResultCode result;
69 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, 69 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_NAMED_PIPES,
70 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY, 70 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY,
71 L"\\\\.\\pipe\\chrome.*"); 71 L"\\\\.\\pipe\\chrome.*");
72 if (result != sandbox::SBOX_ALL_OK) 72 if (result != sandbox::SBOX_ALL_OK)
73 return; 73 return false;
74
74 #if !defined(NACL_WIN64) 75 #if !defined(NACL_WIN64)
75 for (const auto& mime_type : info_.mime_types) { 76 for (const auto& mime_type : info_.mime_types) {
76 if (IsWin32kLockdownEnabledForMimeType(mime_type.mime_type)) { 77 if (IsWin32kLockdownEnabledForMimeType(mime_type.mime_type)) {
77 if (!AddWin32kLockdownPolicy(policy)) 78 if (!AddWin32kLockdownPolicy(policy))
78 return; 79 return false;
79 break; 80 break;
80 } 81 }
81 } 82 }
82 #endif 83 #endif
83 const base::string16& sid = 84 const base::string16& sid =
84 GetContentClient()->browser()->GetAppContainerSidForSandboxType( 85 GetContentClient()->browser()->GetAppContainerSidForSandboxType(
85 GetSandboxType()); 86 GetSandboxType());
86 if (!sid.empty()) 87 if (!sid.empty())
87 AddAppContainerPolicy(policy, sid.c_str()); 88 AddAppContainerPolicy(policy, sid.c_str());
88 89
89 *success = true; 90 return true;
90 } 91 }
91 92
92 #elif defined(OS_POSIX) 93 #elif defined(OS_POSIX)
93 bool ShouldUseZygote() override { 94 bool ShouldUseZygote() override {
94 const base::CommandLine& browser_command_line = 95 const base::CommandLine& browser_command_line =
95 *base::CommandLine::ForCurrentProcess(); 96 *base::CommandLine::ForCurrentProcess();
96 base::CommandLine::StringType plugin_launcher = browser_command_line 97 base::CommandLine::StringType plugin_launcher = browser_command_line
97 .GetSwitchValueNative(switches::kPpapiPluginLauncher); 98 .GetSwitchValueNative(switches::kPpapiPluginLauncher);
98 return !is_broker_ && plugin_launcher.empty(); 99 return !is_broker_ && plugin_launcher.empty();
99 } 100 }
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 // sent_requests_ queue should be the one that the plugin just created. 511 // sent_requests_ queue should be the one that the plugin just created.
511 Client* client = sent_requests_.front(); 512 Client* client = sent_requests_.front();
512 sent_requests_.pop(); 513 sent_requests_.pop();
513 514
514 const ChildProcessData& data = process_->GetData(); 515 const ChildProcessData& data = process_->GetData();
515 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), 516 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle),
516 data.id); 517 data.id);
517 } 518 }
518 519
519 } // namespace content 520 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_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