| 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_list.h" | 5 #include "net/proxy/proxy_list.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_tokenizer.h" | 8 #include "base/string_tokenizer.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 | 10 |
| 11 using base::TimeDelta; | 11 using base::TimeDelta; |
| 12 using base::TimeTicks; | 12 using base::TimeTicks; |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 | 15 |
| 16 void ProxyList::Set(const std::string& proxy_uri_list) { | 16 void ProxyList::Set(const std::string& proxy_uri_list) { |
| 17 proxies_.clear(); | 17 proxies_.clear(); |
| 18 StringTokenizer str_tok(proxy_uri_list, ";"); | 18 StringTokenizer str_tok(proxy_uri_list, ";"); |
| 19 while (str_tok.GetNext()) { | 19 while (str_tok.GetNext()) { |
| 20 ProxyServer uri = ProxyServer::FromURI( | 20 ProxyServer uri = ProxyServer::FromURI( |
| 21 str_tok.token_begin(), str_tok.token_end()); | 21 str_tok.token_begin(), str_tok.token_end(), ProxyServer::SCHEME_HTTP); |
| 22 // Silently discard malformed inputs. | 22 // Silently discard malformed inputs. |
| 23 if (uri.is_valid()) | 23 if (uri.is_valid()) |
| 24 proxies_.push_back(uri); | 24 proxies_.push_back(uri); |
| 25 } | 25 } |
| 26 } | 26 } |
| 27 | 27 |
| 28 void ProxyList::SetSingleProxyServer(const ProxyServer& proxy_server) { | 28 void ProxyList::SetSingleProxyServer(const ProxyServer& proxy_server) { |
| 29 proxies_.clear(); | 29 proxies_.clear(); |
| 30 if (proxy_server.is_valid()) | 30 if (proxy_server.is_valid()) |
| 31 proxies_.push_back(proxy_server); | 31 proxies_.push_back(proxy_server); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 (*proxy_retry_info)[key] = retry_info; | 114 (*proxy_retry_info)[key] = retry_info; |
| 115 } | 115 } |
| 116 | 116 |
| 117 // Remove this proxy from our list. | 117 // Remove this proxy from our list. |
| 118 proxies_.erase(proxies_.begin()); | 118 proxies_.erase(proxies_.begin()); |
| 119 | 119 |
| 120 return !proxies_.empty(); | 120 return !proxies_.empty(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace net | 123 } // namespace net |
| OLD | NEW |