| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 } | 159 } |
| 160 | 160 |
| 161 if (i != active_connections_.end()) { | 161 if (i != active_connections_.end()) { |
| 162 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_SetScreenResolution( | 162 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_SetScreenResolution( |
| 163 i->first, resolution)); | 163 i->first, resolution)); |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| 167 void IpcDesktopEnvironmentFactory::OnDesktopSessionAgentAttached( | 167 void IpcDesktopEnvironmentFactory::OnDesktopSessionAgentAttached( |
| 168 int terminal_id, | 168 int terminal_id, |
| 169 int session_id, |
| 169 const IPC::ChannelHandle& desktop_pipe) { | 170 const IPC::ChannelHandle& desktop_pipe) { |
| 170 if (!caller_task_runner_->BelongsToCurrentThread()) { | 171 if (!caller_task_runner_->BelongsToCurrentThread()) { |
| 171 caller_task_runner_->PostTask( | 172 caller_task_runner_->PostTask( |
| 172 FROM_HERE, | 173 FROM_HERE, |
| 173 base::Bind(&IpcDesktopEnvironmentFactory::OnDesktopSessionAgentAttached, | 174 base::Bind(&IpcDesktopEnvironmentFactory::OnDesktopSessionAgentAttached, |
| 174 base::Unretained(this), terminal_id, desktop_pipe)); | 175 base::Unretained(this), terminal_id, session_id, |
| 176 desktop_pipe)); |
| 175 return; | 177 return; |
| 176 } | 178 } |
| 177 | 179 |
| 178 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id); | 180 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id); |
| 179 if (i != active_connections_.end()) { | 181 if (i != active_connections_.end()) { |
| 180 i->second->DetachFromDesktop(); | 182 i->second->DetachFromDesktop(); |
| 181 i->second->AttachToDesktop(desktop_pipe); | 183 i->second->AttachToDesktop(desktop_pipe, session_id); |
| 182 } else { | 184 } else { |
| 183 mojo::ScopedMessagePipeHandle closer(desktop_pipe.mojo_handle); | 185 mojo::ScopedMessagePipeHandle closer(desktop_pipe.mojo_handle); |
| 184 } | 186 } |
| 185 } | 187 } |
| 186 | 188 |
| 187 void IpcDesktopEnvironmentFactory::OnTerminalDisconnected(int terminal_id) { | 189 void IpcDesktopEnvironmentFactory::OnTerminalDisconnected(int terminal_id) { |
| 188 if (!caller_task_runner_->BelongsToCurrentThread()) { | 190 if (!caller_task_runner_->BelongsToCurrentThread()) { |
| 189 caller_task_runner_->PostTask(FROM_HERE, base::Bind( | 191 caller_task_runner_->PostTask(FROM_HERE, base::Bind( |
| 190 &IpcDesktopEnvironmentFactory::OnTerminalDisconnected, | 192 &IpcDesktopEnvironmentFactory::OnTerminalDisconnected, |
| 191 base::Unretained(this), terminal_id)); | 193 base::Unretained(this), terminal_id)); |
| 192 return; | 194 return; |
| 193 } | 195 } |
| 194 | 196 |
| 195 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id); | 197 ActiveConnectionsList::iterator i = active_connections_.find(terminal_id); |
| 196 if (i != active_connections_.end()) { | 198 if (i != active_connections_.end()) { |
| 197 DesktopSessionProxy* desktop_session_proxy = i->second; | 199 DesktopSessionProxy* desktop_session_proxy = i->second; |
| 198 active_connections_.erase(i); | 200 active_connections_.erase(i); |
| 199 | 201 |
| 200 // Disconnect the client session. | 202 // Disconnect the client session. |
| 201 desktop_session_proxy->DisconnectSession(protocol::OK); | 203 desktop_session_proxy->DisconnectSession(protocol::OK); |
| 202 } | 204 } |
| 203 } | 205 } |
| 204 | 206 |
| 205 } // namespace remoting | 207 } // namespace remoting |
| OLD | NEW |