blob: 13f3fa783ed33801796598047ba77779e09cacfa (
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
// Copyright (c) 2010 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 NET_HTTP_HTTP_NETWORK_SESSION_PEER_H_
#define NET_HTTP_HTTP_NETWORK_SESSION_PEER_H_
#pragma once
#include "net/http/http_network_session.h"
#include "net/http/http_proxy_client_socket_pool.h"
#include "net/socket/socks_client_socket_pool.h"
#include "net/socket/ssl_client_socket_pool.h"
namespace net {
class HttpNetworkSessionPeer {
public:
explicit HttpNetworkSessionPeer(
const scoped_refptr<HttpNetworkSession>& session)
: session_(session) {}
void SetTCPSocketPool(TCPClientSocketPool* pool) {
session_->socket_pool_manager_.tcp_socket_pool_.reset(pool);
}
void SetSocketPoolForSOCKSProxy(
const HostPortPair& socks_proxy,
SOCKSClientSocketPool* pool) {
ClientSocketPoolManager* socket_pool_manager =
&session_->socket_pool_manager_;
// Call through the public interface to force initialization of the
// wrapped socket pools.
delete socket_pool_manager->GetSocketPoolForSOCKSProxy(socks_proxy);
socket_pool_manager->socks_socket_pools_[socks_proxy] = pool;
}
void SetSocketPoolForHTTPProxy(
const HostPortPair& http_proxy,
HttpProxyClientSocketPool* pool) {
ClientSocketPoolManager* socket_pool_manager =
&session_->socket_pool_manager_;
// Call through the public interface to force initialization of the
// wrapped socket pools.
delete socket_pool_manager->GetSocketPoolForHTTPProxy(http_proxy);
socket_pool_manager->http_proxy_socket_pools_[http_proxy] = pool;
}
void SetSSLSocketPool(SSLClientSocketPool* pool) {
session_->socket_pool_manager_.ssl_socket_pool_.reset(pool);
}
void SetSocketPoolForSSLWithProxy(
const HostPortPair& proxy_host,
SSLClientSocketPool* pool) {
ClientSocketPoolManager* socket_pool_manager =
&session_->socket_pool_manager_;
// Call through the public interface to force initialization of the
// wrapped socket pools.
delete socket_pool_manager->GetSocketPoolForSSLWithProxy(proxy_host);
socket_pool_manager->ssl_socket_pools_for_proxies_[proxy_host] = pool;
}
void SetProxyService(ProxyService* proxy_service) {
session_->proxy_service_ = proxy_service;
}
private:
const scoped_refptr<HttpNetworkSession> session_;
DISALLOW_COPY_AND_ASSIGN(HttpNetworkSessionPeer);
};
} // namespace net
#endif // NET_HTTP_HTTP_NETWORK_SESSION_PEER_H_
|