| 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/ipc_desktop_environment.h" | 5 #include "remoting/host/ipc_desktop_environment.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 &IpcDesktopEnvironmentFactory::OnDesktopSessionAgentAttached, | 192 &IpcDesktopEnvironmentFactory::OnDesktopSessionAgentAttached, |
| 193 base::Unretained(this), terminal_id, desktop_process_handle, | 193 base::Unretained(this), terminal_id, desktop_process_handle, |
| 194 desktop_pipe)); | 194 desktop_pipe)); |
| 195 return; | 195 return; |
| 196 } | 196 } |
| 197 | 197 |
| 198 base::Process desktop_process(desktop_process_handle); | 198 base::Process desktop_process(desktop_process_handle); |
| 199 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id); | 199 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id); |
| 200 if (i != active_connections_.end()) { | 200 if (i != active_connections_.end()) { |
| 201 i->second->DetachFromDesktop(); | 201 i->second->DetachFromDesktop(); |
| 202 i->second->AttachToDesktop(desktop_process.Pass(), desktop_pipe); | 202 i->second->AttachToDesktop(std::move(desktop_process), desktop_pipe); |
| 203 } else { | 203 } else { |
| 204 #if defined(OS_POSIX) | 204 #if defined(OS_POSIX) |
| 205 DCHECK(desktop_pipe.auto_close); | 205 DCHECK(desktop_pipe.auto_close); |
| 206 base::File pipe_closer(IPC::PlatformFileForTransitToFile(desktop_pipe)); | 206 base::File pipe_closer(IPC::PlatformFileForTransitToFile(desktop_pipe)); |
| 207 #endif // defined(OS_POSIX) | 207 #endif // defined(OS_POSIX) |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 void IpcDesktopEnvironmentFactory::OnTerminalDisconnected(int terminal_id) { | 211 void IpcDesktopEnvironmentFactory::OnTerminalDisconnected(int terminal_id) { |
| 212 if (!caller_task_runner_->BelongsToCurrentThread()) { | 212 if (!caller_task_runner_->BelongsToCurrentThread()) { |
| 213 caller_task_runner_->PostTask(FROM_HERE, base::Bind( | 213 caller_task_runner_->PostTask(FROM_HERE, base::Bind( |
| 214 &IpcDesktopEnvironmentFactory::OnTerminalDisconnected, | 214 &IpcDesktopEnvironmentFactory::OnTerminalDisconnected, |
| 215 base::Unretained(this), terminal_id)); | 215 base::Unretained(this), terminal_id)); |
| 216 return; | 216 return; |
| 217 } | 217 } |
| 218 | 218 |
| 219 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id); | 219 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id); |
| 220 if (i != active_connections_.end()) { | 220 if (i != active_connections_.end()) { |
| 221 DesktopSessionProxy* desktop_session_proxy = i->second; | 221 DesktopSessionProxy* desktop_session_proxy = i->second; |
| 222 active_connections_.erase(i); | 222 active_connections_.erase(i); |
| 223 | 223 |
| 224 // Disconnect the client session. | 224 // Disconnect the client session. |
| 225 desktop_session_proxy->DisconnectSession(protocol::OK); | 225 desktop_session_proxy->DisconnectSession(protocol::OK); |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 | 228 |
| 229 } // namespace remoting | 229 } // namespace remoting |
| OLD | NEW |