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 // Implementation of helper functions for the Chrome Extensions Proxy Settings | 5 // Implementation of helper functions for the Chrome Extensions Proxy Settings |
6 // API. | 6 // API. |
7 // | 7 // |
8 // Throughout this code, we report errors to the user by setting an |error| | 8 // Throughout this code, we report errors to the user by setting an |error| |
9 // parameter, if and only if these errors can be cause by invalid input | 9 // parameter, if and only if these errors can be cause by invalid input |
10 // from the extension and we cannot expect that the extensions API has | 10 // from the extension and we cannot expect that the extensions API has |
11 // caught this error before. In all other cases we are dealing with internal | 11 // caught this error before. In all other cases we are dealing with internal |
12 // errors and log to LOG(ERROR). | 12 // errors and log to LOG(ERROR). |
13 | 13 |
14 #include "chrome/browser/extensions/api/proxy/proxy_api_helpers.h" | 14 #include "chrome/browser/extensions/api/proxy/proxy_api_helpers.h" |
15 | 15 |
16 #include "base/base64.h" | 16 #include "base/base64.h" |
17 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
18 #include "base/string_tokenizer.h" | |
19 #include "base/string_util.h" | 18 #include "base/string_util.h" |
| 19 #include "base/strings/string_tokenizer.h" |
20 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
21 #include "base/values.h" | 21 #include "base/values.h" |
22 #include "chrome/browser/extensions/api/proxy/proxy_api_constants.h" | 22 #include "chrome/browser/extensions/api/proxy/proxy_api_constants.h" |
23 #include "chrome/browser/prefs/proxy_config_dictionary.h" | 23 #include "chrome/browser/prefs/proxy_config_dictionary.h" |
24 #include "extensions/common/error_utils.h" | 24 #include "extensions/common/error_utils.h" |
25 #include "net/base/data_url.h" | 25 #include "net/base/data_url.h" |
26 #include "net/proxy/proxy_config.h" | 26 #include "net/proxy/proxy_config.h" |
27 | 27 |
28 namespace extensions { | 28 namespace extensions { |
29 | 29 |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 pac_script_dict->SetString(keys::kProxyConfigPacScriptUrl, pac_url); | 473 pac_script_dict->SetString(keys::kProxyConfigPacScriptUrl, pac_url); |
474 } | 474 } |
475 pac_script_dict->SetBoolean(keys::kProxyConfigPacScriptMandatory, | 475 pac_script_dict->SetBoolean(keys::kProxyConfigPacScriptMandatory, |
476 pac_mandatory); | 476 pac_mandatory); |
477 return pac_script_dict.release(); | 477 return pac_script_dict.release(); |
478 } | 478 } |
479 | 479 |
480 ListValue* TokenizeToStringList(const std::string& in, | 480 ListValue* TokenizeToStringList(const std::string& in, |
481 const std::string& delims) { | 481 const std::string& delims) { |
482 ListValue* out = new ListValue; | 482 ListValue* out = new ListValue; |
483 StringTokenizer entries(in, delims); | 483 base::StringTokenizer entries(in, delims); |
484 while (entries.GetNext()) | 484 while (entries.GetNext()) |
485 out->Append(Value::CreateStringValue(entries.token())); | 485 out->Append(Value::CreateStringValue(entries.token())); |
486 return out; | 486 return out; |
487 } | 487 } |
488 | 488 |
489 } // namespace proxy_api_helpers | 489 } // namespace proxy_api_helpers |
490 } // namespace extensions | 490 } // namespace extensions |
OLD | NEW |