OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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) |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // | 100 // |
101 // Examples: | 101 // Examples: |
102 // "PROXY foopy:19" {scheme=HTTP, host="foopy", port=19} | 102 // "PROXY foopy:19" {scheme=HTTP, host="foopy", port=19} |
103 // "DIRECT" {scheme=DIRECT} | 103 // "DIRECT" {scheme=DIRECT} |
104 // "SOCKS5 foopy" {scheme=SOCKS5, host="foopy", port=1080} | 104 // "SOCKS5 foopy" {scheme=SOCKS5, host="foopy", port=1080} |
105 // "BLAH xxx:xx" INVALID | 105 // "BLAH xxx:xx" INVALID |
106 static ProxyServer FromPacString(const std::string& pac_string); | 106 static ProxyServer FromPacString(const std::string& pac_string); |
107 static ProxyServer FromPacString(std::string::const_iterator pac_string_begin, | 107 static ProxyServer FromPacString(std::string::const_iterator pac_string_begin, |
108 std::string::const_iterator pac_string_end); | 108 std::string::const_iterator pac_string_end); |
109 | 109 |
| 110 // Returns a ProxyServer representing DIRECT connections. |
| 111 static ProxyServer Direct() { |
| 112 return ProxyServer(SCHEME_DIRECT, std::string(), -1); |
| 113 } |
| 114 |
110 #if defined(OS_MACOSX) | 115 #if defined(OS_MACOSX) |
111 // Utility function to pull out a host/port pair from a dictionary and return | 116 // Utility function to pull out a host/port pair from a dictionary and return |
112 // it as a ProxyServer object. Pass in a dictionary that has a value for the | 117 // it as a ProxyServer object. Pass in a dictionary that has a value for the |
113 // host key and optionally a value for the port key. In the error condition | 118 // host key and optionally a value for the port key. In the error condition |
114 // where the host value is especially malformed, returns an invalid | 119 // where the host value is especially malformed, returns an invalid |
115 // ProxyServer. | 120 // ProxyServer. |
116 static ProxyServer FromDictionary(Scheme scheme, | 121 static ProxyServer FromDictionary(Scheme scheme, |
117 CFDictionaryRef dict, | 122 CFDictionaryRef dict, |
118 CFStringRef host_key, | 123 CFStringRef host_key, |
119 CFStringRef port_key); | 124 CFStringRef port_key); |
(...skipping 22 matching lines...) Expand all Loading... |
142 std::string::const_iterator host_and_port_end); | 147 std::string::const_iterator host_and_port_end); |
143 | 148 |
144 Scheme scheme_; | 149 Scheme scheme_; |
145 std::string host_; | 150 std::string host_; |
146 int port_; | 151 int port_; |
147 }; | 152 }; |
148 | 153 |
149 } // namespace net | 154 } // namespace net |
150 | 155 |
151 #endif // NET_PROXY_PROXY_SERVER_H_ | 156 #endif // NET_PROXY_PROXY_SERVER_H_ |
OLD | NEW |