OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/callback.h" | 7 #include "base/callback.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_tokenizer.h" | 9 #include "base/strings/string_tokenizer.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 if (size() != other.size()) | 102 if (size() != other.size()) |
103 return false; | 103 return false; |
104 return proxies_ == other.proxies_; | 104 return proxies_ == other.proxies_; |
105 } | 105 } |
106 | 106 |
107 const ProxyServer& ProxyList::Get() const { | 107 const ProxyServer& ProxyList::Get() const { |
108 DCHECK(!proxies_.empty()); | 108 DCHECK(!proxies_.empty()); |
109 return proxies_[0]; | 109 return proxies_[0]; |
110 } | 110 } |
111 | 111 |
| 112 const std::vector<ProxyServer>& ProxyList::GetAll() const { |
| 113 return proxies_; |
| 114 } |
| 115 |
112 void ProxyList::SetFromPacString(const std::string& pac_string) { | 116 void ProxyList::SetFromPacString(const std::string& pac_string) { |
113 base::StringTokenizer entry_tok(pac_string, ";"); | 117 base::StringTokenizer entry_tok(pac_string, ";"); |
114 proxies_.clear(); | 118 proxies_.clear(); |
115 while (entry_tok.GetNext()) { | 119 while (entry_tok.GetNext()) { |
116 ProxyServer uri = ProxyServer::FromPacString( | 120 ProxyServer uri = ProxyServer::FromPacString( |
117 entry_tok.token_begin(), entry_tok.token_end()); | 121 entry_tok.token_begin(), entry_tok.token_end()); |
118 // Silently discard malformed inputs. | 122 // Silently discard malformed inputs. |
119 if (uri.is_valid()) | 123 if (uri.is_valid()) |
120 proxies_.push_back(uri); | 124 proxies_.push_back(uri); |
121 } | 125 } |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 retry_delay, | 238 retry_delay, |
235 reconsider, | 239 reconsider, |
236 another_proxy_to_bypass, | 240 another_proxy_to_bypass, |
237 net_error, | 241 net_error, |
238 net_log); | 242 net_log); |
239 } | 243 } |
240 } | 244 } |
241 } | 245 } |
242 | 246 |
243 } // namespace net | 247 } // namespace net |
OLD | NEW |