| 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/strings/string_util.h" | 8 #include "base/strings/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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 bool ProxyConfig::HasAutomaticSettings() const { | 225 bool ProxyConfig::HasAutomaticSettings() const { |
| 226 return auto_detect_ || has_pac_url(); | 226 return auto_detect_ || has_pac_url(); |
| 227 } | 227 } |
| 228 | 228 |
| 229 void ProxyConfig::ClearAutomaticSettings() { | 229 void ProxyConfig::ClearAutomaticSettings() { |
| 230 auto_detect_ = false; | 230 auto_detect_ = false; |
| 231 pac_url_ = GURL(); | 231 pac_url_ = GURL(); |
| 232 } | 232 } |
| 233 | 233 |
| 234 base::DictionaryValue* ProxyConfig::ToValue() const { | 234 scoped_ptr<base::DictionaryValue> ProxyConfig::ToValue() const { |
| 235 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 235 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 236 | 236 |
| 237 // Output the automatic settings. | 237 // Output the automatic settings. |
| 238 if (auto_detect_) | 238 if (auto_detect_) |
| 239 dict->SetBoolean("auto_detect", auto_detect_); | 239 dict->SetBoolean("auto_detect", auto_detect_); |
| 240 if (has_pac_url()) { | 240 if (has_pac_url()) { |
| 241 dict->SetString("pac_url", pac_url_.possibly_invalid_spec()); | 241 dict->SetString("pac_url", pac_url_.possibly_invalid_spec()); |
| 242 if (pac_mandatory_) | 242 if (pac_mandatory_) |
| 243 dict->SetBoolean("pac_mandatory", pac_mandatory_); | 243 dict->SetBoolean("pac_mandatory", pac_mandatory_); |
| 244 } | 244 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 list->Append(new base::StringValue((*it)->ToString())); | 279 list->Append(new base::StringValue((*it)->ToString())); |
| 280 } | 280 } |
| 281 | 281 |
| 282 dict->Set("bypass_list", list); | 282 dict->Set("bypass_list", list); |
| 283 } | 283 } |
| 284 } | 284 } |
| 285 | 285 |
| 286 // Output the source. | 286 // Output the source. |
| 287 dict->SetString("source", ProxyConfigSourceToString(source_)); | 287 dict->SetString("source", ProxyConfigSourceToString(source_)); |
| 288 | 288 |
| 289 return dict.release(); | 289 return dict.Pass(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 } // namespace net | 292 } // namespace net |
| OLD | NEW |