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

Side by Side Diff: remoting/host/win/wts_session_process_launcher.cc

Issue 10832068: Moving Windows-only files: remoting/host -> remoting/host/win. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 // This file implements the Windows service controlling Me2Me host processes 5 // This file implements the Windows service controlling Me2Me host processes
6 // running within user sessions. 6 // running within user sessions.
7 7
8 #include "remoting/host/wts_session_process_launcher_win.h" 8 #include "remoting/host/win/wts_session_process_launcher.h"
9 9
10 #include <windows.h> 10 #include <windows.h>
11 #include <sddl.h> 11 #include <sddl.h>
12 #include <limits> 12 #include <limits>
13 13
14 #include "base/base_switches.h" 14 #include "base/base_switches.h"
15 #include "base/bind.h" 15 #include "base/bind.h"
16 #include "base/bind_helpers.h" 16 #include "base/bind_helpers.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/message_loop_proxy.h" 19 #include "base/message_loop_proxy.h"
20 #include "base/process_util.h" 20 #include "base/process_util.h"
21 #include "base/rand_util.h" 21 #include "base/rand_util.h"
22 #include "base/stringprintf.h" 22 #include "base/stringprintf.h"
23 #include "base/win/scoped_handle.h" 23 #include "base/win/scoped_handle.h"
24 #include "ipc/ipc_channel_proxy.h" 24 #include "ipc/ipc_channel_proxy.h"
25 #include "ipc/ipc_message.h" 25 #include "ipc/ipc_message.h"
26 #include "ipc/ipc_message_macros.h" 26 #include "ipc/ipc_message_macros.h"
27 #include "remoting/host/constants.h" 27 #include "remoting/host/constants.h"
28 #include "remoting/host/chromoting_messages.h" 28 #include "remoting/host/chromoting_messages.h"
29 #include "remoting/host/launch_process_in_session_win.h"
30 #include "remoting/host/sas_injector.h" 29 #include "remoting/host/sas_injector.h"
31 #include "remoting/host/wts_console_monitor_win.h" 30 #include "remoting/host/win/launch_process_with_token.h"
31 #include "remoting/host/win/wts_console_monitor.h"
32 32
33 using base::win::ScopedHandle; 33 using base::win::ScopedHandle;
34 using base::TimeDelta; 34 using base::TimeDelta;
35 35
36 namespace { 36 namespace {
37 37
38 // The minimum and maximum delays between attempts to inject host process into 38 // The minimum and maximum delays between attempts to inject host process into
39 // a session. 39 // a session.
40 const int kMaxLaunchDelaySeconds = 60; 40 const int kMaxLaunchDelaySeconds = 60;
41 const int kMinLaunchDelaySeconds = 1; 41 const int kMinLaunchDelaySeconds = 1;
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // Create the host process command line passing the name of the IPC channel 258 // Create the host process command line passing the name of the IPC channel
259 // to use and copying known switches from the service's command line. 259 // to use and copying known switches from the service's command line.
260 CommandLine command_line(host_binary_); 260 CommandLine command_line(host_binary_);
261 command_line.AppendSwitchNative(kChromotingIpcSwitchName, channel_name); 261 command_line.AppendSwitchNative(kChromotingIpcSwitchName, channel_name);
262 command_line.CopySwitchesFrom(*CommandLine::ForCurrentProcess(), 262 command_line.CopySwitchesFrom(*CommandLine::ForCurrentProcess(),
263 kCopiedSwitchNames, 263 kCopiedSwitchNames,
264 _countof(kCopiedSwitchNames)); 264 _countof(kCopiedSwitchNames));
265 265
266 // Try to launch the process and attach an object watcher to the returned 266 // Try to launch the process and attach an object watcher to the returned
267 // handle so that we get notified when the process terminates. 267 // handle so that we get notified when the process terminates.
268 if (LaunchProcessInSession(host_binary_, 268 if (LaunchProcessWithToken(host_binary_,
269 command_line.GetCommandLineString(), 269 command_line.GetCommandLineString(),
270 session_token_, 270 session_token_,
271 &process_)) { 271 &process_)) {
272 if (process_watcher_.StartWatching(process_.handle(), this)) { 272 if (process_watcher_.StartWatching(process_.handle(), this)) {
273 state_ = StateAttached; 273 state_ = StateAttached;
274 return; 274 return;
275 } else { 275 } else {
276 LOG(ERROR) << "Failed to arm the process watcher."; 276 LOG(ERROR) << "Failed to arm the process watcher.";
277 process_.Terminate(0); 277 process_.Terminate(0);
278 process_.Close(); 278 process_.Close();
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 process_.Close(); 457 process_.Close();
458 chromoting_channel_.reset(); 458 chromoting_channel_.reset();
459 state_ = StateDetached; 459 state_ = StateDetached;
460 break; 460 break;
461 } 461 }
462 462
463 session_token_.Close(); 463 session_token_.Close();
464 } 464 }
465 465
466 } // namespace remoting 466 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/win/wts_session_process_launcher.h ('k') | remoting/host/wts_console_monitor_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698