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

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: Missed one clang error. 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
66 // The Pepper process is as locked-down as a renderer except that it can 67 // The Pepper process is as locked-down as a renderer except that it can
67 // create the server side of Chrome pipes. 68 // create the server side of Chrome pipes.
68 sandbox::ResultCode result; 69 sandbox::ResultCode result;
69 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, 70 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_NAMED_PIPES,
70 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY, 71 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY,
71 L"\\\\.\\pipe\\chrome.*"); 72 L"\\\\.\\pipe\\chrome.*");
72 if (result != sandbox::SBOX_ALL_OK) 73 if (result != sandbox::SBOX_ALL_OK) {
73 return; 74 return false;
75 }
76
74 #if !defined(NACL_WIN64) 77 #if !defined(NACL_WIN64)
75 for (const auto& mime_type : info_.mime_types) { 78 for (const auto& mime_type : info_.mime_types) {
76 if (IsWin32kLockdownEnabledForMimeType(mime_type.mime_type)) { 79 if (IsWin32kLockdownEnabledForMimeType(mime_type.mime_type)) {
77 if (!AddWin32kLockdownPolicy(policy)) 80 if (!AddWin32kLockdownPolicy(policy)) {
78 return; 81 return false;
82 }
79 break; 83 break;
80 } 84 }
81 } 85 }
82 #endif 86 #endif
83 const base::string16& sid = 87 const base::string16& sid =
84 GetContentClient()->browser()->GetAppContainerSidForSandboxType( 88 GetContentClient()->browser()->GetAppContainerSidForSandboxType(
85 GetSandboxType()); 89 GetSandboxType());
86 if (!sid.empty()) 90 if (!sid.empty())
87 AddAppContainerPolicy(policy, sid.c_str()); 91 AddAppContainerPolicy(policy, sid.c_str());
88 92
89 *success = true; 93 return true;
90 } 94 }
91 95
92 #elif defined(OS_POSIX) 96 #elif defined(OS_POSIX)
93 bool ShouldUseZygote() override { 97 bool ShouldUseZygote() override {
94 const base::CommandLine& browser_command_line = 98 const base::CommandLine& browser_command_line =
95 *base::CommandLine::ForCurrentProcess(); 99 *base::CommandLine::ForCurrentProcess();
96 base::CommandLine::StringType plugin_launcher = browser_command_line 100 base::CommandLine::StringType plugin_launcher = browser_command_line
97 .GetSwitchValueNative(switches::kPpapiPluginLauncher); 101 .GetSwitchValueNative(switches::kPpapiPluginLauncher);
98 return !is_broker_ && plugin_launcher.empty(); 102 return !is_broker_ && plugin_launcher.empty();
99 } 103 }
(...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. 514 // sent_requests_ queue should be the one that the plugin just created.
511 Client* client = sent_requests_.front(); 515 Client* client = sent_requests_.front();
512 sent_requests_.pop(); 516 sent_requests_.pop();
513 517
514 const ChildProcessData& data = process_->GetData(); 518 const ChildProcessData& data = process_->GetData();
515 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), 519 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle),
516 data.id); 520 data.id);
517 } 521 }
518 522
519 } // namespace content 523 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698