| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Definition of helper functions for the Chrome Extensions Proxy Settings API. | 5 // Definition of helper functions for the Chrome Extensions Proxy Settings API. |
| 6 | 6 |
| 7 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_HELPERS_H_ | 7 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_HELPERS_H_ |
| 8 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_HELPERS_H_ | 8 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_HELPERS_H_ |
| 9 #pragma once | 9 #pragma once |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // | 39 // |
| 40 // - If there are NO entries for the respective pieces of data, the functions | 40 // - If there are NO entries for the respective pieces of data, the functions |
| 41 // return true. | 41 // return true. |
| 42 // - If there ARE entries and they could be parsed, the functions set |out| | 42 // - If there ARE entries and they could be parsed, the functions set |out| |
| 43 // and return true. | 43 // and return true. |
| 44 // - If there are entries that could not be parsed, the functions set |error| | 44 // - If there are entries that could not be parsed, the functions set |error| |
| 45 // and return false. | 45 // and return false. |
| 46 bool GetProxyModeFromExtensionPref(const DictionaryValue* proxy_config, | 46 bool GetProxyModeFromExtensionPref(const DictionaryValue* proxy_config, |
| 47 ProxyPrefs::ProxyMode* out, | 47 ProxyPrefs::ProxyMode* out, |
| 48 std::string* error); | 48 std::string* error); |
| 49 bool GetPacMandatoryFromExtensionPref(const DictionaryValue* proxy_config, |
| 50 bool* out, |
| 51 std::string* error); |
| 49 bool GetPacUrlFromExtensionPref(const DictionaryValue* proxy_config, | 52 bool GetPacUrlFromExtensionPref(const DictionaryValue* proxy_config, |
| 50 std::string* out, | 53 std::string* out, |
| 51 std::string* error); | 54 std::string* error); |
| 52 bool GetPacDataFromExtensionPref(const DictionaryValue* proxy_config, | 55 bool GetPacDataFromExtensionPref(const DictionaryValue* proxy_config, |
| 53 std::string* out, | 56 std::string* out, |
| 54 std::string* error); | 57 std::string* error); |
| 55 bool GetProxyRulesStringFromExtensionPref(const DictionaryValue* proxy_config, | 58 bool GetProxyRulesStringFromExtensionPref(const DictionaryValue* proxy_config, |
| 56 std::string* out, | 59 std::string* out, |
| 57 std::string* error); | 60 std::string* error); |
| 58 bool GetBypassListFromExtensionPref(const DictionaryValue* proxy_config, | 61 bool GetBypassListFromExtensionPref(const DictionaryValue* proxy_config, |
| 59 std::string* out, | 62 std::string* out, |
| 60 std::string* error); | 63 std::string* error); |
| 61 | 64 |
| 62 // Creates and returns a ProxyConfig dictionary (as defined in the extension | 65 // Creates and returns a ProxyConfig dictionary (as defined in the extension |
| 63 // API) from the given parameters. Ownership is passed to the caller. | 66 // API) from the given parameters. Ownership is passed to the caller. |
| 64 // Depending on the value of |mode_enum|, several of the strings may be empty. | 67 // Depending on the value of |mode_enum|, several of the strings may be empty. |
| 65 DictionaryValue* CreateProxyConfigDict(ProxyPrefs::ProxyMode mode_enum, | 68 DictionaryValue* CreateProxyConfigDict(ProxyPrefs::ProxyMode mode_enum, |
| 69 bool pac_mandatory, |
| 66 const std::string& pac_url, | 70 const std::string& pac_url, |
| 67 const std::string& pac_data, | 71 const std::string& pac_data, |
| 68 const std::string& proxy_rules_string, | 72 const std::string& proxy_rules_string, |
| 69 const std::string& bypass_list, | 73 const std::string& bypass_list, |
| 70 std::string* error); | 74 std::string* error); |
| 71 | 75 |
| 72 // Converts a ProxyServer dictionary instance (as defined in the extension API) | 76 // Converts a ProxyServer dictionary instance (as defined in the extension API) |
| 73 // |proxy_server| to a net::ProxyServer. | 77 // |proxy_server| to a net::ProxyServer. |
| 74 // |default_scheme| is the default scheme that is filled in, in case the | 78 // |default_scheme| is the default scheme that is filled in, in case the |
| 75 // caller did not pass one. | 79 // caller did not pass one. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 106 DictionaryValue* CreatePacScriptDict(const ProxyConfigDictionary& proxy_config); | 110 DictionaryValue* CreatePacScriptDict(const ProxyConfigDictionary& proxy_config); |
| 107 | 111 |
| 108 // Tokenizes the |in| at delimiters |delims| and returns a new ListValue with | 112 // Tokenizes the |in| at delimiters |delims| and returns a new ListValue with |
| 109 // StringValues created from the tokens. Ownership is passed to the caller. | 113 // StringValues created from the tokens. Ownership is passed to the caller. |
| 110 ListValue* TokenizeToStringList(const std::string& in, | 114 ListValue* TokenizeToStringList(const std::string& in, |
| 111 const std::string& delims); | 115 const std::string& delims); |
| 112 | 116 |
| 113 } // namespace extension_proxy_api_helpers | 117 } // namespace extension_proxy_api_helpers |
| 114 | 118 |
| 115 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_HELPERS_H_ | 119 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_HELPERS_H_ |
| OLD | NEW |