Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(992)

Side by Side Diff: remoting/host/security_key/remote_security_key_ipc_server.cc

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/remote_security_key_ipc_server.h" 5 #include "remoting/host/security_key/remote_security_key_ipc_server.h"
6 6
7 #include <memory>
7 #include <string> 8 #include <string>
8 9
9 #include "base/callback.h" 10 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/ptr_util.h"
11 #include "base/threading/thread_checker.h" 12 #include "base/threading/thread_checker.h"
12 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
13 #include "ipc/ipc_channel.h" 14 #include "ipc/ipc_channel.h"
14 #include "ipc/ipc_message.h" 15 #include "ipc/ipc_message.h"
15 #include "ipc/ipc_message_macros.h" 16 #include "ipc/ipc_message_macros.h"
16 #include "remoting/base/logging.h" 17 #include "remoting/base/logging.h"
17 #include "remoting/host/chromoting_messages.h" 18 #include "remoting/host/chromoting_messages.h"
18 #include "remoting/host/security_key/remote_security_key_ipc_server_impl.h" 19 #include "remoting/host/security_key/remote_security_key_ipc_server_impl.h"
19 20
20 namespace { 21 namespace {
21 22
22 // Not thread safe, tests which set this value must do so on the same thread. 23 // Not thread safe, tests which set this value must do so on the same thread.
23 static remoting::RemoteSecurityKeyIpcServerFactory* g_factory = nullptr; 24 static remoting::RemoteSecurityKeyIpcServerFactory* g_factory = nullptr;
24 25
25 } // namespace 26 } // namespace
26 27
27 namespace remoting { 28 namespace remoting {
28 29
29 void RemoteSecurityKeyIpcServer::SetFactoryForTest( 30 void RemoteSecurityKeyIpcServer::SetFactoryForTest(
30 RemoteSecurityKeyIpcServerFactory* factory) { 31 RemoteSecurityKeyIpcServerFactory* factory) {
31 g_factory = factory; 32 g_factory = factory;
32 } 33 }
33 34
34 scoped_ptr<RemoteSecurityKeyIpcServer> RemoteSecurityKeyIpcServer::Create( 35 std::unique_ptr<RemoteSecurityKeyIpcServer> RemoteSecurityKeyIpcServer::Create(
35 int connection_id, 36 int connection_id,
36 base::TimeDelta initial_connect_timeout, 37 base::TimeDelta initial_connect_timeout,
37 const GnubbyAuthHandler::SendMessageCallback& message_callback, 38 const GnubbyAuthHandler::SendMessageCallback& message_callback,
38 const base::Closure& done_callback) { 39 const base::Closure& done_callback) {
39 scoped_ptr<RemoteSecurityKeyIpcServer> ipc_server = 40 std::unique_ptr<RemoteSecurityKeyIpcServer> ipc_server =
40 g_factory 41 g_factory
41 ? g_factory->Create(connection_id, initial_connect_timeout, 42 ? g_factory->Create(connection_id, initial_connect_timeout,
42 message_callback, done_callback) 43 message_callback, done_callback)
43 : make_scoped_ptr(new RemoteSecurityKeyIpcServerImpl( 44 : base::WrapUnique(new RemoteSecurityKeyIpcServerImpl(
44 connection_id, initial_connect_timeout, message_callback, 45 connection_id, initial_connect_timeout, message_callback,
45 done_callback)); 46 done_callback));
46 47
47 return ipc_server; 48 return ipc_server;
48 } 49 }
49 50
50 } // namespace remoting 51 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698