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 #pragma once | 9 #pragma once |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "net/base/net_log.h" | 21 #include "net/base/net_log.h" |
22 #include "net/http/http_request_headers.h" | 22 #include "net/http/http_request_headers.h" |
23 #include "net/http/http_response_headers.h" | 23 #include "net/http/http_response_headers.h" |
24 #include "webkit/glue/resource_type.h" | 24 #include "webkit/glue/resource_type.h" |
25 | 25 |
26 namespace base { | 26 namespace base { |
27 class ListValue; | 27 class ListValue; |
28 class Value; | 28 class Value; |
29 } | 29 } |
30 | 30 |
| 31 namespace net { |
| 32 class BoundNetLog; |
| 33 class URLRequest; |
| 34 } |
| 35 |
31 namespace extension_web_request_api_helpers { | 36 namespace extension_web_request_api_helpers { |
32 | 37 |
33 typedef std::pair<std::string, std::string> ResponseHeader; | 38 typedef std::pair<std::string, std::string> ResponseHeader; |
34 typedef std::vector<ResponseHeader> ResponseHeaders; | 39 typedef std::vector<ResponseHeader> ResponseHeaders; |
35 | 40 |
36 // Contains the modification an extension wants to perform on an event. | 41 // Contains the modification an extension wants to perform on an event. |
37 struct EventResponseDelta { | 42 struct EventResponseDelta { |
38 // ID of the extension that sent this response. | 43 // ID of the extension that sent this response. |
39 std::string extension_id; | 44 std::string extension_id; |
40 | 45 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // if any, will have its authentication credentials used. |request| must be | 177 // if any, will have its authentication credentials used. |request| must be |
173 // non-NULL, and contain |deltas| that are sorted in decreasing order of | 178 // non-NULL, and contain |deltas| that are sorted in decreasing order of |
174 // precedence. | 179 // precedence. |
175 // Returns whether authentication credentials are set. | 180 // Returns whether authentication credentials are set. |
176 bool MergeOnAuthRequiredResponses( | 181 bool MergeOnAuthRequiredResponses( |
177 const EventResponseDeltas& deltas, | 182 const EventResponseDeltas& deltas, |
178 net::AuthCredentials* auth_credentials, | 183 net::AuthCredentials* auth_credentials, |
179 std::set<std::string>* conflicting_extensions, | 184 std::set<std::string>* conflicting_extensions, |
180 EventLogEntries* event_log_entries); | 185 EventLogEntries* event_log_entries); |
181 | 186 |
182 // Returns true if requests for |url| shall not be reported to extensions. | 187 // Returns true if the request shall not be reported to extensions. |
183 bool HideRequestForURL(const GURL& url); | 188 bool HideRequest(net::URLRequest* request); |
184 | 189 |
185 // Returns whether |type| is a ResourceType that is handled by the web request | 190 // Returns whether |type| is a ResourceType that is handled by the web request |
186 // API. | 191 // API. |
187 bool IsRelevantResourceType(ResourceType::Type type); | 192 bool IsRelevantResourceType(ResourceType::Type type); |
188 | 193 |
189 // Returns a string representation of |type| or |other| if |type| is not handled | 194 // Returns a string representation of |type| or |other| if |type| is not handled |
190 // by the web request API. | 195 // by the web request API. |
191 const char* ResourceTypeToString(ResourceType::Type type); | 196 const char* ResourceTypeToString(ResourceType::Type type); |
192 | 197 |
193 // Stores a |ResourceType::Type| representation in |type| if |type_str| is | 198 // Stores a |ResourceType::Type| representation in |type| if |type_str| is |
194 // a resource type handled by the web request API. Returns true in case of | 199 // a resource type handled by the web request API. Returns true in case of |
195 // success. | 200 // success. |
196 bool ParseResourceType(const std::string& type_str, | 201 bool ParseResourceType(const std::string& type_str, |
197 ResourceType::Type* type); | 202 ResourceType::Type* type); |
198 | 203 |
199 } // namespace extension_web_request_api_helpers | 204 } // namespace extension_web_request_api_helpers |
200 | 205 |
201 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 206 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
OLD | NEW |