| 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/renderer_host/resource_dispatcher_host.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 const content::ResourceContext& context) { | 887 const content::ResourceContext& context) { |
| 888 if (is_shutdown_) | 888 if (is_shutdown_) |
| 889 return net::ERR_INSUFFICIENT_RESOURCES; | 889 return net::ERR_INSUFFICIENT_RESOURCES; |
| 890 | 890 |
| 891 const GURL& url = request->original_url(); | 891 const GURL& url = request->original_url(); |
| 892 const net::URLRequestContext* request_context = context.request_context(); | 892 const net::URLRequestContext* request_context = context.request_context(); |
| 893 request->set_referrer(MaybeStripReferrer(GURL(request->referrer())).spec()); | 893 request->set_referrer(MaybeStripReferrer(GURL(request->referrer())).spec()); |
| 894 request->set_context(request_context); | 894 request->set_context(request_context); |
| 895 int extra_load_flags = net::LOAD_IS_DOWNLOAD; | 895 int extra_load_flags = net::LOAD_IS_DOWNLOAD; |
| 896 if (prefer_cache) { | 896 if (prefer_cache) { |
| 897 extra_load_flags |= net::LOAD_PREFERRING_CACHE; | 897 // If there is upload data attached, only retrieve from cache because there |
| 898 // is no current mechanism to prompt the user for their consent for a |
| 899 // re-post. For GETs, try to retrieve data from the cache and skip |
| 900 // validating the entry if present. |
| 901 if (request->get_upload() != NULL) |
| 902 extra_load_flags |= net::LOAD_ONLY_FROM_CACHE; |
| 903 else |
| 904 extra_load_flags |= net::LOAD_PREFERRING_CACHE; |
| 898 } else { | 905 } else { |
| 899 extra_load_flags |= net::LOAD_DISABLE_CACHE; | 906 extra_load_flags |= net::LOAD_DISABLE_CACHE; |
| 900 } | 907 } |
| 901 request->set_load_flags(request->load_flags() | extra_load_flags); | 908 request->set_load_flags(request->load_flags() | extra_load_flags); |
| 902 // Check if the renderer is permitted to request the requested URL. | 909 // Check if the renderer is permitted to request the requested URL. |
| 903 if (!ChildProcessSecurityPolicy::GetInstance()-> | 910 if (!ChildProcessSecurityPolicy::GetInstance()-> |
| 904 CanRequestURL(child_id, url)) { | 911 CanRequestURL(child_id, url)) { |
| 905 VLOG(1) << "Denied unauthorized download request for " | 912 VLOG(1) << "Denied unauthorized download request for " |
| 906 << url.possibly_invalid_spec(); | 913 << url.possibly_invalid_spec(); |
| 907 return net::ERR_ACCESS_DENIED; | 914 return net::ERR_ACCESS_DENIED; |
| (...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2269 scoped_refptr<ResourceHandler> transferred_resource_handler( | 2276 scoped_refptr<ResourceHandler> transferred_resource_handler( |
| 2270 new DoomedResourceHandler(info->resource_handler())); | 2277 new DoomedResourceHandler(info->resource_handler())); |
| 2271 info->set_resource_handler(transferred_resource_handler.get()); | 2278 info->set_resource_handler(transferred_resource_handler.get()); |
| 2272 } | 2279 } |
| 2273 | 2280 |
| 2274 bool ResourceDispatcherHost::IsTransferredNavigation( | 2281 bool ResourceDispatcherHost::IsTransferredNavigation( |
| 2275 const content::GlobalRequestID& transferred_request_id) const { | 2282 const content::GlobalRequestID& transferred_request_id) const { |
| 2276 return transferred_navigations_.find(transferred_request_id) != | 2283 return transferred_navigations_.find(transferred_request_id) != |
| 2277 transferred_navigations_.end(); | 2284 transferred_navigations_.end(); |
| 2278 } | 2285 } |
| OLD | NEW |