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