OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "remoting/host/security_key/remote_security_key_ipc_server.h" |
| 6 |
| 7 #include <cstdint> |
| 8 #include <memory> |
| 9 #include <string> |
| 10 |
| 11 #include "base/callback.h" |
| 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/threading/thread_checker.h" |
| 14 #include "base/timer/timer.h" |
| 15 #include "ipc/ipc_channel.h" |
| 16 #include "ipc/ipc_message.h" |
| 17 #include "ipc/ipc_message_macros.h" |
| 18 #include "remoting/base/logging.h" |
| 19 #include "remoting/host/chromoting_messages.h" |
| 20 #include "remoting/host/security_key/remote_security_key_ipc_server_impl.h" |
| 21 |
| 22 namespace { |
| 23 |
| 24 // Not thread safe, tests which set this value must do so on the same thread. |
| 25 static remoting::RemoteSecurityKeyIpcServerFactory* g_factory = nullptr; |
| 26 |
| 27 } // namespace |
| 28 |
| 29 namespace remoting { |
| 30 |
| 31 void RemoteSecurityKeyIpcServer::SetFactoryForTest( |
| 32 RemoteSecurityKeyIpcServerFactory* factory) { |
| 33 g_factory = factory; |
| 34 } |
| 35 |
| 36 std::unique_ptr<RemoteSecurityKeyIpcServer> RemoteSecurityKeyIpcServer::Create( |
| 37 int connection_id, |
| 38 uint32_t peer_session_id, |
| 39 base::TimeDelta initial_connect_timeout, |
| 40 const GnubbyAuthHandler::SendMessageCallback& message_callback, |
| 41 const base::Closure& done_callback) { |
| 42 std::unique_ptr<RemoteSecurityKeyIpcServer> ipc_server = |
| 43 g_factory |
| 44 ? g_factory->Create(connection_id, peer_session_id, |
| 45 initial_connect_timeout, message_callback, |
| 46 done_callback) |
| 47 : base::WrapUnique(new RemoteSecurityKeyIpcServerImpl( |
| 48 connection_id, peer_session_id, initial_connect_timeout, |
| 49 message_callback, done_callback)); |
| 50 |
| 51 return ipc_server; |
| 52 } |
| 53 |
| 54 } // namespace remoting |
OLD | NEW |