OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "net/proxy/proxy_server.h" | 10 #include "net/proxy/proxy_server.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 for (std::vector<ProxyServer>::iterator it = proxies_.begin(); | 70 for (std::vector<ProxyServer>::iterator it = proxies_.begin(); |
71 it != proxies_.end(); ) { | 71 it != proxies_.end(); ) { |
72 if (!(scheme_bit_field & it->scheme())) { | 72 if (!(scheme_bit_field & it->scheme())) { |
73 it = proxies_.erase(it); | 73 it = proxies_.erase(it); |
74 continue; | 74 continue; |
75 } | 75 } |
76 ++it; | 76 ++it; |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
| 80 void ProxyList::Clear() { |
| 81 proxies_.clear(); |
| 82 } |
| 83 |
80 bool ProxyList::IsEmpty() const { | 84 bool ProxyList::IsEmpty() const { |
81 return proxies_.empty(); | 85 return proxies_.empty(); |
82 } | 86 } |
83 | 87 |
84 const ProxyServer& ProxyList::Get() const { | 88 const ProxyServer& ProxyList::Get() const { |
85 DCHECK(!proxies_.empty()); | 89 DCHECK(!proxies_.empty()); |
86 return proxies_[0]; | 90 return proxies_[0]; |
87 } | 91 } |
88 | 92 |
89 void ProxyList::SetFromPacString(const std::string& pac_string) { | 93 void ProxyList::SetFromPacString(const std::string& pac_string) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 make_scoped_refptr(new NetLogStringParameter("bad_proxy", key))); | 162 make_scoped_refptr(new NetLogStringParameter("bad_proxy", key))); |
159 } | 163 } |
160 | 164 |
161 // Remove this proxy from our list. | 165 // Remove this proxy from our list. |
162 proxies_.erase(proxies_.begin()); | 166 proxies_.erase(proxies_.begin()); |
163 | 167 |
164 return !proxies_.empty(); | 168 return !proxies_.empty(); |
165 } | 169 } |
166 | 170 |
167 } // namespace net | 171 } // namespace net |
OLD | NEW |