| 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_loader_impl.h" | 5 #include "content/child/web_url_loader_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 const net::RedirectInfo& redirect_info, | 596 const net::RedirectInfo& redirect_info, |
| 597 const ResourceResponseInfo& info) { | 597 const ResourceResponseInfo& info) { |
| 598 if (!client_) | 598 if (!client_) |
| 599 return false; | 599 return false; |
| 600 | 600 |
| 601 TRACE_EVENT_WITH_FLOW0( | 601 TRACE_EVENT_WITH_FLOW0( |
| 602 "loading", "WebURLLoaderImpl::Context::OnReceivedRedirect", | 602 "loading", "WebURLLoaderImpl::Context::OnReceivedRedirect", |
| 603 this, TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT); | 603 this, TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT); |
| 604 | 604 |
| 605 WebURLResponse response; | 605 WebURLResponse response; |
| 606 response.initialize(); | |
| 607 PopulateURLResponse(request_.url(), info, &response, | 606 PopulateURLResponse(request_.url(), info, &response, |
| 608 request_.reportRawHeaders()); | 607 request_.reportRawHeaders()); |
| 609 | 608 |
| 610 WebURLRequest new_request; | 609 WebURLRequest new_request; |
| 611 new_request.initialize(); | 610 new_request.initialize(); |
| 612 PopulateURLRequestForRedirect( | 611 PopulateURLRequestForRedirect( |
| 613 request_, redirect_info, referrer_policy_, | 612 request_, redirect_info, referrer_policy_, |
| 614 info.was_fetched_via_service_worker | 613 info.was_fetched_via_service_worker |
| 615 ? blink::WebURLRequest::SkipServiceWorker::None | 614 ? blink::WebURLRequest::SkipServiceWorker::None |
| 616 : blink::WebURLRequest::SkipServiceWorker::All, | 615 : blink::WebURLRequest::SkipServiceWorker::All, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 647 ResourceResponseInfo info = initial_info; | 646 ResourceResponseInfo info = initial_info; |
| 648 | 647 |
| 649 // PlzNavigate: during navigations, the ResourceResponse has already been | 648 // PlzNavigate: during navigations, the ResourceResponse has already been |
| 650 // received on the browser side, and has been passed down to the renderer. | 649 // received on the browser side, and has been passed down to the renderer. |
| 651 if (stream_override_.get()) { | 650 if (stream_override_.get()) { |
| 652 CHECK(IsBrowserSideNavigationEnabled()); | 651 CHECK(IsBrowserSideNavigationEnabled()); |
| 653 info = stream_override_->response; | 652 info = stream_override_->response; |
| 654 } | 653 } |
| 655 | 654 |
| 656 WebURLResponse response; | 655 WebURLResponse response; |
| 657 response.initialize(); | |
| 658 PopulateURLResponse(request_.url(), info, &response, | 656 PopulateURLResponse(request_.url(), info, &response, |
| 659 request_.reportRawHeaders()); | 657 request_.reportRawHeaders()); |
| 660 | 658 |
| 661 bool show_raw_listing = (GURL(request_.url()).query() == "raw"); | 659 bool show_raw_listing = (GURL(request_.url()).query() == "raw"); |
| 662 | 660 |
| 663 if (info.mime_type == "text/vnd.chromium.ftp-dir") { | 661 if (info.mime_type == "text/vnd.chromium.ftp-dir") { |
| 664 if (show_raw_listing) { | 662 if (show_raw_listing) { |
| 665 // Set the MIME type to plain text to prevent any active content. | 663 // Set the MIME type to plain text to prevent any active content. |
| 666 response.setMIMEType("text/plain"); | 664 response.setMIMEType("text/plain"); |
| 667 } else { | 665 } else { |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 response->clearHTTPHeaderField(webStringName); | 1227 response->clearHTTPHeaderField(webStringName); |
| 1230 while (response_headers->EnumerateHeader(&iterator, name, &value)) { | 1228 while (response_headers->EnumerateHeader(&iterator, name, &value)) { |
| 1231 response->addHTTPHeaderField(webStringName, | 1229 response->addHTTPHeaderField(webStringName, |
| 1232 WebString::fromLatin1(value)); | 1230 WebString::fromLatin1(value)); |
| 1233 } | 1231 } |
| 1234 } | 1232 } |
| 1235 return true; | 1233 return true; |
| 1236 } | 1234 } |
| 1237 | 1235 |
| 1238 } // namespace content | 1236 } // namespace content |
| OLD | NEW |