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/fake_remote_security_key_ipc_server.h" | 5 #include "remoting/host/security_key/fake_remote_security_key_ipc_server.h" |
6 | 6 |
| 7 #include <memory> |
| 8 |
7 #include "base/callback.h" | 9 #include "base/callback.h" |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/ptr_util.h" |
10 #include "ipc/ipc_channel.h" | 12 #include "ipc/ipc_channel.h" |
11 #include "ipc/ipc_message.h" | 13 #include "ipc/ipc_message.h" |
12 #include "ipc/ipc_message_macros.h" | 14 #include "ipc/ipc_message_macros.h" |
13 #include "remoting/host/chromoting_messages.h" | 15 #include "remoting/host/chromoting_messages.h" |
14 #include "remoting/host/security_key/gnubby_auth_handler.h" | 16 #include "remoting/host/security_key/gnubby_auth_handler.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
16 | 18 |
17 namespace remoting { | 19 namespace remoting { |
18 | 20 |
19 FakeRemoteSecurityKeyIpcServer::FakeRemoteSecurityKeyIpcServer( | 21 FakeRemoteSecurityKeyIpcServer::FakeRemoteSecurityKeyIpcServer( |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 92 |
91 FakeRemoteSecurityKeyIpcServerFactory::FakeRemoteSecurityKeyIpcServerFactory() { | 93 FakeRemoteSecurityKeyIpcServerFactory::FakeRemoteSecurityKeyIpcServerFactory() { |
92 RemoteSecurityKeyIpcServer::SetFactoryForTest(this); | 94 RemoteSecurityKeyIpcServer::SetFactoryForTest(this); |
93 } | 95 } |
94 | 96 |
95 FakeRemoteSecurityKeyIpcServerFactory:: | 97 FakeRemoteSecurityKeyIpcServerFactory:: |
96 ~FakeRemoteSecurityKeyIpcServerFactory() { | 98 ~FakeRemoteSecurityKeyIpcServerFactory() { |
97 RemoteSecurityKeyIpcServer::SetFactoryForTest(nullptr); | 99 RemoteSecurityKeyIpcServer::SetFactoryForTest(nullptr); |
98 } | 100 } |
99 | 101 |
100 scoped_ptr<RemoteSecurityKeyIpcServer> | 102 std::unique_ptr<RemoteSecurityKeyIpcServer> |
101 FakeRemoteSecurityKeyIpcServerFactory::Create( | 103 FakeRemoteSecurityKeyIpcServerFactory::Create( |
102 int connection_id, | 104 int connection_id, |
103 base::TimeDelta initial_connect_timeout, | 105 base::TimeDelta initial_connect_timeout, |
104 const GnubbyAuthHandler::SendMessageCallback& send_message_callback, | 106 const GnubbyAuthHandler::SendMessageCallback& send_message_callback, |
105 const base::Closure& done_callback) { | 107 const base::Closure& done_callback) { |
106 scoped_ptr<FakeRemoteSecurityKeyIpcServer> fake_ipc_server( | 108 std::unique_ptr<FakeRemoteSecurityKeyIpcServer> fake_ipc_server( |
107 new FakeRemoteSecurityKeyIpcServer(connection_id, initial_connect_timeout, | 109 new FakeRemoteSecurityKeyIpcServer(connection_id, initial_connect_timeout, |
108 send_message_callback, done_callback)); | 110 send_message_callback, done_callback)); |
109 | 111 |
110 ipc_server_map_[connection_id] = fake_ipc_server->AsWeakPtr(); | 112 ipc_server_map_[connection_id] = fake_ipc_server->AsWeakPtr(); |
111 | 113 |
112 return make_scoped_ptr(fake_ipc_server.release()); | 114 return base::WrapUnique(fake_ipc_server.release()); |
113 } | 115 } |
114 | 116 |
115 base::WeakPtr<FakeRemoteSecurityKeyIpcServer> | 117 base::WeakPtr<FakeRemoteSecurityKeyIpcServer> |
116 FakeRemoteSecurityKeyIpcServerFactory::GetIpcServerObject(int connection_id) { | 118 FakeRemoteSecurityKeyIpcServerFactory::GetIpcServerObject(int connection_id) { |
117 return ipc_server_map_[connection_id]; | 119 return ipc_server_map_[connection_id]; |
118 } | 120 } |
119 | 121 |
120 } // namespace remoting | 122 } // namespace remoting |
OLD | NEW |