| 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_impl.h" | |
| 12 #include "content/common/service_worker/service_worker_types.h" | 11 #include "content/common/service_worker/service_worker_types.h" |
| 13 #include "content/public/common/request_context_frame_type.h" | 12 #include "content/public/common/request_context_frame_type.h" |
| 14 #include "content/public/common/request_context_type.h" | 13 #include "content/public/common/request_context_type.h" |
| 14 #include "content/public/common/resource_request_body.h" |
| 15 #include "content/public/common/resource_type.h" | 15 #include "content/public/common/resource_type.h" |
| 16 #include "third_party/WebKit/public/platform/WebMixedContentContextType.h" | 16 #include "third_party/WebKit/public/platform/WebMixedContentContextType.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 class WebHTTPBody; | 19 class WebHTTPBody; |
| 20 class WebURL; | 20 class WebURL; |
| 21 class WebURLRequest; | 21 class WebURLRequest; |
| 22 struct WebURLError; | 22 struct WebURLError; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace content { | 25 namespace content { |
| 26 | 26 |
| 27 CONTENT_EXPORT ResourceType WebURLRequestToResourceType( | 27 CONTENT_EXPORT ResourceType WebURLRequestToResourceType( |
| 28 const blink::WebURLRequest& request); | 28 const blink::WebURLRequest& request); |
| 29 | 29 |
| 30 std::string GetWebURLRequestHeaders(const blink::WebURLRequest& request); | 30 std::string GetWebURLRequestHeaders(const blink::WebURLRequest& request); |
| 31 | 31 |
| 32 int GetLoadFlagsForWebURLRequest(const blink::WebURLRequest& request); | 32 int GetLoadFlagsForWebURLRequest(const blink::WebURLRequest& request); |
| 33 | 33 |
| 34 // Takes a ResourceRequestBodyImpl and converts into WebHTTPBody. | 34 // Takes a ResourceRequestBody and converts into WebHTTPBody. |
| 35 blink::WebHTTPBody GetWebHTTPBodyForRequestBody( | 35 blink::WebHTTPBody GetWebHTTPBodyForRequestBody( |
| 36 const scoped_refptr<ResourceRequestBodyImpl>& input); | 36 const scoped_refptr<ResourceRequestBody>& input); |
| 37 | 37 |
| 38 // Takes a WebHTTPBody and converts into a ResourceRequestBodyImpl. | 38 // Takes a WebHTTPBody and converts into a ResourceRequestBody. |
| 39 scoped_refptr<ResourceRequestBodyImpl> GetRequestBodyForWebHTTPBody( | 39 scoped_refptr<ResourceRequestBody> GetRequestBodyForWebHTTPBody( |
| 40 const blink::WebHTTPBody& httpBody); | 40 const blink::WebHTTPBody& httpBody); |
| 41 | 41 |
| 42 // Takes a WebURLRequest and sets the appropriate information | 42 // Takes a WebURLRequest and sets the appropriate information |
| 43 // in a ResourceRequestBodyImpl structure. Returns an empty scoped_refptr | 43 // in a ResourceRequestBody structure. Returns an empty scoped_refptr |
| 44 // if the request body is not present. | 44 // if the request body is not present. |
| 45 scoped_refptr<ResourceRequestBodyImpl> GetRequestBodyForWebURLRequest( | 45 scoped_refptr<ResourceRequestBody> GetRequestBodyForWebURLRequest( |
| 46 const blink::WebURLRequest& request); | 46 const blink::WebURLRequest& request); |
| 47 | 47 |
| 48 // Helper functions to convert enums from the blink type to the content | 48 // Helper functions to convert enums from the blink type to the content |
| 49 // type. | 49 // type. |
| 50 FetchRequestMode GetFetchRequestModeForWebURLRequest( | 50 FetchRequestMode GetFetchRequestModeForWebURLRequest( |
| 51 const blink::WebURLRequest& request); | 51 const blink::WebURLRequest& request); |
| 52 FetchCredentialsMode GetFetchCredentialsModeForWebURLRequest( | 52 FetchCredentialsMode GetFetchCredentialsModeForWebURLRequest( |
| 53 const blink::WebURLRequest& request); | 53 const blink::WebURLRequest& request); |
| 54 FetchRedirectMode GetFetchRedirectModeForWebURLRequest( | 54 FetchRedirectMode GetFetchRedirectModeForWebURLRequest( |
| 55 const blink::WebURLRequest& request); | 55 const blink::WebURLRequest& request); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 69 | 69 |
| 70 // Generates a WebURLError based on |reason|. | 70 // Generates a WebURLError based on |reason|. |
| 71 blink::WebURLError CreateWebURLError(const blink::WebURL& unreachable_url, | 71 blink::WebURLError CreateWebURLError(const blink::WebURL& unreachable_url, |
| 72 bool stale_copy_in_cache, | 72 bool stale_copy_in_cache, |
| 73 int reason, | 73 int reason, |
| 74 bool was_ignored_by_handler); | 74 bool was_ignored_by_handler); |
| 75 | 75 |
| 76 } // namespace content | 76 } // namespace content |
| 77 | 77 |
| 78 #endif // CONTENT_CHILD_WEB_URL_REQUEST_UTIL_H_ | 78 #endif // CONTENT_CHILD_WEB_URL_REQUEST_UTIL_H_ |
| OLD | NEW |