| 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_launcher.h" | 8 #include "remoting/host/win/wts_session_process_launcher.h" |
| 9 | 9 |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "base/process_util.h" | 23 #include "base/process_util.h" |
| 24 #include "base/rand_util.h" | 24 #include "base/rand_util.h" |
| 25 #include "base/stringprintf.h" | 25 #include "base/stringprintf.h" |
| 26 #include "base/utf_string_conversions.h" | 26 #include "base/utf_string_conversions.h" |
| 27 #include "base/win/scoped_handle.h" | 27 #include "base/win/scoped_handle.h" |
| 28 #include "ipc/ipc_channel_proxy.h" | 28 #include "ipc/ipc_channel_proxy.h" |
| 29 #include "ipc/ipc_message.h" | 29 #include "ipc/ipc_message.h" |
| 30 #include "ipc/ipc_message_macros.h" | 30 #include "ipc/ipc_message_macros.h" |
| 31 #include "remoting/host/constants.h" | 31 #include "remoting/host/constants.h" |
| 32 #include "remoting/host/chromoting_messages.h" | 32 #include "remoting/host/chromoting_messages.h" |
| 33 #include "remoting/host/sas_injector.h" | |
| 34 #include "remoting/host/win/launch_process_with_token.h" | 33 #include "remoting/host/win/launch_process_with_token.h" |
| 35 #include "remoting/host/win/wts_console_monitor.h" | 34 #include "remoting/host/win/wts_console_monitor.h" |
| 36 | 35 |
| 37 using base::win::ScopedHandle; | 36 using base::win::ScopedHandle; |
| 38 using base::TimeDelta; | 37 using base::TimeDelta; |
| 39 | 38 |
| 40 namespace { | 39 namespace { |
| 41 | 40 |
| 42 // The minimum and maximum delays between attempts to inject host process into | 41 // The minimum and maximum delays between attempts to inject host process into |
| 43 // a session. | 42 // a session. |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } | 199 } |
| 201 } | 200 } |
| 202 | 201 |
| 203 void WtsSessionProcessLauncher::OnChannelConnected() { | 202 void WtsSessionProcessLauncher::OnChannelConnected() { |
| 204 DCHECK(main_message_loop_->BelongsToCurrentThread()); | 203 DCHECK(main_message_loop_->BelongsToCurrentThread()); |
| 205 } | 204 } |
| 206 | 205 |
| 207 bool WtsSessionProcessLauncher::OnMessageReceived(const IPC::Message& message) { | 206 bool WtsSessionProcessLauncher::OnMessageReceived(const IPC::Message& message) { |
| 208 DCHECK(main_message_loop_->BelongsToCurrentThread()); | 207 DCHECK(main_message_loop_->BelongsToCurrentThread()); |
| 209 | 208 |
| 210 bool handled = true; | 209 return false; |
| 211 IPC_BEGIN_MESSAGE_MAP(WtsSessionProcessLauncher, message) | |
| 212 IPC_MESSAGE_HANDLER(ChromotingHostMsg_SendSasToConsole, | |
| 213 OnSendSasToConsole) | |
| 214 IPC_MESSAGE_UNHANDLED(handled = false) | |
| 215 IPC_END_MESSAGE_MAP() | |
| 216 return handled; | |
| 217 } | 210 } |
| 218 | 211 |
| 219 void WtsSessionProcessLauncher::OnSessionAttached(uint32 session_id) { | 212 void WtsSessionProcessLauncher::OnSessionAttached(uint32 session_id) { |
| 220 DCHECK(main_message_loop_->BelongsToCurrentThread()); | 213 DCHECK(main_message_loop_->BelongsToCurrentThread()); |
| 221 | 214 |
| 222 if (stoppable_state() != Stoppable::kRunning) { | 215 if (stoppable_state() != Stoppable::kRunning) { |
| 223 return; | 216 return; |
| 224 } | 217 } |
| 225 | 218 |
| 226 DCHECK(!attached_); | 219 DCHECK(!attached_); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 launch_backoff_ = std::min( | 427 launch_backoff_ = std::min( |
| 435 launch_backoff_, TimeDelta::FromSeconds(kMaxLaunchDelaySeconds)); | 428 launch_backoff_, TimeDelta::FromSeconds(kMaxLaunchDelaySeconds)); |
| 436 } | 429 } |
| 437 | 430 |
| 438 // Try to launch the worker process. | 431 // Try to launch the worker process. |
| 439 timer_.Start(FROM_HERE, launch_backoff_, | 432 timer_.Start(FROM_HERE, launch_backoff_, |
| 440 this, &WtsSessionProcessLauncher::LaunchProcess); | 433 this, &WtsSessionProcessLauncher::LaunchProcess); |
| 441 } | 434 } |
| 442 } | 435 } |
| 443 | 436 |
| 444 void WtsSessionProcessLauncher::OnSendSasToConsole() { | |
| 445 DCHECK(main_message_loop_->BelongsToCurrentThread()); | |
| 446 | |
| 447 if (attached_) { | |
| 448 if (sas_injector_.get() == NULL) { | |
| 449 sas_injector_ = SasInjector::Create(); | |
| 450 } | |
| 451 | |
| 452 if (sas_injector_.get() != NULL) { | |
| 453 sas_injector_->InjectSas(); | |
| 454 } | |
| 455 } | |
| 456 } | |
| 457 | |
| 458 } // namespace remoting | 437 } // namespace remoting |
| OLD | NEW |