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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" |
10 #include "base/strings/string_tokenizer.h" | 11 #include "base/strings/string_tokenizer.h" |
11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
12 #include "base/values.h" | 13 #include "base/values.h" |
13 #include "net/proxy/proxy_info.h" | 14 #include "net/proxy/proxy_info.h" |
14 | 15 |
15 namespace net { | 16 namespace net { |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
19 // If |proxies| is non-empty, sets it in |dict| under the key |name|. | 20 // If |proxies| is non-empty, sets it in |dict| under the key |name|. |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 default: | 255 default: |
255 NOTREACHED(); | 256 NOTREACHED(); |
256 } | 257 } |
257 | 258 |
258 // Output the bypass rules. | 259 // Output the bypass rules. |
259 const ProxyBypassRules& bypass = proxy_rules_.bypass_rules; | 260 const ProxyBypassRules& bypass = proxy_rules_.bypass_rules; |
260 if (!bypass.rules().empty()) { | 261 if (!bypass.rules().empty()) { |
261 if (proxy_rules_.reverse_bypass) | 262 if (proxy_rules_.reverse_bypass) |
262 dict->SetBoolean("reverse_bypass", true); | 263 dict->SetBoolean("reverse_bypass", true); |
263 | 264 |
264 base::ListValue* list = new base::ListValue(); | 265 auto list = base::MakeUnique<base::ListValue>(); |
265 | 266 |
266 for (ProxyBypassRules::RuleList::const_iterator it = | 267 for (ProxyBypassRules::RuleList::const_iterator it = |
267 bypass.rules().begin(); | 268 bypass.rules().begin(); |
268 it != bypass.rules().end(); ++it) { | 269 it != bypass.rules().end(); ++it) { |
269 list->AppendString((*it)->ToString()); | 270 list->AppendString((*it)->ToString()); |
270 } | 271 } |
271 | 272 |
272 dict->Set("bypass_list", list); | 273 dict->Set("bypass_list", std::move(list)); |
273 } | 274 } |
274 } | 275 } |
275 | 276 |
276 // Output the source. | 277 // Output the source. |
277 dict->SetString("source", ProxyConfigSourceToString(source_)); | 278 dict->SetString("source", ProxyConfigSourceToString(source_)); |
278 | 279 |
279 return dict; | 280 return dict; |
280 } | 281 } |
281 | 282 |
282 } // namespace net | 283 } // namespace net |
OLD | NEW |