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/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 ChildProcessSecurityPolicyImpl::GetInstance(); | 175 ChildProcessSecurityPolicyImpl::GetInstance(); |
176 | 176 |
177 // Check if the renderer is permitted to request the requested URL. | 177 // Check if the renderer is permitted to request the requested URL. |
178 if (!policy->CanRequestURL(child_id, request_data.url)) { | 178 if (!policy->CanRequestURL(child_id, request_data.url)) { |
179 VLOG(1) << "Denied unauthorized request for " | 179 VLOG(1) << "Denied unauthorized request for " |
180 << request_data.url.possibly_invalid_spec(); | 180 << request_data.url.possibly_invalid_spec(); |
181 return false; | 181 return false; |
182 } | 182 } |
183 | 183 |
184 // Check if the renderer is permitted to upload the requested files. | 184 // Check if the renderer is permitted to upload the requested files. |
185 if (request_data.request_body) { | 185 if (request_data.request_body.get()) { |
186 const std::vector<ResourceRequestBody::Element>* uploads = | 186 const std::vector<ResourceRequestBody::Element>* uploads = |
187 request_data.request_body->elements(); | 187 request_data.request_body->elements(); |
188 std::vector<ResourceRequestBody::Element>::const_iterator iter; | 188 std::vector<ResourceRequestBody::Element>::const_iterator iter; |
189 for (iter = uploads->begin(); iter != uploads->end(); ++iter) { | 189 for (iter = uploads->begin(); iter != uploads->end(); ++iter) { |
190 if (iter->type() == ResourceRequestBody::Element::TYPE_FILE && | 190 if (iter->type() == ResourceRequestBody::Element::TYPE_FILE && |
191 !policy->CanReadFile(child_id, iter->path())) { | 191 !policy->CanReadFile(child_id, iter->path())) { |
192 NOTREACHED() << "Denied unauthorized upload of " | 192 NOTREACHED() << "Denied unauthorized upload of " |
193 << iter->path().value(); | 193 << iter->path().value(); |
194 return false; | 194 return false; |
195 } | 195 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) | 273 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) |
274 && !policy->CanReadRawCookies(child_id)) { | 274 && !policy->CanReadRawCookies(child_id)) { |
275 VLOG(1) << "Denied unauthorized request for raw headers"; | 275 VLOG(1) << "Denied unauthorized request for raw headers"; |
276 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; | 276 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; |
277 } | 277 } |
278 | 278 |
279 return load_flags; | 279 return load_flags; |
280 } | 280 } |
281 | 281 |
282 int GetCertID(net::URLRequest* request, int child_id) { | 282 int GetCertID(net::URLRequest* request, int child_id) { |
283 if (request->ssl_info().cert) { | 283 if (request->ssl_info().cert.get()) { |
284 return CertStore::GetInstance()->StoreCert(request->ssl_info().cert, | 284 return CertStore::GetInstance()->StoreCert(request->ssl_info().cert.get(), |
285 child_id); | 285 child_id); |
286 } | 286 } |
287 return 0; | 287 return 0; |
288 } | 288 } |
289 | 289 |
290 template <class T> | 290 template <class T> |
291 void NotifyOnUI(int type, int render_process_id, int render_view_id, | 291 void NotifyOnUI(int type, int render_process_id, int render_view_id, |
292 scoped_ptr<T> detail) { | 292 scoped_ptr<T> detail) { |
293 RenderViewHostImpl* host = | 293 RenderViewHostImpl* host = |
294 RenderViewHostImpl::FromID(render_process_id, render_view_id); | 294 RenderViewHostImpl::FromID(render_process_id, render_view_id); |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 request->SetExtraRequestHeaders(headers); | 1002 request->SetExtraRequestHeaders(headers); |
1003 } | 1003 } |
1004 | 1004 |
1005 // TODO(darin): Do we really need all of these URLRequest setters in the | 1005 // TODO(darin): Do we really need all of these URLRequest setters in the |
1006 // transferred navigation case? | 1006 // transferred navigation case? |
1007 | 1007 |
1008 request->set_load_flags(load_flags); | 1008 request->set_load_flags(load_flags); |
1009 request->SetPriority(request_data.priority); | 1009 request->SetPriority(request_data.priority); |
1010 | 1010 |
1011 // Resolve elements from request_body and prepare upload data. | 1011 // Resolve elements from request_body and prepare upload data. |
1012 if (request_data.request_body) { | 1012 if (request_data.request_body.get()) { |
1013 request->set_upload(make_scoped_ptr( | 1013 request->set_upload(make_scoped_ptr( |
1014 request_data.request_body->ResolveElementsAndCreateUploadDataStream( | 1014 request_data.request_body->ResolveElementsAndCreateUploadDataStream( |
1015 filter_->blob_storage_context()->controller(), | 1015 filter_->blob_storage_context()->controller(), |
1016 filter_->file_system_context(), | 1016 filter_->file_system_context(), |
1017 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)))); | 1017 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)))); |
1018 } | 1018 } |
1019 | 1019 |
1020 bool allow_download = request_data.allow_download && | 1020 bool allow_download = request_data.allow_download && |
1021 ResourceType::IsFrame(request_data.resource_type); | 1021 ResourceType::IsFrame(request_data.resource_type); |
1022 | 1022 |
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1866 DelegateMap::iterator it = delegate_map_.find(id); | 1866 DelegateMap::iterator it = delegate_map_.find(id); |
1867 DCHECK(it->second->HasObserver(delegate)); | 1867 DCHECK(it->second->HasObserver(delegate)); |
1868 it->second->RemoveObserver(delegate); | 1868 it->second->RemoveObserver(delegate); |
1869 if (it->second->size() == 0) { | 1869 if (it->second->size() == 0) { |
1870 delete it->second; | 1870 delete it->second; |
1871 delegate_map_.erase(it); | 1871 delegate_map_.erase(it); |
1872 } | 1872 } |
1873 } | 1873 } |
1874 | 1874 |
1875 } // namespace content | 1875 } // namespace content |
OLD | NEW |