| OLD | NEW |
| 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/win/wts_session_process_delegate.h" | 8 #include "remoting/host/win/wts_session_process_delegate.h" |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 // A private class actually implementing the functionality provided by | 39 // A private class actually implementing the functionality provided by |
| 40 // |WtsSessionProcessDelegate|. This class is ref-counted and implements | 40 // |WtsSessionProcessDelegate|. This class is ref-counted and implements |
| 41 // asynchronous fire-and-forget shutdown. | 41 // asynchronous fire-and-forget shutdown. |
| 42 class WtsSessionProcessDelegate::Core | 42 class WtsSessionProcessDelegate::Core |
| 43 : public base::RefCountedThreadSafe<Core>, | 43 : public base::RefCountedThreadSafe<Core>, |
| 44 public base::MessagePumpForIO::IOHandler, | 44 public base::MessagePumpForIO::IOHandler, |
| 45 public IPC::Listener { | 45 public IPC::Listener { |
| 46 public: | 46 public: |
| 47 Core(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 47 Core(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 48 scoped_ptr<CommandLine> target, | 48 scoped_ptr<base::CommandLine> target, |
| 49 bool launch_elevated, | 49 bool launch_elevated, |
| 50 const std::string& channel_security); | 50 const std::string& channel_security); |
| 51 | 51 |
| 52 // Initializes the object returning true on success. | 52 // Initializes the object returning true on success. |
| 53 bool Initialize(uint32 session_id); | 53 bool Initialize(uint32 session_id); |
| 54 | 54 |
| 55 // Stops the object asynchronously. | 55 // Stops the object asynchronously. |
| 56 void Stop(); | 56 void Stop(); |
| 57 | 57 |
| 58 // Mirrors WorkerProcessLauncher::Delegate. | 58 // Mirrors WorkerProcessLauncher::Delegate. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // True if a laucnh attemp is pending. | 126 // True if a laucnh attemp is pending. |
| 127 bool launch_pending_; | 127 bool launch_pending_; |
| 128 | 128 |
| 129 // The named pipe used as the transport by |channel_|. | 129 // The named pipe used as the transport by |channel_|. |
| 130 base::win::ScopedHandle pipe_; | 130 base::win::ScopedHandle pipe_; |
| 131 | 131 |
| 132 // The token to be used to launch a process in a different session. | 132 // The token to be used to launch a process in a different session. |
| 133 base::win::ScopedHandle session_token_; | 133 base::win::ScopedHandle session_token_; |
| 134 | 134 |
| 135 // Command line of the launched process. | 135 // Command line of the launched process. |
| 136 scoped_ptr<CommandLine> target_command_; | 136 scoped_ptr<base::CommandLine> target_command_; |
| 137 | 137 |
| 138 // The handle of the worker process, if launched. | 138 // The handle of the worker process, if launched. |
| 139 base::win::ScopedHandle worker_process_; | 139 base::win::ScopedHandle worker_process_; |
| 140 | 140 |
| 141 DISALLOW_COPY_AND_ASSIGN(Core); | 141 DISALLOW_COPY_AND_ASSIGN(Core); |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 WtsSessionProcessDelegate::Core::Core( | 144 WtsSessionProcessDelegate::Core::Core( |
| 145 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 145 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 146 scoped_ptr<CommandLine> target_command, | 146 scoped_ptr<base::CommandLine> target_command, |
| 147 bool launch_elevated, | 147 bool launch_elevated, |
| 148 const std::string& channel_security) | 148 const std::string& channel_security) |
| 149 : caller_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 149 : caller_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
| 150 io_task_runner_(io_task_runner), | 150 io_task_runner_(io_task_runner), |
| 151 channel_security_(channel_security), | 151 channel_security_(channel_security), |
| 152 event_handler_(NULL), | 152 event_handler_(NULL), |
| 153 get_named_pipe_client_pid_(NULL), | 153 get_named_pipe_client_pid_(NULL), |
| 154 launch_elevated_(launch_elevated), | 154 launch_elevated_(launch_elevated), |
| 155 launch_pending_(false), | 155 launch_pending_(false), |
| 156 target_command_(target_command.Pass()) { | 156 target_command_(target_command.Pass()) { |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 ReportFatalError(); | 523 ReportFatalError(); |
| 524 return; | 524 return; |
| 525 } | 525 } |
| 526 ScopedHandle limited_handle(temp_handle); | 526 ScopedHandle limited_handle(temp_handle); |
| 527 | 527 |
| 528 event_handler_->OnProcessLaunched(limited_handle.Pass()); | 528 event_handler_->OnProcessLaunched(limited_handle.Pass()); |
| 529 } | 529 } |
| 530 | 530 |
| 531 WtsSessionProcessDelegate::WtsSessionProcessDelegate( | 531 WtsSessionProcessDelegate::WtsSessionProcessDelegate( |
| 532 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 532 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 533 scoped_ptr<CommandLine> target_command, | 533 scoped_ptr<base::CommandLine> target_command, |
| 534 bool launch_elevated, | 534 bool launch_elevated, |
| 535 const std::string& channel_security) { | 535 const std::string& channel_security) { |
| 536 core_ = new Core(io_task_runner, | 536 core_ = new Core(io_task_runner, |
| 537 target_command.Pass(), | 537 target_command.Pass(), |
| 538 launch_elevated, | 538 launch_elevated, |
| 539 channel_security); | 539 channel_security); |
| 540 } | 540 } |
| 541 | 541 |
| 542 WtsSessionProcessDelegate::~WtsSessionProcessDelegate() { | 542 WtsSessionProcessDelegate::~WtsSessionProcessDelegate() { |
| 543 core_->Stop(); | 543 core_->Stop(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 558 | 558 |
| 559 void WtsSessionProcessDelegate::CloseChannel() { | 559 void WtsSessionProcessDelegate::CloseChannel() { |
| 560 core_->CloseChannel(); | 560 core_->CloseChannel(); |
| 561 } | 561 } |
| 562 | 562 |
| 563 void WtsSessionProcessDelegate::KillProcess() { | 563 void WtsSessionProcessDelegate::KillProcess() { |
| 564 core_->KillProcess(); | 564 core_->KillProcess(); |
| 565 } | 565 } |
| 566 | 566 |
| 567 } // namespace remoting | 567 } // namespace remoting |
| OLD | NEW |