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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
711 is_content_initiated, must_download, &throttles); | 711 is_content_initiated, must_download, &throttles); |
712 if (!throttles.empty()) { | 712 if (!throttles.empty()) { |
713 handler.reset( | 713 handler.reset( |
714 new ThrottlingResourceHandler( | 714 new ThrottlingResourceHandler( |
715 handler.Pass(), request, throttles.Pass())); | 715 handler.Pass(), request, throttles.Pass())); |
716 } | 716 } |
717 } | 717 } |
718 return handler.Pass(); | 718 return handler.Pass(); |
719 } | 719 } |
720 | 720 |
721 scoped_ptr<ResourceHandler> | 721 scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::MaybeInterceptAsStream( |
722 ResourceDispatcherHostImpl::MaybeInterceptAsStream(net::URLRequest* request, | 722 const base::FilePath& plugin_path, |
723 ResourceResponse* response, | 723 net::URLRequest* request, |
724 std::string* payload) { | 724 ResourceResponse* response, |
725 std::string* payload) { | |
mmenke
2015/07/09 20:35:39
Suggest payload->clear() here. Makes for a cleare
raymes
2015/07/17 03:21:00
Done.
| |
725 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 726 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
726 const std::string& mime_type = response->head.mime_type; | 727 const std::string& mime_type = response->head.mime_type; |
727 | 728 |
728 GURL origin; | 729 GURL origin; |
729 if (!delegate_ || | 730 if (!delegate_ || |
730 !delegate_->ShouldInterceptResourceAsStream(request, | 731 !delegate_->ShouldInterceptResourceAsStream( |
731 mime_type, | 732 request, plugin_path, mime_type, &origin, payload)) { |
732 &origin, | |
733 payload)) { | |
734 return scoped_ptr<ResourceHandler>(); | 733 return scoped_ptr<ResourceHandler>(); |
735 } | 734 } |
736 | 735 |
737 StreamContext* stream_context = | 736 StreamContext* stream_context = |
738 GetStreamContextForResourceContext(info->GetContext()); | 737 GetStreamContextForResourceContext(info->GetContext()); |
739 | 738 |
740 scoped_ptr<StreamResourceHandler> handler( | 739 scoped_ptr<StreamResourceHandler> handler( |
741 new StreamResourceHandler(request, | 740 new StreamResourceHandler(request, |
742 stream_context->registry(), | 741 stream_context->registry(), |
743 origin)); | 742 origin)); |
(...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2360 | 2359 |
2361 // Add a flag to selectively bypass the data reduction proxy if the resource | 2360 // Add a flag to selectively bypass the data reduction proxy if the resource |
2362 // type is not an image. | 2361 // type is not an image. |
2363 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) | 2362 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) |
2364 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 2363 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
2365 | 2364 |
2366 return load_flags; | 2365 return load_flags; |
2367 } | 2366 } |
2368 | 2367 |
2369 } // namespace content | 2368 } // namespace content |
OLD | NEW |