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

Side by Side Diff: net/proxy/proxy_list.cc

Issue 10310179: Track sources of proxy settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update copyright Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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/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"
11 11
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
88 size_t ProxyList::size() const {
89 return proxies_.size();
90 }
91
84 const ProxyServer& ProxyList::Get() const { 92 const ProxyServer& ProxyList::Get() const {
85 DCHECK(!proxies_.empty()); 93 DCHECK(!proxies_.empty());
86 return proxies_[0]; 94 return proxies_[0];
87 } 95 }
88 96
89 void ProxyList::SetFromPacString(const std::string& pac_string) { 97 void ProxyList::SetFromPacString(const std::string& pac_string) {
90 StringTokenizer entry_tok(pac_string, ";"); 98 StringTokenizer entry_tok(pac_string, ";");
91 proxies_.clear(); 99 proxies_.clear();
92 while (entry_tok.GetNext()) { 100 while (entry_tok.GetNext()) {
93 ProxyServer uri = ProxyServer::FromPacString( 101 ProxyServer uri = ProxyServer::FromPacString(
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 make_scoped_refptr(new NetLogStringParameter("bad_proxy", key))); 166 make_scoped_refptr(new NetLogStringParameter("bad_proxy", key)));
159 } 167 }
160 168
161 // Remove this proxy from our list. 169 // Remove this proxy from our list.
162 proxies_.erase(proxies_.begin()); 170 proxies_.erase(proxies_.begin());
163 171
164 return !proxies_.empty(); 172 return !proxies_.empty();
165 } 173 }
166 174
167 } // namespace net 175 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698