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 // 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_API_PROXY_PROXY_API_HELPERS_H_ | 7 #ifndef CHROME_BROWSER_EXTENSIONS_API_PROXY_PROXY_API_HELPERS_H_ |
8 #define CHROME_BROWSER_EXTENSIONS_API_PROXY_PROXY_API_HELPERS_H_ | 8 #define CHROME_BROWSER_EXTENSIONS_API_PROXY_PROXY_API_HELPERS_H_ |
9 | 9 |
| 10 #include <memory> |
10 #include <string> | 11 #include <string> |
11 | 12 |
12 #include "components/proxy_config/proxy_prefs.h" | 13 #include "components/proxy_config/proxy_prefs.h" |
13 #include "net/proxy/proxy_config.h" | 14 #include "net/proxy/proxy_config.h" |
14 | 15 |
15 class ProxyConfigDictionary; | 16 class ProxyConfigDictionary; |
16 | 17 |
17 namespace base { | 18 namespace base { |
18 class DictionaryValue; | 19 class DictionaryValue; |
19 class ListValue; | 20 class ListValue; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 std::string* error, | 72 std::string* error, |
72 bool* bad_message); | 73 bool* bad_message); |
73 bool GetBypassListFromExtensionPref(const base::DictionaryValue* proxy_config, | 74 bool GetBypassListFromExtensionPref(const base::DictionaryValue* proxy_config, |
74 std::string* out, | 75 std::string* out, |
75 std::string* error, | 76 std::string* error, |
76 bool* bad_message); | 77 bool* bad_message); |
77 | 78 |
78 // Creates and returns a ProxyConfig dictionary (as defined in the extension | 79 // Creates and returns a ProxyConfig dictionary (as defined in the extension |
79 // API) from the given parameters. Ownership is passed to the caller. | 80 // API) from the given parameters. Ownership is passed to the caller. |
80 // Depending on the value of |mode_enum|, several of the strings may be empty. | 81 // Depending on the value of |mode_enum|, several of the strings may be empty. |
81 base::DictionaryValue* CreateProxyConfigDict( | 82 std::unique_ptr<base::DictionaryValue> CreateProxyConfigDict( |
82 ProxyPrefs::ProxyMode mode_enum, | 83 ProxyPrefs::ProxyMode mode_enum, |
83 bool pac_mandatory, | 84 bool pac_mandatory, |
84 const std::string& pac_url, | 85 const std::string& pac_url, |
85 const std::string& pac_data, | 86 const std::string& pac_data, |
86 const std::string& proxy_rules_string, | 87 const std::string& proxy_rules_string, |
87 const std::string& bypass_list, | 88 const std::string& bypass_list, |
88 std::string* error); | 89 std::string* error); |
89 | 90 |
90 // Converts a ProxyServer dictionary instance (as defined in the extension API) | 91 // Converts a ProxyServer dictionary instance (as defined in the extension API) |
91 // |proxy_server| to a net::ProxyServer. | 92 // |proxy_server| to a net::ProxyServer. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 129 |
129 // Tokenizes the |in| at delimiters |delims| and returns a new ListValue with | 130 // Tokenizes the |in| at delimiters |delims| and returns a new ListValue with |
130 // StringValues created from the tokens. Ownership is passed to the caller. | 131 // StringValues created from the tokens. Ownership is passed to the caller. |
131 base::ListValue* TokenizeToStringList(const std::string& in, | 132 base::ListValue* TokenizeToStringList(const std::string& in, |
132 const std::string& delims); | 133 const std::string& delims); |
133 | 134 |
134 } // namespace proxy_api_helpers | 135 } // namespace proxy_api_helpers |
135 } // namespace extensions | 136 } // namespace extensions |
136 | 137 |
137 #endif // CHROME_BROWSER_EXTENSIONS_API_PROXY_PROXY_API_HELPERS_H_ | 138 #endif // CHROME_BROWSER_EXTENSIONS_API_PROXY_PROXY_API_HELPERS_H_ |
OLD | NEW |