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/desktop_session_win.h" | 5 #include "remoting/host/desktop_session_win.h" |
6 | 6 |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "ipc/ipc_message_macros.h" | 8 #include "ipc/ipc_message_macros.h" |
9 #include "remoting/base/auto_thread_task_runner.h" | 9 #include "remoting/base/auto_thread_task_runner.h" |
10 #include "remoting/host/chromoting_messages.h" | 10 #include "remoting/host/chromoting_messages.h" |
11 #include "remoting/host/daemon_process.h" | 11 #include "remoting/host/daemon_process.h" |
| 12 #include "remoting/host/sas_injector.h" |
12 #include "remoting/host/win/worker_process_launcher.h" | 13 #include "remoting/host/win/worker_process_launcher.h" |
13 #include "remoting/host/win/wts_console_monitor.h" | 14 #include "remoting/host/win/wts_console_monitor.h" |
14 #include "remoting/host/win/wts_session_process_delegate.h" | 15 #include "remoting/host/win/wts_session_process_delegate.h" |
15 | 16 |
16 using base::win::ScopedHandle; | 17 using base::win::ScopedHandle; |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 const FilePath::CharType kDesktopBinaryName[] = | 21 const FilePath::CharType kDesktopBinaryName[] = |
21 FILE_PATH_LITERAL("remoting_desktop.exe"); | 22 FILE_PATH_LITERAL("remoting_desktop.exe"); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 VLOG(1) << "IPC: daemon <- desktop (" << peer_pid << ")"; | 66 VLOG(1) << "IPC: daemon <- desktop (" << peer_pid << ")"; |
66 } | 67 } |
67 | 68 |
68 bool DesktopSessionWin::OnMessageReceived(const IPC::Message& message) { | 69 bool DesktopSessionWin::OnMessageReceived(const IPC::Message& message) { |
69 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 70 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
70 | 71 |
71 bool handled = true; | 72 bool handled = true; |
72 IPC_BEGIN_MESSAGE_MAP(DesktopSessionWin, message) | 73 IPC_BEGIN_MESSAGE_MAP(DesktopSessionWin, message) |
73 IPC_MESSAGE_HANDLER(ChromotingDesktopDaemonMsg_DesktopAttached, | 74 IPC_MESSAGE_HANDLER(ChromotingDesktopDaemonMsg_DesktopAttached, |
74 OnDesktopSessionAgentAttached) | 75 OnDesktopSessionAgentAttached) |
| 76 IPC_MESSAGE_HANDLER(ChromotingDesktopDaemonMsg_InjectSas, |
| 77 OnInjectSas) |
75 IPC_MESSAGE_UNHANDLED(handled = false) | 78 IPC_MESSAGE_UNHANDLED(handled = false) |
76 IPC_END_MESSAGE_MAP() | 79 IPC_END_MESSAGE_MAP() |
77 return handled; | 80 return handled; |
78 } | 81 } |
79 | 82 |
80 void DesktopSessionWin::OnPermanentError() { | 83 void DesktopSessionWin::OnPermanentError() { |
81 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 84 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
82 | 85 |
83 launcher_.reset(); | 86 launcher_.reset(); |
84 | 87 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 124 |
122 void DesktopSessionWin::OnDesktopSessionAgentAttached( | 125 void DesktopSessionWin::OnDesktopSessionAgentAttached( |
123 IPC::PlatformFileForTransit desktop_pipe) { | 126 IPC::PlatformFileForTransit desktop_pipe) { |
124 if (!daemon_process()->OnDesktopSessionAgentAttached(id(), | 127 if (!daemon_process()->OnDesktopSessionAgentAttached(id(), |
125 desktop_process_, | 128 desktop_process_, |
126 desktop_pipe)) { | 129 desktop_pipe)) { |
127 RestartDesktopProcess(FROM_HERE); | 130 RestartDesktopProcess(FROM_HERE); |
128 } | 131 } |
129 } | 132 } |
130 | 133 |
| 134 void DesktopSessionWin::OnInjectSas() { |
| 135 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 136 |
| 137 // Do not try to inject SAS if the desktop process is not running. This can |
| 138 // happen when the session has detached from the console for instance. |
| 139 if (!launcher_) |
| 140 return; |
| 141 |
| 142 if (!sas_injector_) |
| 143 sas_injector_ = SasInjector::Create(); |
| 144 if (!sas_injector_->InjectSas()) |
| 145 LOG(ERROR) << "Failed to inject Secure Attention Sequence."; |
| 146 } |
| 147 |
131 void DesktopSessionWin::RestartDesktopProcess( | 148 void DesktopSessionWin::RestartDesktopProcess( |
132 const tracked_objects::Location& location) { | 149 const tracked_objects::Location& location) { |
133 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 150 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
134 | 151 |
135 launcher_->Send(new ChromotingDaemonDesktopMsg_Crash( | 152 launcher_->Send(new ChromotingDaemonDesktopMsg_Crash( |
136 location.function_name(), location.file_name(), location.line_number())); | 153 location.function_name(), location.file_name(), location.line_number())); |
137 } | 154 } |
138 | 155 |
139 } // namespace remoting | 156 } // namespace remoting |
OLD | NEW |