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

Side by Side Diff: content/browser/utility_process_host_impl.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/utility_process_host_impl.h" 5 #include "content/browser/utility_process_host_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "content/browser/browser_child_process_host_impl.h" 12 #include "content/browser/browser_child_process_host_impl.h"
13 #include "content/common/child_process_host_impl.h" 13 #include "content/common/child_process_host_impl.h"
14 #include "content/common/utility_messages.h" 14 #include "content/common/utility_messages.h"
15 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/content_browser_client.h" 16 #include "content/public/browser/content_browser_client.h"
17 #include "content/public/browser/utility_process_host_client.h" 17 #include "content/public/browser/utility_process_host_client.h"
18 #include "content/public/common/content_switches.h" 18 #include "content/public/common/content_switches.h"
19 #include "ipc/ipc_switches.h" 19 #include "ipc/ipc_switches.h"
20 #include "ui/base/ui_base_switches.h" 20 #include "ui/base/ui_base_switches.h"
21 #include "webkit/plugins/plugin_switches.h" 21 #include "webkit/plugins/plugin_switches.h"
22 22
23 #if defined(OS_WIN)
24 #include "content/public/common/sandboxed_process_launcher_delegate.h"
25 #endif
26
23 namespace content { 27 namespace content {
24 28
29 #if defined(OS_WIN)
30 class UtilitySandboxedProcessLauncherDelegate
31 : public SandboxedProcessLauncherDelegate {
32 public:
33 explicit UtilitySandboxedProcessLauncherDelegate(
34 const base::FilePath& exposed_dir) : exposed_dir_(exposed_dir) {}
35 virtual ~UtilitySandboxedProcessLauncherDelegate() {}
36
37 virtual void PreSandbox(bool* disable_default_policy,
38 base::FilePath* exposed_dir) {
39 *exposed_dir = exposed_dir_;
40 }
41
42 private:
43 base::FilePath exposed_dir_;
44 };
45 #endif
46
25 UtilityProcessHost* UtilityProcessHost::Create( 47 UtilityProcessHost* UtilityProcessHost::Create(
26 UtilityProcessHostClient* client, 48 UtilityProcessHostClient* client,
27 base::SequencedTaskRunner* client_task_runner) { 49 base::SequencedTaskRunner* client_task_runner) {
28 return new UtilityProcessHostImpl(client, client_task_runner); 50 return new UtilityProcessHostImpl(client, client_task_runner);
29 } 51 }
30 52
31 UtilityProcessHostImpl::UtilityProcessHostImpl( 53 UtilityProcessHostImpl::UtilityProcessHostImpl(
32 UtilityProcessHostClient* client, 54 UtilityProcessHostClient* client,
33 base::SequencedTaskRunner* client_task_runner) 55 base::SequencedTaskRunner* client_task_runner)
34 : client_(client), 56 : client_(client),
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 #endif 185 #endif
164 186
165 bool use_zygote = false; 187 bool use_zygote = false;
166 188
167 #if defined(OS_LINUX) 189 #if defined(OS_LINUX)
168 use_zygote = !no_sandbox_ && use_linux_zygote_; 190 use_zygote = !no_sandbox_ && use_linux_zygote_;
169 #endif 191 #endif
170 192
171 process_->Launch( 193 process_->Launch(
172 #if defined(OS_WIN) 194 #if defined(OS_WIN)
173 exposed_dir_, 195 new UtilitySandboxedProcessLauncherDelegate(exposed_dir_),
174 #elif defined(OS_POSIX) 196 #elif defined(OS_POSIX)
175 use_zygote, 197 use_zygote,
176 env_, 198 env_,
177 #endif 199 #endif
178 cmd_line); 200 cmd_line);
179 201
180 return true; 202 return true;
181 } 203 }
182 204
183 bool UtilityProcessHostImpl::OnMessageReceived(const IPC::Message& message) { 205 bool UtilityProcessHostImpl::OnMessageReceived(const IPC::Message& message) {
184 client_task_runner_->PostTask( 206 client_task_runner_->PostTask(
185 FROM_HERE, 207 FROM_HERE,
186 base::Bind(base::IgnoreResult( 208 base::Bind(base::IgnoreResult(
187 &UtilityProcessHostClient::OnMessageReceived), client_.get(), 209 &UtilityProcessHostClient::OnMessageReceived), client_.get(),
188 message)); 210 message));
189 return true; 211 return true;
190 } 212 }
191 213
192 void UtilityProcessHostImpl::OnProcessCrashed(int exit_code) { 214 void UtilityProcessHostImpl::OnProcessCrashed(int exit_code) {
193 client_task_runner_->PostTask( 215 client_task_runner_->PostTask(
194 FROM_HERE, 216 FROM_HERE,
195 base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_.get(), 217 base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_.get(),
196 exit_code)); 218 exit_code));
197 } 219 }
198 220
199 } // namespace content 221 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698