| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/security_key/security_key_auth_handler.h" | 5 #include "remoting/host/security_key/security_key_auth_handler.h" |
| 6 | 6 |
| 7 #include <cstdint> | 7 #include <cstdint> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 } | 274 } |
| 275 if (close_connection) { | 275 if (close_connection) { |
| 276 base::ThreadTaskRunnerHandle::Get()->PostTask( | 276 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 277 FROM_HERE, base::Bind(&SecurityKeyAuthHandlerWin::OnChannelError, | 277 FROM_HERE, base::Bind(&SecurityKeyAuthHandlerWin::OnChannelError, |
| 278 weak_factory_.GetWeakPtr())); | 278 weak_factory_.GetWeakPtr())); |
| 279 return; | 279 return; |
| 280 } | 280 } |
| 281 | 281 |
| 282 int new_connection_id = ++last_connection_id_; | 282 int new_connection_id = ++last_connection_id_; |
| 283 std::unique_ptr<SecurityKeyIpcServer> ipc_server(SecurityKeyIpcServer::Create( | 283 std::unique_ptr<SecurityKeyIpcServer> ipc_server(SecurityKeyIpcServer::Create( |
| 284 new_connection_id, peer_session_id, disconnect_timeout_, | 284 new_connection_id, client_session_details_, disconnect_timeout_, |
| 285 send_message_callback_, | 285 send_message_callback_, |
| 286 base::Bind(&SecurityKeyAuthHandlerWin::CloseSecurityKeyRequestIpcChannel, | 286 base::Bind(&SecurityKeyAuthHandlerWin::CloseSecurityKeyRequestIpcChannel, |
| 287 base::Unretained(this), new_connection_id))); | 287 base::Unretained(this), new_connection_id))); |
| 288 | 288 |
| 289 std::string unique_channel_name = GenerateUniqueChannelName(); | 289 std::string unique_channel_name = GenerateUniqueChannelName(); |
| 290 if (ipc_server->CreateChannel( | 290 if (ipc_server->CreateChannel( |
| 291 unique_channel_name, | 291 unique_channel_name, |
| 292 base::TimeDelta::FromSeconds(kSecurityKeyRequestTimeoutSeconds))) { | 292 base::TimeDelta::FromSeconds(kSecurityKeyRequestTimeoutSeconds))) { |
| 293 active_channels_[new_connection_id] = std::move(ipc_server); | 293 active_channels_[new_connection_id] = std::move(ipc_server); |
| 294 ipc_server_channel_->Send( | 294 ipc_server_channel_->Send( |
| 295 new ChromotingNetworkToRemoteSecurityKeyMsg_ConnectionDetails( | 295 new ChromotingNetworkToRemoteSecurityKeyMsg_ConnectionDetails( |
| 296 unique_channel_name)); | 296 unique_channel_name)); |
| 297 } | 297 } |
| 298 } | 298 } |
| 299 | 299 |
| 300 void SecurityKeyAuthHandlerWin::OnChannelError() { | 300 void SecurityKeyAuthHandlerWin::OnChannelError() { |
| 301 DCHECK(thread_checker_.CalledOnValidThread()); | 301 DCHECK(thread_checker_.CalledOnValidThread()); |
| 302 | 302 |
| 303 // Could be an error, most likely the client disconnected though. Either way | 303 // Could be an error, most likely the client disconnected though. Either way |
| 304 // we should restart the server to prepare for the next connection. | 304 // we should restart the server to prepare for the next connection. |
| 305 RecreateIpcServerChannel(); | 305 RecreateIpcServerChannel(); |
| 306 } | 306 } |
| 307 | 307 |
| 308 } // namespace remoting | 308 } // namespace remoting |
| OLD | NEW |