| 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) { |
| 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 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2368 | 2367 |
| 2369 // Add a flag to selectively bypass the data reduction proxy if the resource | 2368 // Add a flag to selectively bypass the data reduction proxy if the resource |
| 2370 // type is not an image. | 2369 // type is not an image. |
| 2371 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) | 2370 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) |
| 2372 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 2371 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
| 2373 | 2372 |
| 2374 return load_flags; | 2373 return load_flags; |
| 2375 } | 2374 } |
| 2376 | 2375 |
| 2377 } // namespace content | 2376 } // namespace content |
| OLD | NEW |