| OLD | NEW | 
|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "net/proxy/proxy_config.h" | 5 #include "net/proxy/proxy_config.h" | 
| 6 | 6 | 
| 7 #include "base/string_tokenizer.h" | 7 #include "base/string_tokenizer.h" | 
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" | 
| 9 | 9 | 
| 10 namespace net { | 10 namespace net { | 
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 84 namespace { | 84 namespace { | 
| 85 | 85 | 
| 86 // Helper to stringize a ProxyServer. | 86 // Helper to stringize a ProxyServer. | 
| 87 std::ostream& operator<<(std::ostream& out, | 87 std::ostream& operator<<(std::ostream& out, | 
| 88                          const net::ProxyServer& proxy_server) { | 88                          const net::ProxyServer& proxy_server) { | 
| 89   if (proxy_server.is_valid()) | 89   if (proxy_server.is_valid()) | 
| 90     out << proxy_server.ToURI(); | 90     out << proxy_server.ToURI(); | 
| 91   return out; | 91   return out; | 
| 92 } | 92 } | 
| 93 | 93 | 
| 94 // Helper to stringize a ProxyRules. | 94 }  // namespace | 
|  | 95 | 
| 95 std::ostream& operator<<(std::ostream& out, | 96 std::ostream& operator<<(std::ostream& out, | 
| 96                          const net::ProxyConfig::ProxyRules& rules) { | 97                          const net::ProxyConfig::ProxyRules& rules) { | 
| 97   // Stringize the type enum. | 98   // Stringize the type enum. | 
| 98   std::string type; | 99   std::string type; | 
| 99   switch (rules.type) { | 100   switch (rules.type) { | 
| 100     case net::ProxyConfig::ProxyRules::TYPE_NO_RULES: | 101     case net::ProxyConfig::ProxyRules::TYPE_NO_RULES: | 
| 101       type = "TYPE_NO_RULES"; | 102       type = "TYPE_NO_RULES"; | 
| 102       break; | 103       break; | 
| 103     case net::ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME: | 104     case net::ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME: | 
| 104       type = "TYPE_PROXY_PER_SCHEME"; | 105       type = "TYPE_PROXY_PER_SCHEME"; | 
| 105       break; | 106       break; | 
| 106     case net::ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY: | 107     case net::ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY: | 
| 107       type = "TYPE_SINGLE_PROXY"; | 108       type = "TYPE_SINGLE_PROXY"; | 
| 108       break; | 109       break; | 
| 109     default: | 110     default: | 
| 110       type = IntToString(rules.type); | 111       type = IntToString(rules.type); | 
| 111       break; | 112       break; | 
| 112   } | 113   } | 
| 113   return out << "  {\n" | 114   return out << "  {\n" | 
| 114              << "    type: " << type << "\n" | 115              << "    type: " << type << "\n" | 
| 115              << "    single_proxy: " << rules.single_proxy << "\n" | 116              << "    single_proxy: " << rules.single_proxy << "\n" | 
| 116              << "    proxy_for_http: " << rules.proxy_for_http << "\n" | 117              << "    proxy_for_http: " << rules.proxy_for_http << "\n" | 
| 117              << "    proxy_for_https: " << rules.proxy_for_https << "\n" | 118              << "    proxy_for_https: " << rules.proxy_for_https << "\n" | 
| 118              << "    proxy_for_ftp: " << rules.proxy_for_ftp << "\n" | 119              << "    proxy_for_ftp: " << rules.proxy_for_ftp << "\n" | 
| 119              << "  }"; | 120              << "  }"; | 
| 120 } | 121 } | 
| 121 | 122 | 
| 122 }  // namespace |  | 
| 123 |  | 
| 124 std::ostream& operator<<(std::ostream& out, const net::ProxyConfig& config) { | 123 std::ostream& operator<<(std::ostream& out, const net::ProxyConfig& config) { | 
| 125   out << "{\n" | 124   out << "{\n" | 
| 126       << "  auto_detect: " << config.auto_detect << "\n" | 125       << "  auto_detect: " << config.auto_detect << "\n" | 
| 127       << "  pac_url: " << config.pac_url << "\n" | 126       << "  pac_url: " << config.pac_url << "\n" | 
| 128       << "  proxy_rules:\n" << config.proxy_rules << "\n" | 127       << "  proxy_rules:\n" << config.proxy_rules << "\n" | 
| 129       << "  proxy_bypass_local_names: " << config.proxy_bypass_local_names | 128       << "  proxy_bypass_local_names: " << config.proxy_bypass_local_names | 
| 130       << "\n" | 129       << "\n" | 
| 131       << "  proxy_bypass_list:\n"; | 130       << "  proxy_bypass_list:\n"; | 
| 132 | 131 | 
| 133   // Print out the proxy bypass list. | 132   // Print out the proxy bypass list. | 
| 134   if (!config.proxy_bypass.empty()) { | 133   if (!config.proxy_bypass.empty()) { | 
| 135     out << "  {\n"; | 134     out << "  {\n"; | 
| 136     std::vector<std::string>::const_iterator it; | 135     std::vector<std::string>::const_iterator it; | 
| 137     for (it = config.proxy_bypass.begin(); | 136     for (it = config.proxy_bypass.begin(); | 
| 138          it != config.proxy_bypass.end(); ++it) { | 137          it != config.proxy_bypass.end(); ++it) { | 
| 139       out << "    " << *it << "\n"; | 138       out << "    " << *it << "\n"; | 
| 140     } | 139     } | 
| 141     out << "  }\n"; | 140     out << "  }\n"; | 
| 142   } | 141   } | 
| 143 | 142 | 
| 144   out << "}"; | 143   out << "}"; | 
| 145   return out; | 144   return out; | 
| 146 } | 145 } | 
| OLD | NEW | 
|---|