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

Side by Side Diff: chrome/service/service_utility_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
« no previous file with comments | « chrome/nacl/nacl_broker_listener.cc ('k') | chrome_frame/test/net/fake_external_tab.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/service/service_utility_process_host.h" 5 #include "chrome/service/service_utility_process_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/message_loop_proxy.h" 13 #include "base/message_loop_proxy.h"
14 #include "base/process_util.h" 14 #include "base/process_util.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/chrome_utility_messages.h" 17 #include "chrome/common/chrome_utility_messages.h"
18 #include "content/public/common/child_process_host.h" 18 #include "content/public/common/child_process_host.h"
19 #include "content/public/common/result_codes.h" 19 #include "content/public/common/result_codes.h"
20 #include "content/public/common/sandbox_init.h" 20 #include "content/public/common/sandbox_init.h"
21 #include "ipc/ipc_switches.h" 21 #include "ipc/ipc_switches.h"
22 #include "printing/page_range.h" 22 #include "printing/page_range.h"
23 #include "ui/base/ui_base_switches.h" 23 #include "ui/base/ui_base_switches.h"
24 #include "ui/gfx/rect.h" 24 #include "ui/gfx/rect.h"
25 25
26 #if defined(OS_WIN) 26 #if defined(OS_WIN)
27 #include "base/files/file_path.h" 27 #include "base/files/file_path.h"
28 #include "base/memory/scoped_ptr.h" 28 #include "base/memory/scoped_ptr.h"
29 #include "base/win/scoped_handle.h" 29 #include "base/win/scoped_handle.h"
30 #include "content/public/common/sandbox_init.h"
31 #include "content/public/common/sandboxed_process_launcher_delegate.h"
30 #include "printing/emf_win.h" 32 #include "printing/emf_win.h"
31 #endif 33
34 namespace {
35 // NOTE: changes to this class need to be reviewed by the security team.
36 class ServiceSandboxedProcessLauncherDelegate
37 : public content::SandboxedProcessLauncherDelegate {
38 public:
39 explicit ServiceSandboxedProcessLauncherDelegate(
40 const base::FilePath& exposed_dir)
41 : exposed_dir_(exposed_dir) {
42 }
43
44 virtual void PreSandbox(bool* disable_default_policy,
45 base::FilePath* exposed_dir) OVERRIDE {
46 *exposed_dir = exposed_dir_;
47 }
48
49 private:
50 base::FilePath exposed_dir_;
51 };
52 }
53
54 #endif // OS_WIN
32 55
33 using content::ChildProcessHost; 56 using content::ChildProcessHost;
34 57
35 ServiceUtilityProcessHost::ServiceUtilityProcessHost( 58 ServiceUtilityProcessHost::ServiceUtilityProcessHost(
36 Client* client, base::MessageLoopProxy* client_message_loop_proxy) 59 Client* client, base::MessageLoopProxy* client_message_loop_proxy)
37 : handle_(base::kNullProcessHandle), 60 : handle_(base::kNullProcessHandle),
38 client_(client), 61 client_(client),
39 client_message_loop_proxy_(client_message_loop_proxy), 62 client_message_loop_proxy_(client_message_loop_proxy),
40 waiting_for_reply_(false) { 63 waiting_for_reply_(false) {
41 child_process_host_.reset(ChildProcessHost::Create(this)); 64 child_process_host_.reset(ChildProcessHost::Create(this));
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // TODO(sanjeevr): Implement for non-Windows OSes. 154 // TODO(sanjeevr): Implement for non-Windows OSes.
132 NOTIMPLEMENTED(); 155 NOTIMPLEMENTED();
133 return false; 156 return false;
134 #else // !defined(OS_WIN) 157 #else // !defined(OS_WIN)
135 158
136 if (no_sandbox) { 159 if (no_sandbox) {
137 base::ProcessHandle process = base::kNullProcessHandle; 160 base::ProcessHandle process = base::kNullProcessHandle;
138 cmd_line->AppendSwitch(switches::kNoSandbox); 161 cmd_line->AppendSwitch(switches::kNoSandbox);
139 base::LaunchProcess(*cmd_line, base::LaunchOptions(), &handle_); 162 base::LaunchProcess(*cmd_line, base::LaunchOptions(), &handle_);
140 } else { 163 } else {
141 handle_ = content::StartProcessWithAccess(cmd_line, exposed_dir); 164 ServiceSandboxedProcessLauncherDelegate delegate(exposed_dir);
165 handle_ = content::StartSandboxedProcess(&delegate, cmd_line);
142 } 166 }
143 return (handle_ != base::kNullProcessHandle); 167 return (handle_ != base::kNullProcessHandle);
144 #endif // !defined(OS_WIN) 168 #endif // !defined(OS_WIN)
145 } 169 }
146 170
147 base::FilePath ServiceUtilityProcessHost::GetUtilityProcessCmd() { 171 base::FilePath ServiceUtilityProcessHost::GetUtilityProcessCmd() {
148 #if defined(OS_LINUX) 172 #if defined(OS_LINUX)
149 int flags = ChildProcessHost::CHILD_ALLOW_SELF; 173 int flags = ChildProcessHost::CHILD_ALLOW_SELF;
150 #else 174 #else
151 int flags = ChildProcessHost::CHILD_NORMAL; 175 int flags = ChildProcessHost::CHILD_NORMAL;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 if (!metafile.InitFromFile(metafile_path)) { 266 if (!metafile.InitFromFile(metafile_path)) {
243 OnRenderPDFPagesToMetafileFailed(); 267 OnRenderPDFPagesToMetafileFailed();
244 } else { 268 } else {
245 OnRenderPDFPagesToMetafileSucceeded(metafile, 269 OnRenderPDFPagesToMetafileSucceeded(metafile,
246 highest_rendered_page_number, 270 highest_rendered_page_number,
247 scale_factor); 271 scale_factor);
248 } 272 }
249 #endif // defined(OS_WIN) 273 #endif // defined(OS_WIN)
250 } 274 }
251 275
OLDNEW
« no previous file with comments | « chrome/nacl/nacl_broker_listener.cc ('k') | chrome_frame/test/net/fake_external_tab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698