| 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 #include "remoting/host/daemon_process.h" | 5 #include "remoting/host/daemon_process.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/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/process.h" | 14 #include "base/process.h" |
| 15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "base/timer.h" | 17 #include "base/timer.h" |
| 18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 19 #include "base/win/scoped_handle.h" | 19 #include "base/win/scoped_handle.h" |
| 20 #include "ipc/ipc_message.h" | 20 #include "ipc/ipc_message.h" |
| 21 #include "ipc/ipc_message_macros.h" | 21 #include "ipc/ipc_message_macros.h" |
| 22 #include "remoting/base/auto_thread_task_runner.h" | 22 #include "remoting/base/auto_thread_task_runner.h" |
| 23 #include "remoting/host/chromoting_messages.h" | 23 #include "remoting/host/chromoting_messages.h" |
| 24 #include "remoting/host/desktop_session_win.h" | 24 #include "remoting/host/desktop_session_win.h" |
| 25 #include "remoting/host/host_exit_codes.h" | 25 #include "remoting/host/host_exit_codes.h" |
| 26 #include "remoting/host/host_main.h" | 26 #include "remoting/host/host_main.h" |
| 27 #include "remoting/host/ipc_constants.h" | 27 #include "remoting/host/ipc_constants.h" |
| 28 #include "remoting/host/screen_resolution.h" |
| 28 #include "remoting/host/win/launch_process_with_token.h" | 29 #include "remoting/host/win/launch_process_with_token.h" |
| 29 #include "remoting/host/win/unprivileged_process_delegate.h" | 30 #include "remoting/host/win/unprivileged_process_delegate.h" |
| 30 #include "remoting/host/win/worker_process_launcher.h" | 31 #include "remoting/host/win/worker_process_launcher.h" |
| 31 | 32 |
| 32 using base::win::ScopedHandle; | 33 using base::win::ScopedHandle; |
| 33 using base::TimeDelta; | 34 using base::TimeDelta; |
| 34 | 35 |
| 35 namespace remoting { | 36 namespace remoting { |
| 36 | 37 |
| 37 class WtsTerminalMonitor; | 38 class WtsTerminalMonitor; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 58 base::ProcessHandle desktop_process, | 59 base::ProcessHandle desktop_process, |
| 59 IPC::PlatformFileForTransit desktop_pipe) OVERRIDE; | 60 IPC::PlatformFileForTransit desktop_pipe) OVERRIDE; |
| 60 | 61 |
| 61 protected: | 62 protected: |
| 62 // Stoppable implementation. | 63 // Stoppable implementation. |
| 63 virtual void DoStop() OVERRIDE; | 64 virtual void DoStop() OVERRIDE; |
| 64 | 65 |
| 65 // DaemonProcess implementation. | 66 // DaemonProcess implementation. |
| 66 virtual scoped_ptr<DesktopSession> DoCreateDesktopSession( | 67 virtual scoped_ptr<DesktopSession> DoCreateDesktopSession( |
| 67 int terminal_id, | 68 int terminal_id, |
| 68 const DesktopSessionParams& params, | 69 const ScreenResolution& resolution, |
| 69 bool virtual_terminal) OVERRIDE; | 70 bool virtual_terminal) OVERRIDE; |
| 70 virtual void DoCrashNetworkProcess( | 71 virtual void DoCrashNetworkProcess( |
| 71 const tracked_objects::Location& location) OVERRIDE; | 72 const tracked_objects::Location& location) OVERRIDE; |
| 72 virtual void LaunchNetworkProcess() OVERRIDE; | 73 virtual void LaunchNetworkProcess() OVERRIDE; |
| 73 | 74 |
| 74 private: | 75 private: |
| 75 scoped_ptr<WorkerProcessLauncher> network_launcher_; | 76 scoped_ptr<WorkerProcessLauncher> network_launcher_; |
| 76 | 77 |
| 77 // Handle of the network process. | 78 // Handle of the network process. |
| 78 ScopedHandle network_process_; | 79 ScopedHandle network_process_; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 140 |
| 140 void DaemonProcessWin::DoStop() { | 141 void DaemonProcessWin::DoStop() { |
| 141 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 142 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 142 | 143 |
| 143 network_launcher_.reset(); | 144 network_launcher_.reset(); |
| 144 DaemonProcess::DoStop(); | 145 DaemonProcess::DoStop(); |
| 145 } | 146 } |
| 146 | 147 |
| 147 scoped_ptr<DesktopSession> DaemonProcessWin::DoCreateDesktopSession( | 148 scoped_ptr<DesktopSession> DaemonProcessWin::DoCreateDesktopSession( |
| 148 int terminal_id, | 149 int terminal_id, |
| 149 const DesktopSessionParams& params, | 150 const ScreenResolution& resolution, |
| 150 bool virtual_terminal) { | 151 bool virtual_terminal) { |
| 151 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 152 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 152 | 153 |
| 153 if (virtual_terminal) { | 154 if (virtual_terminal) { |
| 154 return DesktopSessionWin::CreateForVirtualTerminal( | 155 return DesktopSessionWin::CreateForVirtualTerminal( |
| 155 caller_task_runner(), io_task_runner(), this, terminal_id, params); | 156 caller_task_runner(), io_task_runner(), this, terminal_id, resolution); |
| 156 } else { | 157 } else { |
| 157 return DesktopSessionWin::CreateForConsole( | 158 return DesktopSessionWin::CreateForConsole( |
| 158 caller_task_runner(), io_task_runner(), this, terminal_id, params); | 159 caller_task_runner(), io_task_runner(), this, terminal_id, resolution); |
| 159 } | 160 } |
| 160 } | 161 } |
| 161 | 162 |
| 162 void DaemonProcessWin::DoCrashNetworkProcess( | 163 void DaemonProcessWin::DoCrashNetworkProcess( |
| 163 const tracked_objects::Location& location) { | 164 const tracked_objects::Location& location) { |
| 164 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 165 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 165 | 166 |
| 166 network_launcher_->Crash(location); | 167 network_launcher_->Crash(location); |
| 167 } | 168 } |
| 168 | 169 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 195 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 196 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
| 196 const base::Closure& stopped_callback) { | 197 const base::Closure& stopped_callback) { |
| 197 scoped_ptr<DaemonProcessWin> daemon_process( | 198 scoped_ptr<DaemonProcessWin> daemon_process( |
| 198 new DaemonProcessWin(caller_task_runner, io_task_runner, | 199 new DaemonProcessWin(caller_task_runner, io_task_runner, |
| 199 stopped_callback)); | 200 stopped_callback)); |
| 200 daemon_process->Initialize(); | 201 daemon_process->Initialize(); |
| 201 return daemon_process.PassAs<DaemonProcess>(); | 202 return daemon_process.PassAs<DaemonProcess>(); |
| 202 } | 203 } |
| 203 | 204 |
| 204 } // namespace remoting | 205 } // namespace remoting |
| OLD | NEW |