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 GnubbyAuthHandler* auth_handler, |
| 22 int connection_id, |
| 23 net::StreamSocket* socket); |
| 24 |
| 25 private: |
| 26 DISALLOW_COPY_AND_ASSIGN(DefaultGnubbyConnectionFactory); |
| 27 }; |
| 28 |
| 29 DefaultGnubbyConnectionFactory::DefaultGnubbyConnectionFactory() {} |
| 30 |
| 31 DefaultGnubbyConnectionFactory::~DefaultGnubbyConnectionFactory() {} |
| 32 |
| 33 GnubbyConnection* DefaultGnubbyConnectionFactory::Create( |
| 34 GnubbyAuthHandler* auth_handler, |
| 35 int connection_id, |
| 36 net::StreamSocket* socket) { |
| 37 return new GnubbyConnection(auth_handler, connection_id, socket); |
| 38 } |
| 39 |
| 40 } // namespace |
| 41 |
| 42 // The default GnubbyConnectionFactory instance. |
| 43 static base::LazyInstance<DefaultGnubbyConnectionFactory> g_default_factory_ = |
| 44 LAZY_INSTANCE_INITIALIZER; |
| 45 |
| 46 GnubbyConnectionFactory::GnubbyConnectionFactory() {} |
| 47 |
| 48 GnubbyConnectionFactory::~GnubbyConnectionFactory() {} |
| 49 |
| 50 // static |
| 51 GnubbyConnectionFactory* GnubbyConnectionFactory::GetDefaultFactory() { |
| 52 return &g_default_factory_.Get(); |
| 53 } |
| 54 |
| 55 } // namespace remoting |
OLD | NEW |