Index: net/url_request/url_request_file_dir_job.cc |
diff --git a/net/url_request/url_request_file_dir_job.cc b/net/url_request/url_request_file_dir_job.cc |
index 435ccb008655fc2c83d64c24eb783703f73f428b..27d7ec7fe52861aea00fc60fd7deca689823e63c 100644 |
--- a/net/url_request/url_request_file_dir_job.cc |
+++ b/net/url_request/url_request_file_dir_job.cc |
@@ -6,10 +6,12 @@ |
#include "base/bind.h" |
#include "base/compiler_specific.h" |
+#include "base/files/file_util.h" |
#include "base/location.h" |
#include "base/single_thread_task_runner.h" |
#include "base/strings/sys_string_conversions.h" |
#include "base/strings/utf_string_conversions.h" |
+#include "base/task_scheduler/post_task.h" |
#include "base/threading/thread_task_runner_handle.h" |
#include "base/time/time.h" |
#include "net/base/directory_listing.h" |
@@ -37,8 +39,12 @@ URLRequestFileDirJob::URLRequestFileDirJob(URLRequest* request, |
weak_factory_(this) {} |
void URLRequestFileDirJob::StartAsync() { |
- lister_.Start(); |
- NotifyHeadersComplete(); |
+ base::PostTaskWithTraitsAndReplyWithResult( |
+ FROM_HERE, |
+ {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, |
+ base::Bind(&base::MakeAbsoluteFilePath, dir_path_), |
+ base::Bind(&URLRequestFileDirJob::DidMakeAbsolutePath, |
+ weak_factory_.GetWeakPtr())); |
} |
void URLRequestFileDirJob::Start() { |
@@ -136,6 +142,18 @@ void URLRequestFileDirJob::OnListDone(int error) { |
URLRequestFileDirJob::~URLRequestFileDirJob() {} |
+void URLRequestFileDirJob::DidMakeAbsolutePath( |
+ const base::FilePath& absolute_path) { |
+ if (network_delegate() && !network_delegate()->CanAccessFile( |
+ *request(), dir_path_, absolute_path)) { |
+ NotifyStartError(URLRequestStatus::FromError(ERR_ACCESS_DENIED)); |
+ return; |
+ } |
+ |
+ lister_.Start(); |
+ NotifyHeadersComplete(); |
+} |
+ |
void URLRequestFileDirJob::CompleteRead(Error error) { |
DCHECK_LE(error, OK); |
DCHECK_NE(error, ERR_IO_PENDING); |