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

Unified Diff: net/proxy/proxy_server.cc

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 side-by-side diff with in-line comments
Download patch
« net/proxy/proxy_server.h ('K') | « net/proxy/proxy_server.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_server.cc
diff --git a/net/proxy/proxy_server.cc b/net/proxy/proxy_server.cc
index 0bcf89cb8c3e3c8f33269774bf049303598bf87f..c0b491c320e0818037dfd023bfcb75ffacb12b8c 100644
--- a/net/proxy/proxy_server.cc
+++ b/net/proxy/proxy_server.cc
@@ -18,8 +18,9 @@ namespace {
// Parse the proxy type from a PAC string, to a ProxyServer::Scheme.
// This mapping is case-insensitive. If no type could be matched
// returns SCHEME_INVALID.
-ProxyServer::Scheme GetSchemeFromPacType(std::string::const_iterator begin,
- std::string::const_iterator end) {
+ProxyServer::Scheme GetSchemeFromPacTypeInternal(
+ std::string::const_iterator begin,
+ std::string::const_iterator end) {
if (LowerCaseEqualsASCII(begin, end, "proxy"))
return ProxyServer::SCHEME_HTTP;
if (LowerCaseEqualsASCII(begin, end, "socks")) {
@@ -43,8 +44,8 @@ ProxyServer::Scheme GetSchemeFromPacType(std::string::const_iterator begin,
// Parse the proxy scheme from a URL-like representation, to a
// ProxyServer::Scheme. This corresponds with the values used in
// ProxyServer::ToURI(). If no type could be matched, returns SCHEME_INVALID.
-ProxyServer::Scheme GetSchemeFromURI(std::string::const_iterator begin,
- std::string::const_iterator end) {
+ProxyServer::Scheme GetSchemeFromURIInternal(std::string::const_iterator begin,
+ std::string::const_iterator end) {
if (LowerCaseEqualsASCII(begin, end, "http"))
return ProxyServer::SCHEME_HTTP;
if (LowerCaseEqualsASCII(begin, end, "socks4"))
@@ -110,7 +111,7 @@ ProxyServer ProxyServer::FromURI(std::string::const_iterator begin,
(end - colon) >= 3 &&
*(colon + 1) == '/' &&
*(colon + 2) == '/') {
- scheme = GetSchemeFromURI(begin, colon);
+ scheme = GetSchemeFromURIInternal(begin, colon);
begin = colon + 3; // Skip past the "://"
}
@@ -161,7 +162,7 @@ ProxyServer ProxyServer::FromPacString(std::string::const_iterator begin,
}
// Everything to the left of the space is the scheme.
- Scheme scheme = GetSchemeFromPacType(begin, space);
+ Scheme scheme = GetSchemeFromPacTypeInternal(begin, space);
// And everything to the right of the space is the
// <host>[":" <port>].
@@ -204,6 +205,11 @@ int ProxyServer::GetDefaultPortForScheme(Scheme scheme) {
}
// static
+ProxyServer::Scheme ProxyServer::GetSchemeFromURI(const std::string& scheme) {
+ return GetSchemeFromURIInternal(scheme.begin(), scheme.end());
+}
+
+// static
ProxyServer ProxyServer::FromSchemeHostAndPort(
Scheme scheme,
std::string::const_iterator begin,
« net/proxy/proxy_server.h ('K') | « net/proxy/proxy_server.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698