| OLD | NEW |
| 1 | 1 |
| 2 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 // | 5 // |
| 6 // This file implements the Windows service controlling Me2Me host processes | 6 // This file implements the Windows service controlling Me2Me host processes |
| 7 // running within user sessions. | 7 // running within user sessions. |
| 8 | 8 |
| 9 #include "remoting/host/win/unprivileged_process_delegate.h" | 9 #include "remoting/host/win/unprivileged_process_delegate.h" |
| 10 | 10 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 } | 231 } |
| 232 | 232 |
| 233 handles.Swap(*handles_out); | 233 handles.Swap(*handles_out); |
| 234 return true; | 234 return true; |
| 235 } | 235 } |
| 236 | 236 |
| 237 } // namespace | 237 } // namespace |
| 238 | 238 |
| 239 UnprivilegedProcessDelegate::UnprivilegedProcessDelegate( | 239 UnprivilegedProcessDelegate::UnprivilegedProcessDelegate( |
| 240 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 240 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 241 scoped_ptr<base::CommandLine> target_command) | 241 std::unique_ptr<base::CommandLine> target_command) |
| 242 : io_task_runner_(io_task_runner), | 242 : io_task_runner_(io_task_runner), |
| 243 target_command_(std::move(target_command)), | 243 target_command_(std::move(target_command)), |
| 244 event_handler_(nullptr) {} | 244 event_handler_(nullptr) {} |
| 245 | 245 |
| 246 UnprivilegedProcessDelegate::~UnprivilegedProcessDelegate() { | 246 UnprivilegedProcessDelegate::~UnprivilegedProcessDelegate() { |
| 247 DCHECK(CalledOnValidThread()); | 247 DCHECK(CalledOnValidThread()); |
| 248 DCHECK(!channel_); | 248 DCHECK(!channel_); |
| 249 DCHECK(!worker_process_.IsValid()); | 249 DCHECK(!worker_process_.IsValid()); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void UnprivilegedProcessDelegate::LaunchProcess( | 252 void UnprivilegedProcessDelegate::LaunchProcess( |
| 253 WorkerProcessLauncher* event_handler) { | 253 WorkerProcessLauncher* event_handler) { |
| 254 DCHECK(CalledOnValidThread()); | 254 DCHECK(CalledOnValidThread()); |
| 255 DCHECK(!event_handler_); | 255 DCHECK(!event_handler_); |
| 256 | 256 |
| 257 event_handler_ = event_handler; | 257 event_handler_ = event_handler; |
| 258 | 258 |
| 259 scoped_ptr<IPC::ChannelProxy> server; | 259 std::unique_ptr<IPC::ChannelProxy> server; |
| 260 | 260 |
| 261 // Create a restricted token that will be used to run the worker process. | 261 // Create a restricted token that will be used to run the worker process. |
| 262 ScopedHandle token; | 262 ScopedHandle token; |
| 263 if (!CreateRestrictedToken(&token)) { | 263 if (!CreateRestrictedToken(&token)) { |
| 264 PLOG(ERROR) << "Failed to create a restricted LocalService token"; | 264 PLOG(ERROR) << "Failed to create a restricted LocalService token"; |
| 265 ReportFatalError(); | 265 ReportFatalError(); |
| 266 return; | 266 return; |
| 267 } | 267 } |
| 268 | 268 |
| 269 // Determine our logon SID, so we can grant it access to our window station | 269 // Determine our logon SID, so we can grant it access to our window station |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 PLOG(ERROR) << "Failed to duplicate a handle"; | 432 PLOG(ERROR) << "Failed to duplicate a handle"; |
| 433 ReportFatalError(); | 433 ReportFatalError(); |
| 434 return; | 434 return; |
| 435 } | 435 } |
| 436 ScopedHandle limited_handle(temp_handle); | 436 ScopedHandle limited_handle(temp_handle); |
| 437 | 437 |
| 438 event_handler_->OnProcessLaunched(std::move(limited_handle)); | 438 event_handler_->OnProcessLaunched(std::move(limited_handle)); |
| 439 } | 439 } |
| 440 | 440 |
| 441 } // namespace remoting | 441 } // namespace remoting |
| OLD | NEW |