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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 const net::RedirectInfo& redirect_info, | 567 const net::RedirectInfo& redirect_info, |
568 const ResourceResponseInfo& info) { | 568 const ResourceResponseInfo& info) { |
569 if (!client_) | 569 if (!client_) |
570 return false; | 570 return false; |
571 | 571 |
572 TRACE_EVENT_WITH_FLOW0( | 572 TRACE_EVENT_WITH_FLOW0( |
573 "loading", "WebURLLoaderImpl::Context::OnReceivedRedirect", | 573 "loading", "WebURLLoaderImpl::Context::OnReceivedRedirect", |
574 this, TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT); | 574 this, TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT); |
575 | 575 |
576 WebURLResponse response; | 576 WebURLResponse response; |
577 response.initialize(); | |
578 PopulateURLResponse(request_.url(), info, &response, | 577 PopulateURLResponse(request_.url(), info, &response, |
579 request_.reportRawHeaders()); | 578 request_.reportRawHeaders()); |
580 | 579 |
581 WebURLRequest new_request; | 580 WebURLRequest new_request; |
582 new_request.initialize(); | 581 new_request.initialize(); |
583 PopulateURLRequestForRedirect(request_, redirect_info, referrer_policy_, | 582 PopulateURLRequestForRedirect(request_, redirect_info, referrer_policy_, |
584 !info.was_fetched_via_service_worker, | 583 !info.was_fetched_via_service_worker, |
585 &new_request); | 584 &new_request); |
586 | 585 |
587 client_->willFollowRedirect(loader_, new_request, response); | 586 client_->willFollowRedirect(loader_, new_request, response); |
(...skipping 27 matching lines...) Expand all Loading... |
615 ResourceResponseInfo info = initial_info; | 614 ResourceResponseInfo info = initial_info; |
616 | 615 |
617 // PlzNavigate: during navigations, the ResourceResponse has already been | 616 // PlzNavigate: during navigations, the ResourceResponse has already been |
618 // received on the browser side, and has been passed down to the renderer. | 617 // received on the browser side, and has been passed down to the renderer. |
619 if (stream_override_.get()) { | 618 if (stream_override_.get()) { |
620 CHECK(IsBrowserSideNavigationEnabled()); | 619 CHECK(IsBrowserSideNavigationEnabled()); |
621 info = stream_override_->response; | 620 info = stream_override_->response; |
622 } | 621 } |
623 | 622 |
624 WebURLResponse response; | 623 WebURLResponse response; |
625 response.initialize(); | |
626 PopulateURLResponse(request_.url(), info, &response, | 624 PopulateURLResponse(request_.url(), info, &response, |
627 request_.reportRawHeaders()); | 625 request_.reportRawHeaders()); |
628 | 626 |
629 bool show_raw_listing = (GURL(request_.url()).query() == "raw"); | 627 bool show_raw_listing = (GURL(request_.url()).query() == "raw"); |
630 | 628 |
631 if (info.mime_type == "text/vnd.chromium.ftp-dir") { | 629 if (info.mime_type == "text/vnd.chromium.ftp-dir") { |
632 if (show_raw_listing) { | 630 if (show_raw_listing) { |
633 // Set the MIME type to plain text to prevent any active content. | 631 // Set the MIME type to plain text to prevent any active content. |
634 response.setMIMEType("text/plain"); | 632 response.setMIMEType("text/plain"); |
635 } else { | 633 } else { |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 response->clearHTTPHeaderField(webStringName); | 1196 response->clearHTTPHeaderField(webStringName); |
1199 while (response_headers->EnumerateHeader(&iterator, name, &value)) { | 1197 while (response_headers->EnumerateHeader(&iterator, name, &value)) { |
1200 response->addHTTPHeaderField(webStringName, | 1198 response->addHTTPHeaderField(webStringName, |
1201 WebString::fromLatin1(value)); | 1199 WebString::fromLatin1(value)); |
1202 } | 1200 } |
1203 } | 1201 } |
1204 return true; | 1202 return true; |
1205 } | 1203 } |
1206 | 1204 |
1207 } // namespace content | 1205 } // namespace content |
OLD | NEW |