OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef NET_PROXY_PROXY_SERVER_H_ | 5 #ifndef NET_PROXY_PROXY_SERVER_H_ |
6 #define NET_PROXY_PROXY_SERVER_H_ | 6 #define NET_PROXY_PROXY_SERVER_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(OS_MACOSX) | 10 #if defined(OS_MACOSX) |
11 #include <CoreFoundation/CoreFoundation.h> | 11 #include <CoreFoundation/CoreFoundation.h> |
12 #endif | 12 #endif |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 #include "net/base/host_port_pair.h" | 15 #include "net/base/host_port_pair.h" |
16 #include "net/base/net_export.h" | 16 #include "net/base/net_export.h" |
17 | 17 |
18 namespace net { | 18 namespace net { |
19 | 19 |
20 // ProxyServer encodes the {type, host, port} of a proxy server. | 20 // ProxyServer encodes the {type, host, port} of a proxy server. |
21 // ProxyServer is immutable. | 21 // ProxyServer is immutable. |
22 class NET_EXPORT ProxyServer { | 22 class NET_EXPORT ProxyServer { |
23 public: | 23 public: |
24 // The type of proxy. These are defined as bit flags so they can be ORed | 24 // The type of proxy. These are defined as bit flags so they can be ORed |
25 // together to pass as the |scheme_bit_field| argument to | 25 // together to pass as the |scheme_bit_field| argument to |
26 // ProxyService::RemoveProxiesWithoutScheme(). | 26 // ProxyService::RemoveProxiesWithoutScheme(). |
27 enum Scheme { | 27 enum Scheme { |
28 SCHEME_INVALID = 1 << 0, | 28 SCHEME_INVALID = 1 << 0, |
29 SCHEME_DIRECT = 1 << 1, | 29 SCHEME_DIRECT = 1 << 1, |
30 SCHEME_HTTP = 1 << 2, | 30 SCHEME_HTTP = 1 << 2, |
31 SCHEME_SOCKS4 = 1 << 3, | 31 SCHEME_SOCKS4 = 1 << 3, |
32 SCHEME_SOCKS5 = 1 << 4, | 32 SCHEME_SOCKS5 = 1 << 4, |
33 SCHEME_HTTPS = 1 << 5, | 33 SCHEME_HTTPS = 1 << 5, |
34 // A QUIC proxy is an HTTP proxy in which QUIC is used as the transport, | 34 // A QUIC proxy is an HTTP proxy in which QUIC is used as the transport, |
35 // instead of TCP. | 35 // instead of TCP. |
36 SCHEME_QUIC = 1 << 6, | 36 SCHEME_QUIC = 1 << 6, |
37 }; | 37 }; |
38 | 38 |
39 // Default copy-constructor and assignment operator are OK! | 39 // Default copy-constructor and assignment operator are OK! |
40 | 40 |
41 // Constructs an invalid ProxyServer. | 41 // Constructs an invalid ProxyServer. |
42 ProxyServer() : scheme_(SCHEME_INVALID) {} | 42 ProxyServer() : scheme_(SCHEME_INVALID) {} |
43 | 43 |
44 ProxyServer(Scheme scheme, const HostPortPair& host_port_pair); | 44 ProxyServer(Scheme scheme, const HostPortPair& host_port_pair); |
45 | 45 |
46 bool is_valid() const { return scheme_ != SCHEME_INVALID; } | 46 bool is_valid() const { return scheme_ != SCHEME_INVALID; } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 Scheme scheme_; | 173 Scheme scheme_; |
174 HostPortPair host_port_pair_; | 174 HostPortPair host_port_pair_; |
175 }; | 175 }; |
176 | 176 |
177 typedef std::pair<HostPortPair, ProxyServer> HostPortProxyPair; | 177 typedef std::pair<HostPortPair, ProxyServer> HostPortProxyPair; |
178 | 178 |
179 } // namespace net | 179 } // namespace net |
180 | 180 |
181 #endif // NET_PROXY_PROXY_SERVER_H_ | 181 #endif // NET_PROXY_PROXY_SERVER_H_ |
OLD | NEW |