OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
6 | 6 |
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 is_content_initiated, must_download, &throttles); | 598 is_content_initiated, must_download, &throttles); |
599 if (!throttles.empty()) { | 599 if (!throttles.empty()) { |
600 handler.reset( | 600 handler.reset( |
601 new ThrottlingResourceHandler( | 601 new ThrottlingResourceHandler( |
602 handler.Pass(), request, throttles.Pass())); | 602 handler.Pass(), request, throttles.Pass())); |
603 } | 603 } |
604 } | 604 } |
605 return handler.Pass(); | 605 return handler.Pass(); |
606 } | 606 } |
607 | 607 |
608 scoped_ptr<ResourceHandler> | 608 scoped_ptr<StreamResourceHandler> |
609 ResourceDispatcherHostImpl::MaybeInterceptAsStream(net::URLRequest* request, | 609 ResourceDispatcherHostImpl::MaybeInterceptAsStream(net::URLRequest* request, |
610 ResourceResponse* response) { | 610 ResourceResponse* response) { |
611 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 611 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
612 const std::string& mime_type = response->head.mime_type; | 612 const std::string& mime_type = response->head.mime_type; |
613 | 613 |
614 GURL origin; | 614 GURL origin; |
615 std::string target_id; | 615 std::string target_id; |
| 616 std::string payload; |
| 617 std::string view_id; |
616 if (!delegate_ || | 618 if (!delegate_ || |
617 !delegate_->ShouldInterceptResourceAsStream(info->GetContext(), | 619 !delegate_->ShouldInterceptResourceAsStream(info->GetContext(), |
618 request->url(), | 620 request->url(), |
619 mime_type, | 621 mime_type, |
620 &origin, | 622 &origin, |
621 &target_id)) { | 623 &target_id, |
622 return scoped_ptr<ResourceHandler>(); | 624 &payload, |
| 625 &view_id)) { |
| 626 return scoped_ptr<StreamResourceHandler>(); |
623 } | 627 } |
624 | 628 |
625 StreamContext* stream_context = | 629 StreamContext* stream_context = |
626 GetStreamContextForResourceContext(info->GetContext()); | 630 GetStreamContextForResourceContext(info->GetContext()); |
627 | 631 |
628 scoped_ptr<StreamResourceHandler> handler( | 632 scoped_ptr<StreamResourceHandler> handler( |
629 new StreamResourceHandler(request, | 633 new StreamResourceHandler(request, |
630 stream_context->registry(), | 634 stream_context->registry(), |
631 origin)); | 635 origin, |
| 636 payload)); |
632 | 637 |
633 info->set_is_stream(true); | 638 info->set_is_stream(true); |
634 delegate_->OnStreamCreated( | 639 delegate_->OnStreamCreated( |
635 info->GetContext(), | 640 info->GetContext(), |
636 info->GetChildID(), | 641 info->GetChildID(), |
637 info->GetRouteID(), | 642 info->GetRouteID(), |
638 target_id, | 643 target_id, |
| 644 view_id, |
639 handler->stream()->CreateHandle( | 645 handler->stream()->CreateHandle( |
640 request->url(), | 646 request->url(), |
641 mime_type, | 647 mime_type, |
642 response->head.headers), | 648 response->head.headers), |
643 request->GetExpectedContentSize()); | 649 request->GetExpectedContentSize()); |
644 return handler.PassAs<ResourceHandler>(); | 650 return handler.Pass(); |
645 } | 651 } |
646 | 652 |
647 void ResourceDispatcherHostImpl::ClearSSLClientAuthHandlerForRequest( | 653 void ResourceDispatcherHostImpl::ClearSSLClientAuthHandlerForRequest( |
648 net::URLRequest* request) { | 654 net::URLRequest* request) { |
649 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 655 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
650 if (info) { | 656 if (info) { |
651 ResourceLoader* loader = GetLoader(info->GetGlobalRequestID()); | 657 ResourceLoader* loader = GetLoader(info->GetGlobalRequestID()); |
652 if (loader) | 658 if (loader) |
653 loader->ClearSSLClientAuthHandler(); | 659 loader->ClearSSLClientAuthHandler(); |
654 } | 660 } |
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) | 2040 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) |
2035 && !policy->CanReadRawCookies(child_id)) { | 2041 && !policy->CanReadRawCookies(child_id)) { |
2036 VLOG(1) << "Denied unauthorized request for raw headers"; | 2042 VLOG(1) << "Denied unauthorized request for raw headers"; |
2037 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; | 2043 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; |
2038 } | 2044 } |
2039 | 2045 |
2040 return load_flags; | 2046 return load_flags; |
2041 } | 2047 } |
2042 | 2048 |
2043 } // namespace content | 2049 } // namespace content |
OLD | NEW |