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 #include "content/child/web_url_request_util.h" | 5 #include "content/child/web_url_request_util.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "net/base/load_flags.h" | 9 #include "net/base/load_flags.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 request_body->AppendBlob(element.blobUUID.utf8()); | 269 request_body->AppendBlob(element.blobUUID.utf8()); |
270 break; | 270 break; |
271 default: | 271 default: |
272 NOTREACHED(); | 272 NOTREACHED(); |
273 } | 273 } |
274 } | 274 } |
275 request_body->set_identifier(request.httpBody().identifier()); | 275 request_body->set_identifier(request.httpBody().identifier()); |
276 return request_body; | 276 return request_body; |
277 } | 277 } |
278 | 278 |
| 279 FetchRequestMode GetFetchRequestModeForWebURLRequest( |
| 280 const blink::WebURLRequest& request) { |
| 281 return static_cast<FetchRequestMode>(request.fetchRequestMode()); |
| 282 } |
| 283 |
| 284 FetchCredentialsMode GetFetchCredentialsModeForWebURLRequest( |
| 285 const blink::WebURLRequest& request) { |
| 286 return static_cast<FetchCredentialsMode>(request.fetchCredentialsMode()); |
| 287 } |
| 288 |
| 289 FetchRedirectMode GetFetchRedirectModeForWebURLRequest( |
| 290 const blink::WebURLRequest& request) { |
| 291 return static_cast<FetchRedirectMode>(request.fetchRedirectMode()); |
| 292 } |
| 293 |
| 294 RequestContextFrameType GetRequestContextFrameTypeForWebURLRequest( |
| 295 const blink::WebURLRequest& request) { |
| 296 return static_cast<RequestContextFrameType>(request.frameType()); |
| 297 } |
| 298 |
| 299 RequestContextType GetRequestContextTypeForWebURLRequest( |
| 300 const blink::WebURLRequest& request) { |
| 301 return static_cast<RequestContextType>(request.requestContext()); |
| 302 } |
| 303 |
279 blink::WebURLError CreateWebURLError(const blink::WebURL& unreachable_url, | 304 blink::WebURLError CreateWebURLError(const blink::WebURL& unreachable_url, |
280 bool stale_copy_in_cache, | 305 bool stale_copy_in_cache, |
281 int reason) { | 306 int reason) { |
282 blink::WebURLError error; | 307 blink::WebURLError error; |
283 error.domain = WebString::fromUTF8(net::kErrorDomain); | 308 error.domain = WebString::fromUTF8(net::kErrorDomain); |
284 error.reason = reason; | 309 error.reason = reason; |
285 error.unreachableURL = unreachable_url; | 310 error.unreachableURL = unreachable_url; |
286 error.staleCopyInCache = stale_copy_in_cache; | 311 error.staleCopyInCache = stale_copy_in_cache; |
287 if (reason == net::ERR_ABORTED) { | 312 if (reason == net::ERR_ABORTED) { |
288 error.isCancellation = true; | 313 error.isCancellation = true; |
(...skipping 11 matching lines...) Expand all Loading... |
300 bool stale_copy_in_cache, | 325 bool stale_copy_in_cache, |
301 int reason, | 326 int reason, |
302 bool was_ignored_by_handler) { | 327 bool was_ignored_by_handler) { |
303 blink::WebURLError error = | 328 blink::WebURLError error = |
304 CreateWebURLError(unreachable_url, stale_copy_in_cache, reason); | 329 CreateWebURLError(unreachable_url, stale_copy_in_cache, reason); |
305 error.wasIgnoredByHandler = was_ignored_by_handler; | 330 error.wasIgnoredByHandler = was_ignored_by_handler; |
306 return error; | 331 return error; |
307 } | 332 } |
308 | 333 |
309 } // namespace content | 334 } // namespace content |
OLD | NEW |