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