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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 is_content_initiated, must_download, &throttles); | 710 is_content_initiated, must_download, &throttles); |
711 if (!throttles.empty()) { | 711 if (!throttles.empty()) { |
712 handler.reset( | 712 handler.reset( |
713 new ThrottlingResourceHandler( | 713 new ThrottlingResourceHandler( |
714 handler.Pass(), request, throttles.Pass())); | 714 handler.Pass(), request, throttles.Pass())); |
715 } | 715 } |
716 } | 716 } |
717 return handler.Pass(); | 717 return handler.Pass(); |
718 } | 718 } |
719 | 719 |
720 scoped_ptr<ResourceHandler> | 720 scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::MaybeInterceptAsStream( |
721 ResourceDispatcherHostImpl::MaybeInterceptAsStream(net::URLRequest* request, | 721 const base::FilePath& plugin_path, |
722 ResourceResponse* response, | 722 net::URLRequest* request, |
723 std::string* payload) { | 723 ResourceResponse* response, |
| 724 std::string* payload) { |
724 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 725 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
725 const std::string& mime_type = response->head.mime_type; | 726 const std::string& mime_type = response->head.mime_type; |
726 | 727 |
727 GURL origin; | 728 GURL origin; |
728 if (!delegate_ || | 729 if (!delegate_ || |
729 !delegate_->ShouldInterceptResourceAsStream(request, | 730 !delegate_->ShouldInterceptResourceAsStream( |
730 mime_type, | 731 request, plugin_path, mime_type, &origin, payload)) { |
731 &origin, | |
732 payload)) { | |
733 return scoped_ptr<ResourceHandler>(); | 732 return scoped_ptr<ResourceHandler>(); |
734 } | 733 } |
735 | 734 |
736 StreamContext* stream_context = | 735 StreamContext* stream_context = |
737 GetStreamContextForResourceContext(info->GetContext()); | 736 GetStreamContextForResourceContext(info->GetContext()); |
738 | 737 |
739 scoped_ptr<StreamResourceHandler> handler( | 738 scoped_ptr<StreamResourceHandler> handler( |
740 new StreamResourceHandler(request, | 739 new StreamResourceHandler(request, |
741 stream_context->registry(), | 740 stream_context->registry(), |
742 origin)); | 741 origin)); |
(...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2366 | 2365 |
2367 // Add a flag to selectively bypass the data reduction proxy if the resource | 2366 // Add a flag to selectively bypass the data reduction proxy if the resource |
2368 // type is not an image. | 2367 // type is not an image. |
2369 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) | 2368 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) |
2370 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 2369 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
2371 | 2370 |
2372 return load_flags; | 2371 return load_flags; |
2373 } | 2372 } |
2374 | 2373 |
2375 } // namespace content | 2374 } // namespace content |
OLD | NEW |