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 CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 7 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
8 #define CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 8 #define CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 19 matching lines...) Expand all Loading... |
30 class Extension; | 30 class Extension; |
31 } | 31 } |
32 | 32 |
33 namespace net { | 33 namespace net { |
34 class BoundNetLog; | 34 class BoundNetLog; |
35 class URLRequest; | 35 class URLRequest; |
36 } | 36 } |
37 | 37 |
38 namespace extension_web_request_api_helpers { | 38 namespace extension_web_request_api_helpers { |
39 | 39 |
| 40 #define ARRAYEND(array) (array + arraysize(array)) |
| 41 |
40 typedef std::pair<std::string, std::string> ResponseHeader; | 42 typedef std::pair<std::string, std::string> ResponseHeader; |
41 typedef std::vector<ResponseHeader> ResponseHeaders; | 43 typedef std::vector<ResponseHeader> ResponseHeaders; |
42 | 44 |
43 // Data container for RequestCookies as defined in the declarative WebRequest | 45 // Data container for RequestCookies as defined in the declarative WebRequest |
44 // API definition. | 46 // API definition. |
45 struct RequestCookie { | 47 struct RequestCookie { |
46 RequestCookie(); | 48 RequestCookie(); |
47 ~RequestCookie(); | 49 ~RequestCookie(); |
48 scoped_ptr<std::string> name; | 50 scoped_ptr<std::string> name; |
49 scoped_ptr<std::string> value; | 51 scoped_ptr<std::string> value; |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 void ClearCacheOnNavigation(); | 307 void ClearCacheOnNavigation(); |
306 | 308 |
307 // Tells renderer processes that the web request or declarative web request | 309 // Tells renderer processes that the web request or declarative web request |
308 // API has been used by |extension| in browser_context |browser_context_id| to | 310 // API has been used by |extension| in browser_context |browser_context_id| to |
309 // collect UMA statistics on Page Load Times. Needs to be called on the UI | 311 // collect UMA statistics on Page Load Times. Needs to be called on the UI |
310 // thread. | 312 // thread. |
311 void NotifyWebRequestAPIUsed( | 313 void NotifyWebRequestAPIUsed( |
312 void* browser_context_id, | 314 void* browser_context_id, |
313 scoped_refptr<const extensions::Extension> extension); | 315 scoped_refptr<const extensions::Extension> extension); |
314 | 316 |
| 317 // Converts the |name|, |value| pair of a http header to a HttpHeaders |
| 318 // dictionary. Ownership is passed to the caller. |
| 319 base::DictionaryValue* ToHeaderDictionary( |
| 320 const std::string& name, const std::string& value); |
| 321 |
315 } // namespace extension_web_request_api_helpers | 322 } // namespace extension_web_request_api_helpers |
316 | 323 |
317 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 324 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
OLD | NEW |