OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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/gnubby_connection_factory.h" |
| 6 |
| 7 #include "base/lazy_instance.h" |
| 8 #include "remoting/host/gnubby_auth_handler.h" |
| 9 #include "remoting/host/gnubby_connection.h" |
| 10 |
| 11 namespace remoting { |
| 12 |
| 13 namespace { |
| 14 |
| 15 class DefaultGnubbyConnectionFactory : public GnubbyConnectionFactory { |
| 16 public: |
| 17 DefaultGnubbyConnectionFactory(); |
| 18 virtual ~DefaultGnubbyConnectionFactory(); |
| 19 |
| 20 virtual GnubbyConnection* Create( |
| 21 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
| 22 GnubbyAuthHandler* auth_handler, |
| 23 int connection_id, |
| 24 net::StreamSocket* socket); |
| 25 |
| 26 private: |
| 27 DISALLOW_COPY_AND_ASSIGN(DefaultGnubbyConnectionFactory); |
| 28 }; |
| 29 |
| 30 DefaultGnubbyConnectionFactory::DefaultGnubbyConnectionFactory() {} |
| 31 |
| 32 DefaultGnubbyConnectionFactory::~DefaultGnubbyConnectionFactory() {} |
| 33 |
| 34 GnubbyConnection* DefaultGnubbyConnectionFactory::Create( |
| 35 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
| 36 GnubbyAuthHandler* auth_handler, |
| 37 int connection_id, |
| 38 net::StreamSocket* socket) { |
| 39 return new GnubbyConnection( |
| 40 network_task_runner, auth_handler, connection_id, socket); |
| 41 } |
| 42 |
| 43 } // namespace |
| 44 |
| 45 // The default GnubbyConnectionFactory instance. |
| 46 static base::LazyInstance<DefaultGnubbyConnectionFactory> g_default_factory_ = |
| 47 LAZY_INSTANCE_INITIALIZER; |
| 48 |
| 49 GnubbyConnectionFactory::GnubbyConnectionFactory() {} |
| 50 |
| 51 GnubbyConnectionFactory::~GnubbyConnectionFactory() {} |
| 52 |
| 53 // static |
| 54 GnubbyConnectionFactory* GnubbyConnectionFactory::GetDefaultFactory() { |
| 55 return &g_default_factory_.Get(); |
| 56 } |
| 57 |
| 58 } // namespace remoting |
OLD | NEW |