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_config.h" | 5 #include "net/proxy/proxy_config.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/strings/string_tokenizer.h" | 9 #include "base/strings/string_tokenizer.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 211 |
212 bool ProxyConfig::HasAutomaticSettings() const { | 212 bool ProxyConfig::HasAutomaticSettings() const { |
213 return auto_detect_ || has_pac_url(); | 213 return auto_detect_ || has_pac_url(); |
214 } | 214 } |
215 | 215 |
216 void ProxyConfig::ClearAutomaticSettings() { | 216 void ProxyConfig::ClearAutomaticSettings() { |
217 auto_detect_ = false; | 217 auto_detect_ = false; |
218 pac_url_ = GURL(); | 218 pac_url_ = GURL(); |
219 } | 219 } |
220 | 220 |
221 base::Value* ProxyConfig::ToValue() const { | 221 base::DictionaryValue* ProxyConfig::ToValue() const { |
222 base::DictionaryValue* dict = new base::DictionaryValue(); | 222 base::DictionaryValue* dict = new base::DictionaryValue(); |
223 | 223 |
224 // Output the automatic settings. | 224 // Output the automatic settings. |
225 if (auto_detect_) | 225 if (auto_detect_) |
226 dict->SetBoolean("auto_detect", auto_detect_); | 226 dict->SetBoolean("auto_detect", auto_detect_); |
227 if (has_pac_url()) { | 227 if (has_pac_url()) { |
228 dict->SetString("pac_url", pac_url_.possibly_invalid_spec()); | 228 dict->SetString("pac_url", pac_url_.possibly_invalid_spec()); |
229 if (pac_mandatory_) | 229 if (pac_mandatory_) |
230 dict->SetBoolean("pac_mandatory", pac_mandatory_); | 230 dict->SetBoolean("pac_mandatory", pac_mandatory_); |
231 } | 231 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 } | 268 } |
269 } | 269 } |
270 | 270 |
271 // Output the source. | 271 // Output the source. |
272 dict->SetString("source", ProxyConfigSourceToString(source_)); | 272 dict->SetString("source", ProxyConfigSourceToString(source_)); |
273 | 273 |
274 return dict; | 274 return dict; |
275 } | 275 } |
276 | 276 |
277 } // namespace net | 277 } // namespace net |
OLD | NEW |