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

Side by Side Diff: chrome/browser/renderer_host/resource_dispatcher_host.cc

Issue 1250002: Report unreadable files as size zero when uploading. (Closed)
Patch Set: Address comments Created 10 years, 8 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 unified diff | Download patch
« no previous file with comments | « base/file_util.h ('k') | chrome/common/common_param_traits.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/resource_dispatcher_host.h" 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 // Check if the renderer is permitted to request the requested URL. 126 // Check if the renderer is permitted to request the requested URL.
127 if (!policy->CanRequestURL(child_id, request_data.url)) { 127 if (!policy->CanRequestURL(child_id, request_data.url)) {
128 LOG(INFO) << "Denied unauthorized request for " << 128 LOG(INFO) << "Denied unauthorized request for " <<
129 request_data.url.possibly_invalid_spec(); 129 request_data.url.possibly_invalid_spec();
130 return false; 130 return false;
131 } 131 }
132 132
133 // Check if the renderer is permitted to upload the requested files. 133 // Check if the renderer is permitted to upload the requested files.
134 if (request_data.upload_data) { 134 if (request_data.upload_data) {
135 const std::vector<net::UploadData::Element>& uploads = 135 const std::vector<net::UploadData::Element>* uploads =
136 request_data.upload_data->elements(); 136 request_data.upload_data->elements();
137 std::vector<net::UploadData::Element>::const_iterator iter; 137 std::vector<net::UploadData::Element>::const_iterator iter;
138 for (iter = uploads.begin(); iter != uploads.end(); ++iter) { 138 for (iter = uploads->begin(); iter != uploads->end(); ++iter) {
139 if (iter->type() == net::UploadData::TYPE_FILE && 139 if (iter->type() == net::UploadData::TYPE_FILE &&
140 !policy->CanUploadFile(child_id, iter->file_path())) { 140 !policy->CanUploadFile(child_id, iter->file_path())) {
141 NOTREACHED() << "Denied unauthorized upload of " 141 NOTREACHED() << "Denied unauthorized upload of "
142 << iter->file_path().value(); 142 << iter->file_path().value();
143 return false; 143 return false;
144 } 144 }
145 } 145 }
146 } 146 }
147 147
148 return true; 148 return true;
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 const ResourceType::Type& resource_type, 1759 const ResourceType::Type& resource_type,
1760 ResourceDispatcherHostRequestInfo* request_info) { 1760 ResourceDispatcherHostRequestInfo* request_info) {
1761 // Apply filter only to chrome extension css files that don't have 1761 // Apply filter only to chrome extension css files that don't have
1762 // security filter already set. 1762 // security filter already set.
1763 if (url.SchemeIs(chrome::kExtensionScheme) && 1763 if (url.SchemeIs(chrome::kExtensionScheme) &&
1764 request_info->filter_policy() == FilterPolicy::DONT_FILTER && 1764 request_info->filter_policy() == FilterPolicy::DONT_FILTER &&
1765 resource_type == ResourceType::STYLESHEET) { 1765 resource_type == ResourceType::STYLESHEET) {
1766 request_info->set_filter_policy(FilterPolicy::FILTER_EXTENSION_MESSAGES); 1766 request_info->set_filter_policy(FilterPolicy::FILTER_EXTENSION_MESSAGES);
1767 } 1767 }
1768 } 1768 }
OLDNEW
« no previous file with comments | « base/file_util.h ('k') | chrome/common/common_param_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698