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