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