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