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 #define V8_DISABLE_DEPRECATIONS 1 | 5 #define V8_DISABLE_DEPRECATIONS 1 |
6 | 6 |
7 #include "net/proxy/proxy_resolver_v8.h" | 7 #include "net/proxy/proxy_resolver_v8.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cstdio> | 10 #include <cstdio> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/string_tokenizer.h" | |
16 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "base/strings/string_tokenizer.h" |
17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
19 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
20 #include "googleurl/src/url_canon.h" | 20 #include "googleurl/src/url_canon.h" |
21 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
22 #include "net/base/net_log.h" | 22 #include "net/base/net_log.h" |
23 #include "net/base/net_util.h" | 23 #include "net/base/net_util.h" |
24 #include "net/proxy/proxy_info.h" | 24 #include "net/proxy/proxy_info.h" |
25 #include "net/proxy/proxy_resolver_script.h" | 25 #include "net/proxy/proxy_resolver_script.h" |
26 #include "v8/include/v8.h" | 26 #include "v8/include/v8.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 268 |
269 // Strip all whitespace (mimics IE behavior). | 269 // Strip all whitespace (mimics IE behavior). |
270 std::string cleaned_ip_address_list; | 270 std::string cleaned_ip_address_list; |
271 RemoveChars(ip_address_list, " \t", &cleaned_ip_address_list); | 271 RemoveChars(ip_address_list, " \t", &cleaned_ip_address_list); |
272 if (cleaned_ip_address_list.empty()) | 272 if (cleaned_ip_address_list.empty()) |
273 return false; | 273 return false; |
274 | 274 |
275 // Split-up IP addresses and store them in a vector. | 275 // Split-up IP addresses and store them in a vector. |
276 std::vector<IPAddress> ip_vector; | 276 std::vector<IPAddress> ip_vector; |
277 IPAddressNumber ip_num; | 277 IPAddressNumber ip_num; |
278 StringTokenizer str_tok(cleaned_ip_address_list, ";"); | 278 base::StringTokenizer str_tok(cleaned_ip_address_list, ";"); |
279 while (str_tok.GetNext()) { | 279 while (str_tok.GetNext()) { |
280 if (!ParseIPLiteralToNumber(str_tok.token(), &ip_num)) | 280 if (!ParseIPLiteralToNumber(str_tok.token(), &ip_num)) |
281 return false; | 281 return false; |
282 ip_vector.push_back(IPAddress(str_tok.token(), ip_num)); | 282 ip_vector.push_back(IPAddress(str_tok.token(), ip_num)); |
283 } | 283 } |
284 | 284 |
285 if (ip_vector.empty()) // Can happen if we have something like | 285 if (ip_vector.empty()) // Can happen if we have something like |
286 return false; // sortIpAddressList(";") or sortIpAddressList("; ;") | 286 return false; // sortIpAddressList(";") or sortIpAddressList("; ;") |
287 | 287 |
288 DCHECK(!ip_vector.empty()); | 288 DCHECK(!ip_vector.empty()); |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 | 730 |
731 // Try parsing the PAC script. | 731 // Try parsing the PAC script. |
732 scoped_ptr<Context> context(new Context(this)); | 732 scoped_ptr<Context> context(new Context(this)); |
733 int rv = context->InitV8(script_data); | 733 int rv = context->InitV8(script_data); |
734 if (rv == OK) | 734 if (rv == OK) |
735 context_.reset(context.release()); | 735 context_.reset(context.release()); |
736 return rv; | 736 return rv; |
737 } | 737 } |
738 | 738 |
739 } // namespace net | 739 } // namespace net |
OLD | NEW |