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

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

Issue 98603007: Launches a privileged utility process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adds the elevation flag to the utility process. Created 6 years, 10 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
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/browser_child_process_host_impl.h" 5 #include "content/browser/browser_child_process_host_impl.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 BrowserChildProcessList copy = g_child_process_list.Get(); 124 BrowserChildProcessList copy = g_child_process_list.Get();
125 for (BrowserChildProcessList::iterator it = copy.begin(); 125 for (BrowserChildProcessList::iterator it = copy.begin();
126 it != copy.end(); ++it) { 126 it != copy.end(); ++it) {
127 delete (*it)->delegate(); // ~*HostDelegate deletes *HostImpl. 127 delete (*it)->delegate(); // ~*HostDelegate deletes *HostImpl.
128 } 128 }
129 } 129 }
130 130
131 void BrowserChildProcessHostImpl::Launch( 131 void BrowserChildProcessHostImpl::Launch(
132 #if defined(OS_WIN) 132 #if defined(OS_WIN)
133 SandboxedProcessLauncherDelegate* delegate, 133 SandboxedProcessLauncherDelegate* delegate,
134 bool launch_elevated,
134 #elif defined(OS_POSIX) 135 #elif defined(OS_POSIX)
135 bool use_zygote, 136 bool use_zygote,
136 const base::EnvironmentMap& environ, 137 const base::EnvironmentMap& environ,
137 #endif 138 #endif
138 CommandLine* cmd_line) { 139 CommandLine* cmd_line) {
139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 140 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
140 141
141 GetContentClient()->browser()->AppendExtraCommandLineSwitches( 142 GetContentClient()->browser()->AppendExtraCommandLineSwitches(
142 cmd_line, data_.id); 143 cmd_line, data_.id);
143 144
(...skipping 12 matching lines...) Expand all
156 #if defined(OS_WIN) 157 #if defined(OS_WIN)
157 switches::kEnableHighResolutionTime, 158 switches::kEnableHighResolutionTime,
158 #endif 159 #endif
159 }; 160 };
160 cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches, 161 cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches,
161 arraysize(kForwardSwitches)); 162 arraysize(kForwardSwitches));
162 163
163 child_process_.reset(new ChildProcessLauncher( 164 child_process_.reset(new ChildProcessLauncher(
164 #if defined(OS_WIN) 165 #if defined(OS_WIN)
165 delegate, 166 delegate,
167 launch_elevated,
166 #elif defined(OS_POSIX) 168 #elif defined(OS_POSIX)
167 use_zygote, 169 use_zygote,
168 environ, 170 environ,
169 child_process_host_->TakeClientFileDescriptor(), 171 child_process_host_->TakeClientFileDescriptor(),
170 #endif 172 #endif
171 cmd_line, 173 cmd_line,
172 data_.id, 174 data_.id,
173 this)); 175 this));
174 } 176 }
175 177
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 } 313 }
312 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 314 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
313 base::Bind(&NotifyProcessHostDisconnected, data_)); 315 base::Bind(&NotifyProcessHostDisconnected, data_));
314 delete delegate_; // Will delete us 316 delete delegate_; // Will delete us
315 } 317 }
316 318
317 bool BrowserChildProcessHostImpl::Send(IPC::Message* message) { 319 bool BrowserChildProcessHostImpl::Send(IPC::Message* message) {
318 return child_process_host_->Send(message); 320 return child_process_host_->Send(message);
319 } 321 }
320 322
323 void BrowserChildProcessHostImpl::OnProcessLaunchFailed() {
324 delegate_->OnProcessLaunchFailed();
325 delete delegate_; // Will delete us
326 }
327
321 void BrowserChildProcessHostImpl::OnProcessLaunched() { 328 void BrowserChildProcessHostImpl::OnProcessLaunched() {
322 base::ProcessHandle handle = child_process_->GetHandle(); 329 base::ProcessHandle handle = child_process_->GetHandle();
323 if (!handle) { 330 if (!handle) {
324 delete delegate_; // Will delete us 331 delete delegate_; // Will delete us
325 return; 332 return;
326 } 333 }
327 334
328 #if defined(OS_WIN) 335 #if defined(OS_WIN)
329 // Start a WaitableEventWatcher that will invoke OnProcessExitedEarly if the 336 // Start a WaitableEventWatcher that will invoke OnProcessExitedEarly if the
330 // child process exits. This watcher is stopped once the IPC channel is 337 // child process exits. This watcher is stopped once the IPC channel is
(...skipping 26 matching lines...) Expand all
357 364
358 void BrowserChildProcessHostImpl::OnProcessExitedEarly( 365 void BrowserChildProcessHostImpl::OnProcessExitedEarly(
359 base::WaitableEvent* event) { 366 base::WaitableEvent* event) {
360 DeleteProcessWaitableEvent(event); 367 DeleteProcessWaitableEvent(event);
361 OnChildDisconnected(); 368 OnChildDisconnected();
362 } 369 }
363 370
364 #endif 371 #endif
365 372
366 } // namespace content 373 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_child_process_host_impl.h ('k') | content/browser/child_process_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698