Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: net/proxy/proxy_server.h

Issue 6450006: Migrate Proxy Settings API to net::ProxyServer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/out/Debug
Patch Set: Nits Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 CFStringRef port_key); 121 CFStringRef port_key);
122 #endif 122 #endif
123 123
124 // Formats as a PAC result entry. This does the reverse of FromPacString(). 124 // Formats as a PAC result entry. This does the reverse of FromPacString().
125 std::string ToPacString() const; 125 std::string ToPacString() const;
126 126
127 // Returns the default port number for a proxy server with the specified 127 // Returns the default port number for a proxy server with the specified
128 // scheme. Returns -1 if unknown. 128 // scheme. Returns -1 if unknown.
129 static int GetDefaultPortForScheme(Scheme scheme); 129 static int GetDefaultPortForScheme(Scheme scheme);
130 130
131 // Parse the proxy scheme from a URL-like representation, to a
eroman 2011/02/09 05:12:46 nit: please use passive tense, as in "Parses"
battre 2011/02/09 10:04:38 Done.
132 // ProxyServer::Scheme. This corresponds with the values used in
133 // ProxyServer::ToURI(). If no type could be matched, returns SCHEME_INVALID.
134 // |scheme| can be one from http, https, socks, socks4, socks5, direct.
eroman 2011/02/09 05:12:46 nit: "from" ---> "of"
battre 2011/02/09 10:04:38 Done.
135 static Scheme GetSchemeFromURI(const std::string& scheme);
136
131 bool operator==(const ProxyServer& other) const { 137 bool operator==(const ProxyServer& other) const {
132 return scheme_ == other.scheme_ && 138 return scheme_ == other.scheme_ &&
133 host_port_pair_.Equals(other.host_port_pair_); 139 host_port_pair_.Equals(other.host_port_pair_);
134 } 140 }
135 141
136 // Comparator function so this can be placed in a std::map. 142 // Comparator function so this can be placed in a std::map.
137 bool operator<(const ProxyServer& other) const { 143 bool operator<(const ProxyServer& other) const {
138 if (scheme_ != other.scheme_) 144 if (scheme_ != other.scheme_)
139 return scheme_ < other.scheme_; 145 return scheme_ < other.scheme_;
140 return host_port_pair_ < other.host_port_pair_; 146 return host_port_pair_ < other.host_port_pair_;
141 } 147 }
142 148
143 private: 149 private:
144 // Creates a ProxyServer given a scheme, and host/port string. If parsing the 150 // Creates a ProxyServer given a scheme, and host/port string. If parsing the
145 // host/port string fails, the returned instance will be invalid. 151 // host/port string fails, the returned instance will be invalid.
146 static ProxyServer FromSchemeHostAndPort( 152 static ProxyServer FromSchemeHostAndPort(
147 Scheme scheme, 153 Scheme scheme,
148 std::string::const_iterator host_and_port_begin, 154 std::string::const_iterator host_and_port_begin,
149 std::string::const_iterator host_and_port_end); 155 std::string::const_iterator host_and_port_end);
150 156
151 Scheme scheme_; 157 Scheme scheme_;
152 HostPortPair host_port_pair_; 158 HostPortPair host_port_pair_;
153 }; 159 };
154 160
155 } // namespace net 161 } // namespace net
156 162
157 #endif // NET_PROXY_PROXY_SERVER_H_ 163 #endif // NET_PROXY_PROXY_SERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698