| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 // Returns the default port number for a proxy server with the specified | 126 // Returns the default port number for a proxy server with the specified |
| 127 // scheme. Returns -1 if unknown. | 127 // scheme. Returns -1 if unknown. |
| 128 static int GetDefaultPortForScheme(Scheme scheme); | 128 static int GetDefaultPortForScheme(Scheme scheme); |
| 129 | 129 |
| 130 bool operator==(const ProxyServer& other) const { | 130 bool operator==(const ProxyServer& other) const { |
| 131 return scheme_ == other.scheme_ && | 131 return scheme_ == other.scheme_ && |
| 132 host_port_pair_.Equals(other.host_port_pair_); | 132 host_port_pair_.Equals(other.host_port_pair_); |
| 133 } | 133 } |
| 134 | 134 |
| 135 // Comparator function so this can be placed in a std::map. |
| 136 bool operator<(const ProxyServer& other) const { |
| 137 if (scheme_ != other.scheme_) |
| 138 return scheme_ < other.scheme_; |
| 139 return host_port_pair_ < other.host_port_pair_; |
| 140 } |
| 141 |
| 135 private: | 142 private: |
| 136 // Creates a ProxyServer given a scheme, and host/port string. If parsing the | 143 // Creates a ProxyServer given a scheme, and host/port string. If parsing the |
| 137 // host/port string fails, the returned instance will be invalid. | 144 // host/port string fails, the returned instance will be invalid. |
| 138 static ProxyServer FromSchemeHostAndPort( | 145 static ProxyServer FromSchemeHostAndPort( |
| 139 Scheme scheme, | 146 Scheme scheme, |
| 140 std::string::const_iterator host_and_port_begin, | 147 std::string::const_iterator host_and_port_begin, |
| 141 std::string::const_iterator host_and_port_end); | 148 std::string::const_iterator host_and_port_end); |
| 142 | 149 |
| 143 Scheme scheme_; | 150 Scheme scheme_; |
| 144 HostPortPair host_port_pair_; | 151 HostPortPair host_port_pair_; |
| 145 }; | 152 }; |
| 146 | 153 |
| 147 } // namespace net | 154 } // namespace net |
| 148 | 155 |
| 149 #endif // NET_PROXY_PROXY_SERVER_H_ | 156 #endif // NET_PROXY_PROXY_SERVER_H_ |
| OLD | NEW |