| 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 // Helper classes and functions used for the WebRequest API. | 5 // Helper classes and functions used for the WebRequest API. |
| 6 | 6 |
| 7 #ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 7 #ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
| 8 #define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 8 #define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 }; | 196 }; |
| 197 | 197 |
| 198 typedef std::list<linked_ptr<EventResponseDelta> > EventResponseDeltas; | 198 typedef std::list<linked_ptr<EventResponseDelta> > EventResponseDeltas; |
| 199 | 199 |
| 200 // Comparison operator that returns true if the extension that caused | 200 // Comparison operator that returns true if the extension that caused |
| 201 // |a| was installed after the extension that caused |b|. | 201 // |a| was installed after the extension that caused |b|. |
| 202 bool InDecreasingExtensionInstallationTimeOrder( | 202 bool InDecreasingExtensionInstallationTimeOrder( |
| 203 const linked_ptr<EventResponseDelta>& a, | 203 const linked_ptr<EventResponseDelta>& a, |
| 204 const linked_ptr<EventResponseDelta>& b); | 204 const linked_ptr<EventResponseDelta>& b); |
| 205 | 205 |
| 206 // Converts a string to a list of integers, each in 0..255. Ownership | 206 // Converts a string to a list of integers, each in 0..255. |
| 207 // of the created list is passed to the caller. | 207 std::unique_ptr<base::ListValue> StringToCharList(const std::string& s); |
| 208 base::ListValue* StringToCharList(const std::string& s); | |
| 209 | 208 |
| 210 // Converts a list of integer values between 0 and 255 into a string |*out|. | 209 // Converts a list of integer values between 0 and 255 into a string |*out|. |
| 211 // Returns true if the conversion was successful. | 210 // Returns true if the conversion was successful. |
| 212 bool CharListToString(const base::ListValue* list, std::string* out); | 211 bool CharListToString(const base::ListValue* list, std::string* out); |
| 213 | 212 |
| 214 // The following functions calculate and return the modifications to requests | 213 // The following functions calculate and return the modifications to requests |
| 215 // commanded by extension handlers. All functions take the id of the extension | 214 // commanded by extension handlers. All functions take the id of the extension |
| 216 // that commanded a modification, the installation time of this extension (used | 215 // that commanded a modification, the installation time of this extension (used |
| 217 // for defining a precedence in conflicting modifications) and whether the | 216 // for defining a precedence in conflicting modifications) and whether the |
| 218 // extension requested to |cancel| the request. Other parameters depend on a | 217 // extension requested to |cancel| the request. Other parameters depend on a |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 332 |
| 334 // Converts the |name|, |value| pair of a http header to a HttpHeaders | 333 // Converts the |name|, |value| pair of a http header to a HttpHeaders |
| 335 // dictionary. | 334 // dictionary. |
| 336 std::unique_ptr<base::DictionaryValue> CreateHeaderDictionary( | 335 std::unique_ptr<base::DictionaryValue> CreateHeaderDictionary( |
| 337 const std::string& name, | 336 const std::string& name, |
| 338 const std::string& value); | 337 const std::string& value); |
| 339 | 338 |
| 340 } // namespace extension_web_request_api_helpers | 339 } // namespace extension_web_request_api_helpers |
| 341 | 340 |
| 342 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 341 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
| OLD | NEW |