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 <memory> |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 const std::string& joiner, | 105 const std::string& joiner, |
106 std::string* out, | 106 std::string* out, |
107 std::string* error, | 107 std::string* error, |
108 bool* bad_message); | 108 bool* bad_message); |
109 | 109 |
110 | 110 |
111 // Helper functions for browser->extension pref transformation: | 111 // Helper functions for browser->extension pref transformation: |
112 | 112 |
113 // Creates and returns a ProxyRules dictionary as defined in the extension API | 113 // Creates and returns a ProxyRules dictionary as defined in the extension API |
114 // with the values of a ProxyConfigDictionary configured for fixed proxy | 114 // with the values of a ProxyConfigDictionary configured for fixed proxy |
115 // servers. Returns NULL in case of failures. Ownership is passed to the caller. | 115 // servers. Returns NULL in case of failures. |
116 base::DictionaryValue* CreateProxyRulesDict( | 116 std::unique_ptr<base::DictionaryValue> CreateProxyRulesDict( |
117 const ProxyConfigDictionary& proxy_config); | 117 const ProxyConfigDictionary& proxy_config); |
118 | 118 |
119 // Creates and returns a ProxyServer dictionary as defined in the extension API | 119 // Creates and returns a ProxyServer dictionary as defined in the extension API |
120 // with values from a net::ProxyServer object. Never returns NULL. Ownership is | 120 // with values from a net::ProxyServer object. Never returns NULL. |
121 // passed to the caller. | 121 std::unique_ptr<base::DictionaryValue> CreateProxyServerDict( |
122 base::DictionaryValue* CreateProxyServerDict(const net::ProxyServer& proxy); | 122 const net::ProxyServer& proxy); |
123 | 123 |
124 // Creates and returns a PacScript dictionary as defined in the extension API | 124 // Creates and returns a PacScript dictionary as defined in the extension API |
125 // with the values of a ProxyconfigDictionary configured for pac scripts. | 125 // with the values of a ProxyconfigDictionary configured for pac scripts. |
126 // Returns NULL in case of failures. Ownership is passed to the caller. | 126 // Returns NULL in case of failures. |
127 base::DictionaryValue* CreatePacScriptDict( | 127 std::unique_ptr<base::DictionaryValue> CreatePacScriptDict( |
128 const ProxyConfigDictionary& proxy_config); | 128 const ProxyConfigDictionary& proxy_config); |
129 | 129 |
130 // 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 |
131 // StringValues created from the tokens. Ownership is passed to the caller. | 131 // StringValues created from the tokens. |
132 base::ListValue* TokenizeToStringList(const std::string& in, | 132 std::unique_ptr<base::ListValue> TokenizeToStringList( |
133 const std::string& delims); | 133 const std::string& in, |
| 134 const std::string& delims); |
134 | 135 |
135 } // namespace proxy_api_helpers | 136 } // namespace proxy_api_helpers |
136 } // namespace extensions | 137 } // namespace extensions |
137 | 138 |
138 #endif // CHROME_BROWSER_EXTENSIONS_API_PROXY_PROXY_API_HELPERS_H_ | 139 #endif // CHROME_BROWSER_EXTENSIONS_API_PROXY_PROXY_API_HELPERS_H_ |
OLD | NEW |