Index: net/url_request/url_request_file_job.cc |
diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc |
index 5f5ea7ca48fc4bbdd947c916b7dd84043f7c9e6a..7fe968a7440598098c38ebd942de010c305e0cb2 100644 |
--- a/net/url_request/url_request_file_job.cc |
+++ b/net/url_request/url_request_file_job.cc |
@@ -84,8 +84,9 @@ class URLRequestFileJob::AsyncResolver |
}; |
URLRequestFileJob::URLRequestFileJob(URLRequest* request, |
- const FilePath& file_path) |
- : URLRequestJob(request, request->context()->network_delegate()), |
+ const FilePath& file_path, |
+ NetworkDelegate* network_delegate) |
+ : URLRequestJob(request, network_delegate), |
file_path_(file_path), |
stream_(NULL), |
is_directory_(false), |
@@ -99,7 +100,8 @@ URLRequestJob* URLRequestFileJob::Factory(URLRequest* request, |
const bool is_file = FileURLToFilePath(request->url(), &file_path); |
// Check file access permissions. |
- if (!IsFileAccessAllowed(*request, file_path)) { |
+ if (!IsFileAccessAllowed( |
+ *request, file_path, request->context()->network_delegate())) { |
return new URLRequestErrorJob( |
request, request->context()->network_delegate(), ERR_ACCESS_DENIED); |
} |
@@ -113,11 +115,14 @@ URLRequestJob* URLRequestFileJob::Factory(URLRequest* request, |
if (is_file && |
file_util::EndsWithSeparator(file_path) && |
file_path.IsAbsolute()) |
- return new URLRequestFileDirJob(request, file_path); |
+ return new URLRequestFileDirJob(request, |
+ request->context()->network_delegate(), |
+ file_path); |
// Use a regular file request job for all non-directories (including invalid |
// file names). |
- return new URLRequestFileJob(request, file_path); |
+ return new URLRequestFileJob( |
+ request, file_path, request->context()->network_delegate()); |
} |
void URLRequestFileJob::Start() { |
@@ -254,11 +259,8 @@ void URLRequestFileJob::SetExtraRequestHeaders( |
// static |
bool URLRequestFileJob::IsFileAccessAllowed(const URLRequest& request, |
- const FilePath& path) { |
- const URLRequestContext* context = request.context(); |
- if (!context) |
- return false; |
- const NetworkDelegate* delegate = context->network_delegate(); |
+ const FilePath& path, |
+ NetworkDelegate* delegate) { |
if (delegate) |
return delegate->CanAccessFile(request, path); |
erikwright (departed)
2012/07/13 14:50:36
I would just inline this at this point. Replace ca
shalev
2012/07/17 19:40:16
Done.
|
return false; |