| 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 if (!delegate_ || | 617 if (!delegate_ || |
| 618 !delegate_->ShouldInterceptResourceAsStream(info->GetContext(), | 618 !delegate_->ShouldInterceptResourceAsStream(request, |
| 619 request->url(), | |
| 620 mime_type, | 619 mime_type, |
| 621 &origin, | 620 &origin, |
| 622 &target_id)) { | 621 payload)) { |
| 623 return scoped_ptr<ResourceHandler>(); | 622 return scoped_ptr<ResourceHandler>(); |
| 624 } | 623 } |
| 625 | 624 |
| 626 StreamContext* stream_context = | 625 StreamContext* stream_context = |
| 627 GetStreamContextForResourceContext(info->GetContext()); | 626 GetStreamContextForResourceContext(info->GetContext()); |
| 628 | 627 |
| 629 scoped_ptr<StreamResourceHandler> handler( | 628 scoped_ptr<StreamResourceHandler> handler( |
| 630 new StreamResourceHandler(request, | 629 new StreamResourceHandler(request, |
| 631 stream_context->registry(), | 630 stream_context->registry(), |
| 632 origin)); | 631 origin)); |
| 633 | 632 |
| 634 info->set_is_stream(true); | 633 info->set_is_stream(true); |
| 635 delegate_->OnStreamCreated( | 634 delegate_->OnStreamCreated( |
| 636 info->GetContext(), | 635 request, |
| 637 info->GetChildID(), | |
| 638 info->GetRouteID(), | |
| 639 target_id, | |
| 640 handler->stream()->CreateHandle( | 636 handler->stream()->CreateHandle( |
| 641 request->url(), | 637 request->url(), |
| 642 mime_type, | 638 mime_type, |
| 643 response->head.headers), | 639 response->head.headers)); |
| 644 request->GetExpectedContentSize()); | |
| 645 return handler.PassAs<ResourceHandler>(); | 640 return handler.PassAs<ResourceHandler>(); |
| 646 } | 641 } |
| 647 | 642 |
| 648 void ResourceDispatcherHostImpl::ClearSSLClientAuthHandlerForRequest( | 643 void ResourceDispatcherHostImpl::ClearSSLClientAuthHandlerForRequest( |
| 649 net::URLRequest* request) { | 644 net::URLRequest* request) { |
| 650 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 645 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
| 651 if (info) { | 646 if (info) { |
| 652 ResourceLoader* loader = GetLoader(info->GetGlobalRequestID()); | 647 ResourceLoader* loader = GetLoader(info->GetGlobalRequestID()); |
| 653 if (loader) | 648 if (loader) |
| 654 loader->ClearSSLClientAuthHandler(); | 649 loader->ClearSSLClientAuthHandler(); |
| (...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1978 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) | 1973 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) |
| 1979 && !policy->CanReadRawCookies(child_id)) { | 1974 && !policy->CanReadRawCookies(child_id)) { |
| 1980 VLOG(1) << "Denied unauthorized request for raw headers"; | 1975 VLOG(1) << "Denied unauthorized request for raw headers"; |
| 1981 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; | 1976 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; |
| 1982 } | 1977 } |
| 1983 | 1978 |
| 1984 return load_flags; | 1979 return load_flags; |
| 1985 } | 1980 } |
| 1986 | 1981 |
| 1987 } // namespace content | 1982 } // namespace content |
| OLD | NEW |