| 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 c9378dda6b82f782cbbc92235beb7707593bc39a..f07e92fc565c025c189c3b4836f71663a73f44ab 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,8 +100,11 @@ URLRequestJob* URLRequestFileJob::Factory(URLRequest* request,
|
| const bool is_file = FileURLToFilePath(request->url(), &file_path);
|
|
|
| // Check file access permissions.
|
| - if (!IsFileAccessAllowed(*request, file_path))
|
| + if (!request->context()->network_delegate() ||
|
| + !request->context()->network_delegate()->CanAccessFile(
|
| + *request, file_path)) {
|
| return new URLRequestErrorJob(request, ERR_ACCESS_DENIED);
|
| + }
|
|
|
| // We need to decide whether to create URLRequestFileJob for file access or
|
| // URLRequestFileDirJob for directory access. To avoid accessing the
|
| @@ -115,7 +119,8 @@ URLRequestJob* URLRequestFileJob::Factory(URLRequest* request,
|
|
|
| // 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() {
|
| @@ -250,15 +255,6 @@ void URLRequestFileJob::SetExtraRequestHeaders(
|
| }
|
| }
|
|
|
| -// static
|
| -bool URLRequestFileJob::IsFileAccessAllowed(const URLRequest& request,
|
| - const FilePath& path) {
|
| - const NetworkDelegate* delegate = request.context()->network_delegate();
|
| - if (delegate)
|
| - return delegate->CanAccessFile(request, path);
|
| - return false;
|
| -}
|
| -
|
| URLRequestFileJob::~URLRequestFileJob() {
|
| DCHECK(!async_resolver_);
|
| }
|
|
|