summaryrefslogtreecommitdiffstats
path: root/jingle/glue/xmpp_client_socket_factory.h
blob: 986ede0cfa200ecdfc219938f39010ed91070d83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef JINGLE_GLUE_XMPP_CLIENT_SOCKET_FACTORY_H_
#define JINGLE_GLUE_XMPP_CLIENT_SOCKET_FACTORY_H_

#include <string>

#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "jingle/glue/resolving_client_socket_factory.h"
#include "net/ssl/ssl_config_service.h"

namespace net {
class ClientSocketFactory;
class ClientSocketHandle;
class HostPortPair;
class SSLClientSocket;
class StreamSocket;
class URLRequestContextGetter;
}  // namespace net

namespace jingle_glue {

class XmppClientSocketFactory : public ResolvingClientSocketFactory {
 public:
  // Does not take ownership of |client_socket_factory|.
  XmppClientSocketFactory(
      net::ClientSocketFactory* client_socket_factory,
      const net::SSLConfig& ssl_config,
      const scoped_refptr<net::URLRequestContextGetter>& request_context_getter,
      bool use_fake_ssl_client_socket);

  ~XmppClientSocketFactory() override;

  // ResolvingClientSocketFactory implementation.
  scoped_ptr<net::StreamSocket> CreateTransportClientSocket(
      const net::HostPortPair& host_and_port) override;

  scoped_ptr<net::SSLClientSocket> CreateSSLClientSocket(
      scoped_ptr<net::ClientSocketHandle> transport_socket,
      const net::HostPortPair& host_and_port) override;

 private:
  net::ClientSocketFactory* const client_socket_factory_;
  scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
  const net::SSLConfig ssl_config_;
  const bool use_fake_ssl_client_socket_;

  DISALLOW_COPY_AND_ASSIGN(XmppClientSocketFactory);
};

}  // namespace jingle_glue

#endif  // JINGLE_GLUE_XMPP_CLIENT_SOCKET_FACTORY_H_