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 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. | 5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. |
6 | 6 |
7 #include "content/child/web_url_loader_impl.h" | 7 #include "content/child/web_url_loader_impl.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 load_flags |= net::LOAD_REPORT_RAW_HEADERS; | 359 load_flags |= net::LOAD_REPORT_RAW_HEADERS; |
360 | 360 |
361 if (!request.allowStoredCredentials()) { | 361 if (!request.allowStoredCredentials()) { |
362 load_flags |= net::LOAD_DO_NOT_SAVE_COOKIES; | 362 load_flags |= net::LOAD_DO_NOT_SAVE_COOKIES; |
363 load_flags |= net::LOAD_DO_NOT_SEND_COOKIES; | 363 load_flags |= net::LOAD_DO_NOT_SEND_COOKIES; |
364 } | 364 } |
365 | 365 |
366 if (!request.allowStoredCredentials()) | 366 if (!request.allowStoredCredentials()) |
367 load_flags |= net::LOAD_DO_NOT_SEND_AUTH_DATA; | 367 load_flags |= net::LOAD_DO_NOT_SEND_AUTH_DATA; |
368 | 368 |
369 if (request.targetType() == WebURLRequest::TargetIsXHR && | 369 if (request.requestContext() == WebURLRequest::RequestContextXMLHttpRequest && |
370 (url.has_username() || url.has_password())) { | 370 (url.has_username() || url.has_password())) { |
371 load_flags |= net::LOAD_DO_NOT_PROMPT_FOR_LOGIN; | 371 load_flags |= net::LOAD_DO_NOT_PROMPT_FOR_LOGIN; |
372 } | 372 } |
373 | 373 |
374 HeaderFlattener flattener; | 374 HeaderFlattener flattener; |
375 request.visitHTTPHeaderFields(&flattener); | 375 request.visitHTTPHeaderFields(&flattener); |
376 | 376 |
377 // TODO(brettw) this should take parameter encoding into account when | 377 // TODO(brettw) this should take parameter encoding into account when |
378 // creating the GURLs. | 378 // creating the GURLs. |
379 | 379 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 // skip this for data URLs targetted at frames since those could trigger a | 665 // skip this for data URLs targetted at frames since those could trigger a |
666 // download. | 666 // download. |
667 // | 667 // |
668 // NOTE: We special case MIME types we can render both for performance | 668 // NOTE: We special case MIME types we can render both for performance |
669 // reasons as well as to support unit tests, which do not have an underlying | 669 // reasons as well as to support unit tests, which do not have an underlying |
670 // ResourceLoaderBridge implementation. | 670 // ResourceLoaderBridge implementation. |
671 | 671 |
672 #if defined(OS_ANDROID) | 672 #if defined(OS_ANDROID) |
673 // For compatibility reasons on Android we need to expose top-level data:// | 673 // For compatibility reasons on Android we need to expose top-level data:// |
674 // to the browser. | 674 // to the browser. |
675 if (request_.targetType() == WebURLRequest::TargetIsMainFrame) | 675 if (request_.frameType() == WebURLRequest::FrameTypeTopLevel) |
676 return false; | 676 return false; |
677 #endif | 677 #endif |
678 | 678 |
679 if (request_.targetType() != WebURLRequest::TargetIsMainFrame && | 679 if (request_.frameType() != WebURLRequest::FrameTypeTopLevel && |
680 request_.targetType() != WebURLRequest::TargetIsSubframe) | 680 request_.frameType() != WebURLRequest::FrameTypeNested) |
681 return true; | 681 return true; |
682 | 682 |
683 std::string mime_type, unused_charset; | 683 std::string mime_type, unused_charset; |
684 if (net::DataURL::Parse(url, &mime_type, &unused_charset, NULL) && | 684 if (net::DataURL::Parse(url, &mime_type, &unused_charset, NULL) && |
685 net::IsSupportedMimeType(mime_type)) | 685 net::IsSupportedMimeType(mime_type)) |
686 return true; | 686 return true; |
687 | 687 |
688 return false; | 688 return false; |
689 } | 689 } |
690 | 690 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 int intra_priority_value) { | 887 int intra_priority_value) { |
888 context_->DidChangePriority(new_priority, intra_priority_value); | 888 context_->DidChangePriority(new_priority, intra_priority_value); |
889 } | 889 } |
890 | 890 |
891 bool WebURLLoaderImpl::attachThreadedDataReceiver( | 891 bool WebURLLoaderImpl::attachThreadedDataReceiver( |
892 blink::WebThreadedDataReceiver* threaded_data_receiver) { | 892 blink::WebThreadedDataReceiver* threaded_data_receiver) { |
893 return context_->AttachThreadedDataReceiver(threaded_data_receiver); | 893 return context_->AttachThreadedDataReceiver(threaded_data_receiver); |
894 } | 894 } |
895 | 895 |
896 } // namespace content | 896 } // namespace content |
OLD | NEW |