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

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 23223003: Chromium Blob hacking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 #include "net/cookies/cookie_monster.h" 80 #include "net/cookies/cookie_monster.h"
81 #include "net/http/http_cache.h" 81 #include "net/http/http_cache.h"
82 #include "net/http/http_response_headers.h" 82 #include "net/http/http_response_headers.h"
83 #include "net/http/http_response_info.h" 83 #include "net/http/http_response_info.h"
84 #include "net/http/http_transaction_factory.h" 84 #include "net/http/http_transaction_factory.h"
85 #include "net/ssl/ssl_cert_request_info.h" 85 #include "net/ssl/ssl_cert_request_info.h"
86 #include "net/url_request/url_request.h" 86 #include "net/url_request/url_request.h"
87 #include "net/url_request/url_request_context.h" 87 #include "net/url_request/url_request_context.h"
88 #include "net/url_request/url_request_job_factory.h" 88 #include "net/url_request/url_request_job_factory.h"
89 #include "webkit/browser/appcache/appcache_interceptor.h" 89 #include "webkit/browser/appcache/appcache_interceptor.h"
90 #include "webkit/browser/blob/blob_storage_controller.h" 90 #include "webkit/common/blob/blob_data.h"
91 #include "webkit/browser/blob/blob_data_handle.h"
92 #include "webkit/browser/blob/blob_storage_context.h"
93 #include "webkit/browser/blob/blob_url_request_job_factory.h"
91 #include "webkit/browser/fileapi/file_permission_policy.h" 94 #include "webkit/browser/fileapi/file_permission_policy.h"
92 #include "webkit/browser/fileapi/file_system_context.h" 95 #include "webkit/browser/fileapi/file_system_context.h"
93 #include "webkit/common/appcache/appcache_interfaces.h" 96 #include "webkit/common/appcache/appcache_interfaces.h"
94 #include "webkit/common/blob/shareable_file_reference.h" 97 #include "webkit/common/blob/shareable_file_reference.h"
95 #include "webkit/common/resource_request_body.h" 98 #include "webkit/common/resource_request_body.h"
96 99
97 using base::Time; 100 using base::Time;
98 using base::TimeDelta; 101 using base::TimeDelta;
99 using base::TimeTicks; 102 using base::TimeTicks;
100 using webkit_blob::ShareableFileReference; 103 using webkit_blob::ShareableFileReference;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 request_data.request_body->elements(); 212 request_data.request_body->elements();
210 std::vector<ResourceRequestBody::Element>::const_iterator iter; 213 std::vector<ResourceRequestBody::Element>::const_iterator iter;
211 for (iter = uploads->begin(); iter != uploads->end(); ++iter) { 214 for (iter = uploads->begin(); iter != uploads->end(); ++iter) {
212 if (iter->type() == ResourceRequestBody::Element::TYPE_FILE && 215 if (iter->type() == ResourceRequestBody::Element::TYPE_FILE &&
213 !policy->CanReadFile(child_id, iter->path())) { 216 !policy->CanReadFile(child_id, iter->path())) {
214 NOTREACHED() << "Denied unauthorized upload of " 217 NOTREACHED() << "Denied unauthorized upload of "
215 << iter->path().value(); 218 << iter->path().value();
216 return false; 219 return false;
217 } 220 }
218 if (iter->type() == ResourceRequestBody::Element::TYPE_FILE_FILESYSTEM) { 221 if (iter->type() == ResourceRequestBody::Element::TYPE_FILE_FILESYSTEM) {
219 fileapi::FileSystemURL url = file_system_context->CrackURL(iter->url()); 222 fileapi::FileSystemURL url =
223 file_system_context->CrackURL(iter->filesystem_url());
220 if (!policy->HasPermissionsForFileSystemFile( 224 if (!policy->HasPermissionsForFileSystemFile(
221 child_id, url, fileapi::kReadFilePermissions)) { 225 child_id, url, fileapi::kReadFilePermissions)) {
222 NOTREACHED() << "Denied unauthorized upload of " 226 NOTREACHED() << "Denied unauthorized upload of "
223 << iter->url().spec(); 227 << iter->filesystem_url().spec();
224 return false; 228 return false;
225 } 229 }
226 } 230 }
227 } 231 }
228 } 232 }
229 233
230 return true; 234 return true;
231 } 235 }
232 236
233 void RemoveDownloadFileFromChildSecurityPolicy(int child_id, 237 void RemoveDownloadFileFromChildSecurityPolicy(int child_id,
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 // TODO(darin): Do we really need all of these URLRequest setters in the 979 // TODO(darin): Do we really need all of these URLRequest setters in the
976 // transferred navigation case? 980 // transferred navigation case?
977 981
978 request->set_load_flags(load_flags); 982 request->set_load_flags(load_flags);
979 request->SetPriority(request_data.priority); 983 request->SetPriority(request_data.priority);
980 984
981 // Resolve elements from request_body and prepare upload data. 985 // Resolve elements from request_body and prepare upload data.
982 if (request_data.request_body.get()) { 986 if (request_data.request_body.get()) {
983 request->set_upload(UploadDataStreamBuilder::Build( 987 request->set_upload(UploadDataStreamBuilder::Build(
984 request_data.request_body.get(), 988 request_data.request_body.get(),
985 filter_->blob_storage_context()->controller(), 989 filter_->blob_storage_context()->context(),
986 filter_->file_system_context(), 990 filter_->file_system_context(),
987 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) 991 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)
988 .get())); 992 .get()));
989 } 993 }
990 994
991 bool allow_download = request_data.allow_download && 995 bool allow_download = request_data.allow_download &&
992 ResourceType::IsFrame(request_data.resource_type); 996 ResourceType::IsFrame(request_data.resource_type);
993 997
994 // Make extra info and read footer (contains request ID). 998 // Make extra info and read footer (contains request ID).
995 ResourceRequestInfoImpl* extra_info = 999 ResourceRequestInfoImpl* extra_info =
(...skipping 14 matching lines...) Expand all
1010 allow_download, 1014 allow_download,
1011 request_data.has_user_gesture, 1015 request_data.has_user_gesture,
1012 request_data.referrer_policy, 1016 request_data.referrer_policy,
1013 resource_context, 1017 resource_context,
1014 !is_sync_load); 1018 !is_sync_load);
1015 extra_info->AssociateWithRequest(request); // Request takes ownership. 1019 extra_info->AssociateWithRequest(request); // Request takes ownership.
1016 1020
1017 if (request->url().SchemeIs(chrome::kBlobScheme)) { 1021 if (request->url().SchemeIs(chrome::kBlobScheme)) {
1018 // Hang on to a reference to ensure the blob is not released prior 1022 // Hang on to a reference to ensure the blob is not released prior
1019 // to the job being started. 1023 // to the job being started.
1020 extra_info->set_requested_blob_data( 1024 webkit_blob::BlobProtocolHandler::SetRequestedBlobDataHandle(
1021 filter_->blob_storage_context()->controller()-> 1025 request,
1022 GetBlobDataFromUrl(request->url())); 1026 filter_->blob_storage_context()->context()->
1027 GetBlobDataFromPublicURL(request->url()));
1023 } 1028 }
1024 1029
1025 // Have the appcache associate its extra info with the request. 1030 // Have the appcache associate its extra info with the request.
1026 appcache::AppCacheInterceptor::SetExtraRequestInfo( 1031 appcache::AppCacheInterceptor::SetExtraRequestInfo(
1027 request, filter_->appcache_service(), child_id, 1032 request, filter_->appcache_service(), child_id,
1028 request_data.appcache_host_id, request_data.resource_type); 1033 request_data.appcache_host_id, request_data.resource_type);
1029 1034
1030 // Construct the IPC resource handler. 1035 // Construct the IPC resource handler.
1031 scoped_ptr<ResourceHandler> handler; 1036 scoped_ptr<ResourceHandler> handler;
1032 if (sync_result) { 1037 if (sync_result) {
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) 1876 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS)
1872 && !policy->CanReadRawCookies(child_id)) { 1877 && !policy->CanReadRawCookies(child_id)) {
1873 VLOG(1) << "Denied unauthorized request for raw headers"; 1878 VLOG(1) << "Denied unauthorized request for raw headers";
1874 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; 1879 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS;
1875 } 1880 }
1876 1881
1877 return load_flags; 1882 return load_flags;
1878 } 1883 }
1879 1884
1880 } // namespace content 1885 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698