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

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

Issue 1280973004: Returning scoped_ptr<> instead of raw pointer in ProxyConfig::ToValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« net/proxy/proxy_config.h ('K') | « net/proxy/proxy_config.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« net/proxy/proxy_config.h ('K') | « net/proxy/proxy_config.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698