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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 handler.reset( | 601 handler.reset( |
602 new ThrottlingResourceHandler( | 602 new ThrottlingResourceHandler( |
603 handler.Pass(), request, throttles.Pass())); | 603 handler.Pass(), request, throttles.Pass())); |
604 } | 604 } |
605 } | 605 } |
606 return handler.Pass(); | 606 return handler.Pass(); |
607 } | 607 } |
608 | 608 |
609 scoped_ptr<ResourceHandler> | 609 scoped_ptr<ResourceHandler> |
610 ResourceDispatcherHostImpl::MaybeInterceptAsStream(net::URLRequest* request, | 610 ResourceDispatcherHostImpl::MaybeInterceptAsStream(net::URLRequest* request, |
611 ResourceResponse* response) { | 611 ResourceResponse* response, |
| 612 std::string* payload) { |
612 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 613 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
613 const std::string& mime_type = response->head.mime_type; | 614 const std::string& mime_type = response->head.mime_type; |
614 | 615 |
615 GURL origin; | 616 GURL origin; |
616 std::string target_id; | 617 std::string target_id; |
| 618 std::string view_id; |
617 if (!delegate_ || | 619 if (!delegate_ || |
618 !delegate_->ShouldInterceptResourceAsStream(info->GetContext(), | 620 !delegate_->ShouldInterceptResourceAsStream(info->GetContext(), |
619 request->url(), | 621 request->url(), |
620 mime_type, | 622 mime_type, |
621 &origin, | 623 &origin, |
622 &target_id)) { | 624 &target_id, |
| 625 payload, |
| 626 &view_id)) { |
623 return scoped_ptr<ResourceHandler>(); | 627 return scoped_ptr<ResourceHandler>(); |
624 } | 628 } |
625 | 629 |
626 StreamContext* stream_context = | 630 StreamContext* stream_context = |
627 GetStreamContextForResourceContext(info->GetContext()); | 631 GetStreamContextForResourceContext(info->GetContext()); |
628 | 632 |
629 scoped_ptr<StreamResourceHandler> handler( | 633 scoped_ptr<StreamResourceHandler> handler( |
630 new StreamResourceHandler(request, | 634 new StreamResourceHandler(request, |
631 stream_context->registry(), | 635 stream_context->registry(), |
632 origin)); | 636 origin)); |
633 | 637 |
634 info->set_is_stream(true); | 638 info->set_is_stream(true); |
635 delegate_->OnStreamCreated( | 639 delegate_->OnStreamCreated( |
636 info->GetContext(), | 640 info->GetContext(), |
637 info->GetChildID(), | 641 info->GetChildID(), |
638 info->GetRouteID(), | 642 info->GetRouteID(), |
639 target_id, | 643 target_id, |
| 644 view_id, |
640 handler->stream()->CreateHandle( | 645 handler->stream()->CreateHandle( |
641 request->url(), | 646 request->url(), |
642 mime_type, | 647 mime_type, |
643 response->head.headers), | 648 response->head.headers), |
644 request->GetExpectedContentSize()); | 649 request->GetExpectedContentSize()); |
645 return handler.PassAs<ResourceHandler>(); | 650 return handler.PassAs<ResourceHandler>(); |
646 } | 651 } |
647 | 652 |
648 void ResourceDispatcherHostImpl::ClearSSLClientAuthHandlerForRequest( | 653 void ResourceDispatcherHostImpl::ClearSSLClientAuthHandlerForRequest( |
649 net::URLRequest* request) { | 654 net::URLRequest* request) { |
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1978 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) | 1983 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) |
1979 && !policy->CanReadRawCookies(child_id)) { | 1984 && !policy->CanReadRawCookies(child_id)) { |
1980 VLOG(1) << "Denied unauthorized request for raw headers"; | 1985 VLOG(1) << "Denied unauthorized request for raw headers"; |
1981 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; | 1986 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; |
1982 } | 1987 } |
1983 | 1988 |
1984 return load_flags; | 1989 return load_flags; |
1985 } | 1990 } |
1986 | 1991 |
1987 } // namespace content | 1992 } // namespace content |
OLD | NEW |