| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CONTENT_CHILD_WEB_URL_REQUEST_UTIL_H_ | 5 #ifndef CONTENT_CHILD_WEB_URL_REQUEST_UTIL_H_ |
| 6 #define CONTENT_CHILD_WEB_URL_REQUEST_UTIL_H_ | 6 #define CONTENT_CHILD_WEB_URL_REQUEST_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/common/resource_request_body.h" | 11 #include "content/common/resource_request_body.h" |
| 12 #include "content/common/service_worker/service_worker_types.h" | 12 #include "content/common/service_worker/service_worker_types.h" |
| 13 #include "content/public/common/request_context_frame_type.h" | 13 #include "content/public/common/request_context_frame_type.h" |
| 14 #include "content/public/common/request_context_type.h" | 14 #include "content/public/common/request_context_type.h" |
| 15 #include "content/public/common/resource_type.h" | 15 #include "content/public/common/resource_type.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 class WebHTTPBody; |
| 18 class WebURL; | 19 class WebURL; |
| 19 class WebURLRequest; | 20 class WebURLRequest; |
| 20 struct WebURLError; | 21 struct WebURLError; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 | 25 |
| 25 CONTENT_EXPORT ResourceType WebURLRequestToResourceType( | 26 CONTENT_EXPORT ResourceType WebURLRequestToResourceType( |
| 26 const blink::WebURLRequest& request); | 27 const blink::WebURLRequest& request); |
| 27 | 28 |
| 28 std::string GetWebURLRequestHeaders(const blink::WebURLRequest& request); | 29 std::string GetWebURLRequestHeaders(const blink::WebURLRequest& request); |
| 29 | 30 |
| 30 int GetLoadFlagsForWebURLRequest(const blink::WebURLRequest& request); | 31 int GetLoadFlagsForWebURLRequest(const blink::WebURLRequest& request); |
| 31 | 32 |
| 33 // Takes a ResourceRequestBody and converts into WebHTTPBody. |
| 34 blink::WebHTTPBody GetWebHTTPBodyForRequestBody( |
| 35 const scoped_refptr<ResourceRequestBody>& input); |
| 36 |
| 37 // Takes a WebHTTPBody and converts into a ResourceRequestBody. |
| 38 scoped_refptr<ResourceRequestBody> GetRequestBodyForWebHTTPBody( |
| 39 const blink::WebHTTPBody& httpBody); |
| 40 |
| 32 // Takes a WebURLRequest and sets the appropriate information | 41 // Takes a WebURLRequest and sets the appropriate information |
| 33 // in a ResourceRequestBody structure. Returns an empty scoped_refptr | 42 // in a ResourceRequestBody structure. Returns an empty scoped_refptr |
| 34 // if the request body is not present. | 43 // if the request body is not present. |
| 35 scoped_refptr<ResourceRequestBody> GetRequestBodyForWebURLRequest( | 44 scoped_refptr<ResourceRequestBody> GetRequestBodyForWebURLRequest( |
| 36 const blink::WebURLRequest& request); | 45 const blink::WebURLRequest& request); |
| 37 | 46 |
| 38 // Helper functions to convert enums from the blink type to the content | 47 // Helper functions to convert enums from the blink type to the content |
| 39 // type. | 48 // type. |
| 40 FetchRequestMode GetFetchRequestModeForWebURLRequest( | 49 FetchRequestMode GetFetchRequestModeForWebURLRequest( |
| 41 const blink::WebURLRequest& request); | 50 const blink::WebURLRequest& request); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 55 | 64 |
| 56 // Generates a WebURLError based on |reason|. | 65 // Generates a WebURLError based on |reason|. |
| 57 blink::WebURLError CreateWebURLError(const blink::WebURL& unreachable_url, | 66 blink::WebURLError CreateWebURLError(const blink::WebURL& unreachable_url, |
| 58 bool stale_copy_in_cache, | 67 bool stale_copy_in_cache, |
| 59 int reason, | 68 int reason, |
| 60 bool was_ignored_by_handler); | 69 bool was_ignored_by_handler); |
| 61 | 70 |
| 62 } // namespace content | 71 } // namespace content |
| 63 | 72 |
| 64 #endif // CONTENT_CHILD_WEB_URL_REQUEST_UTIL_H_ | 73 #endif // CONTENT_CHILD_WEB_URL_REQUEST_UTIL_H_ |
| OLD | NEW |