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_impl.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 #include "net/http/http_response_info.h" | 76 #include "net/http/http_response_info.h" |
77 #include "net/http/http_transaction_factory.h" | 77 #include "net/http/http_transaction_factory.h" |
78 #include "net/url_request/url_request.h" | 78 #include "net/url_request/url_request.h" |
79 #include "net/url_request/url_request_context.h" | 79 #include "net/url_request/url_request_context.h" |
80 #include "net/url_request/url_request_job_factory.h" | 80 #include "net/url_request/url_request_job_factory.h" |
81 #include "webkit/appcache/appcache_interceptor.h" | 81 #include "webkit/appcache/appcache_interceptor.h" |
82 #include "webkit/appcache/appcache_interfaces.h" | 82 #include "webkit/appcache/appcache_interfaces.h" |
83 #include "webkit/blob/blob_storage_controller.h" | 83 #include "webkit/blob/blob_storage_controller.h" |
84 #include "webkit/blob/shareable_file_reference.h" | 84 #include "webkit/blob/shareable_file_reference.h" |
85 #include "webkit/glue/webkit_glue.h" | 85 #include "webkit/glue/webkit_glue.h" |
| 86 #include "webkit/glue/webupload_data.h" |
86 | 87 |
87 using base::Time; | 88 using base::Time; |
88 using base::TimeDelta; | 89 using base::TimeDelta; |
89 using base::TimeTicks; | 90 using base::TimeTicks; |
90 using webkit_blob::ShareableFileReference; | 91 using webkit_blob::ShareableFileReference; |
91 | 92 |
92 // ---------------------------------------------------------------------------- | 93 // ---------------------------------------------------------------------------- |
93 | 94 |
94 namespace content { | 95 namespace content { |
95 | 96 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 166 |
166 // Check if the renderer is permitted to request the requested URL. | 167 // Check if the renderer is permitted to request the requested URL. |
167 if (!policy->CanRequestURL(child_id, request_data.url)) { | 168 if (!policy->CanRequestURL(child_id, request_data.url)) { |
168 VLOG(1) << "Denied unauthorized request for " | 169 VLOG(1) << "Denied unauthorized request for " |
169 << request_data.url.possibly_invalid_spec(); | 170 << request_data.url.possibly_invalid_spec(); |
170 return false; | 171 return false; |
171 } | 172 } |
172 | 173 |
173 // Check if the renderer is permitted to upload the requested files. | 174 // Check if the renderer is permitted to upload the requested files. |
174 if (request_data.upload_data) { | 175 if (request_data.upload_data) { |
175 const std::vector<net::UploadData::Element>* uploads = | 176 const std::vector<WebUploadData::Element>* uploads = |
176 request_data.upload_data->elements(); | 177 request_data.upload_data->elements(); |
177 std::vector<net::UploadData::Element>::const_iterator iter; | 178 std::vector<WebUploadData::Element>::const_iterator iter; |
178 for (iter = uploads->begin(); iter != uploads->end(); ++iter) { | 179 for (iter = uploads->begin(); iter != uploads->end(); ++iter) { |
179 if (iter->type() == net::UploadData::TYPE_FILE && | 180 if (iter->type() == WebUploadData::TYPE_FILE && |
180 !policy->CanReadFile(child_id, iter->file_path())) { | 181 !policy->CanReadFile(child_id, iter->file_path())) { |
181 NOTREACHED() << "Denied unauthorized upload of " | 182 NOTREACHED() << "Denied unauthorized upload of " |
182 << iter->file_path().value(); | 183 << iter->file_path().value(); |
183 return false; | 184 return false; |
184 } | 185 } |
185 } | 186 } |
186 } | 187 } |
187 | 188 |
188 return true; | 189 return true; |
189 } | 190 } |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 // TODO(darin): Do we really need all of these URLRequest setters in the | 958 // TODO(darin): Do we really need all of these URLRequest setters in the |
958 // transferred navigation case? | 959 // transferred navigation case? |
959 | 960 |
960 request->set_load_flags(load_flags); | 961 request->set_load_flags(load_flags); |
961 | 962 |
962 request->set_priority(DetermineRequestPriority(request_data.resource_type)); | 963 request->set_priority(DetermineRequestPriority(request_data.resource_type)); |
963 | 964 |
964 // Set upload data. | 965 // Set upload data. |
965 uint64 upload_size = 0; | 966 uint64 upload_size = 0; |
966 if (request_data.upload_data) { | 967 if (request_data.upload_data) { |
967 request->set_upload(request_data.upload_data); | 968 scoped_refptr<net::UploadData> upload = new net::UploadData; |
| 969 request_data.upload_data->PopulateUploadData(upload.get()); |
| 970 request->set_upload(upload); |
968 // This results in performing file IO. crbug.com/112607. | 971 // This results in performing file IO. crbug.com/112607. |
969 base::ThreadRestrictions::ScopedAllowIO allow_io; | 972 base::ThreadRestrictions::ScopedAllowIO allow_io; |
970 upload_size = request_data.upload_data->GetContentLengthSync(); | 973 upload_size = upload->GetContentLengthSync(); |
971 } | 974 } |
972 | 975 |
973 bool allow_download = request_data.allow_download && | 976 bool allow_download = request_data.allow_download && |
974 ResourceType::IsFrame(request_data.resource_type); | 977 ResourceType::IsFrame(request_data.resource_type); |
975 | 978 |
976 // Make extra info and read footer (contains request ID). | 979 // Make extra info and read footer (contains request ID). |
977 ResourceRequestInfoImpl* extra_info = | 980 ResourceRequestInfoImpl* extra_info = |
978 new ResourceRequestInfoImpl( | 981 new ResourceRequestInfoImpl( |
979 process_type, | 982 process_type, |
980 child_id, | 983 child_id, |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1730 | 1733 |
1731 return i->second.get(); | 1734 return i->second.get(); |
1732 } | 1735 } |
1733 | 1736 |
1734 ResourceLoader* ResourceDispatcherHostImpl::GetLoader(int child_id, | 1737 ResourceLoader* ResourceDispatcherHostImpl::GetLoader(int child_id, |
1735 int request_id) const { | 1738 int request_id) const { |
1736 return GetLoader(GlobalRequestID(child_id, request_id)); | 1739 return GetLoader(GlobalRequestID(child_id, request_id)); |
1737 } | 1740 } |
1738 | 1741 |
1739 } // namespace content | 1742 } // namespace content |
OLD | NEW |