Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(837)

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2905763002: Deduplicating CanReadRequestBody code. (Closed)
Patch Set: Rebasing... Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index a4b99cdddfbe7dfbf734241293e72d09bf92daf1..e1eb84a567266e84805899152daa7bd1a5469b00 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -2663,30 +2663,13 @@ bool ResourceDispatcherHostImpl::ShouldServiceRequest(
}
// Check if the renderer is permitted to upload the requested files.
- if (request_data.request_body.get()) {
- const std::vector<ResourceRequestBodyImpl::Element>* uploads =
- request_data.request_body->elements();
- std::vector<ResourceRequestBodyImpl::Element>::const_iterator iter;
- for (iter = uploads->begin(); iter != uploads->end(); ++iter) {
- if (iter->type() == ResourceRequestBodyImpl::Element::TYPE_FILE &&
- !policy->CanReadFile(child_id, iter->path())) {
- NOTREACHED() << "Denied unauthorized upload of "
- << iter->path().value();
- return false;
- }
- if (iter->type() ==
- ResourceRequestBodyImpl::Element::TYPE_FILE_FILESYSTEM) {
- storage::FileSystemURL url =
- requester_info->file_system_context()->CrackURL(
- iter->filesystem_url());
- if (!policy->CanReadFileSystemFile(child_id, url)) {
- NOTREACHED() << "Denied unauthorized upload of "
- << iter->filesystem_url().spec();
- return false;
- }
- }
- }
+ if (!policy->CanReadRequestBody(child_id,
+ requester_info->file_system_context(),
+ request_data.request_body)) {
+ NOTREACHED() << "Denied unauthorized upload";
+ return false;
}
+
return true;
}
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698