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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 is_content_initiated, must_download, &throttles); | 720 is_content_initiated, must_download, &throttles); |
721 if (!throttles.empty()) { | 721 if (!throttles.empty()) { |
722 handler.reset( | 722 handler.reset( |
723 new ThrottlingResourceHandler( | 723 new ThrottlingResourceHandler( |
724 handler.Pass(), request, throttles.Pass())); | 724 handler.Pass(), request, throttles.Pass())); |
725 } | 725 } |
726 } | 726 } |
727 return handler.Pass(); | 727 return handler.Pass(); |
728 } | 728 } |
729 | 729 |
730 scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::MaybeInterceptAsStream( | 730 scoped_ptr<ResourceHandler> |
731 const base::FilePath& plugin_path, | 731 ResourceDispatcherHostImpl::MaybeInterceptAsStream(net::URLRequest* request, |
732 net::URLRequest* request, | 732 ResourceResponse* response, |
733 ResourceResponse* response, | 733 std::string* payload) { |
734 std::string* payload) { | |
735 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 734 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
736 const std::string& mime_type = response->head.mime_type; | 735 const std::string& mime_type = response->head.mime_type; |
737 | 736 |
738 GURL origin; | 737 GURL origin; |
739 if (!delegate_ || | 738 if (!delegate_ || |
740 !delegate_->ShouldInterceptResourceAsStream( | 739 !delegate_->ShouldInterceptResourceAsStream(request, |
741 request, plugin_path, mime_type, &origin, payload)) { | 740 mime_type, |
| 741 &origin, |
| 742 payload)) { |
742 return scoped_ptr<ResourceHandler>(); | 743 return scoped_ptr<ResourceHandler>(); |
743 } | 744 } |
744 | 745 |
745 StreamContext* stream_context = | 746 StreamContext* stream_context = |
746 GetStreamContextForResourceContext(info->GetContext()); | 747 GetStreamContextForResourceContext(info->GetContext()); |
747 | 748 |
748 scoped_ptr<StreamResourceHandler> handler( | 749 scoped_ptr<StreamResourceHandler> handler( |
749 new StreamResourceHandler(request, | 750 new StreamResourceHandler(request, |
750 stream_context->registry(), | 751 stream_context->registry(), |
751 origin)); | 752 origin)); |
(...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2349 | 2350 |
2350 // Add a flag to selectively bypass the data reduction proxy if the resource | 2351 // Add a flag to selectively bypass the data reduction proxy if the resource |
2351 // type is not an image. | 2352 // type is not an image. |
2352 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) | 2353 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) |
2353 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 2354 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
2354 | 2355 |
2355 return load_flags; | 2356 return load_flags; |
2356 } | 2357 } |
2357 | 2358 |
2358 } // namespace content | 2359 } // namespace content |
OLD | NEW |