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