| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // Triggers clearing each renderer's in-memory cache the next time it navigates. | 306 // Triggers clearing each renderer's in-memory cache the next time it navigates. |
| 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 profile |profile_id| to collect | 310 // API has been used by |extension| in profile |profile_id| to collect |
| 309 // UMA statistics on Page Load Times. Needs to be called on the UI thread. | 311 // UMA statistics on Page Load Times. Needs to be called on the UI thread. |
| 310 void NotifyWebRequestAPIUsed( | 312 void NotifyWebRequestAPIUsed( |
| 311 void* profile_id, | 313 void* profile_id, |
| 312 scoped_refptr<const extensions::Extension> extension); | 314 scoped_refptr<const extensions::Extension> extension); |
| 313 | 315 |
| 316 // Converts the |name|, |value| pair of a http header to a HttpHeaders |
| 317 // dictionary. Ownership is passed to the caller. |
| 318 base::DictionaryValue* ToHeaderDictionary( |
| 319 const std::string& name, const std::string& value); |
| 320 |
| 314 } // namespace extension_web_request_api_helpers | 321 } // namespace extension_web_request_api_helpers |
| 315 | 322 |
| 316 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 323 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
| OLD | NEW |