| Index: webkit/fileapi/file_system_dir_url_request_job.cc
|
| diff --git a/webkit/fileapi/file_system_dir_url_request_job.cc b/webkit/fileapi/file_system_dir_url_request_job.cc
|
| index b96d7e462db7cf4a9922b1661b9db5177428cbff..dc104ff2e30469bfdefe284110df64873b436deb 100644
|
| --- a/webkit/fileapi/file_system_dir_url_request_job.cc
|
| +++ b/webkit/fileapi/file_system_dir_url_request_job.cc
|
| @@ -20,7 +20,6 @@
|
| #include "net/base/net_errors.h"
|
| #include "net/base/net_util.h"
|
| #include "net/url_request/url_request.h"
|
| -#include "webkit/fileapi/file_system_callback_dispatcher.h"
|
| #include "webkit/fileapi/file_system_context.h"
|
| #include "webkit/fileapi/file_system_operation.h"
|
| #include "webkit/fileapi/file_system_util.h"
|
| @@ -39,60 +38,6 @@ static FilePath GetRelativePath(const GURL& url) {
|
| return relative_path;
|
| }
|
|
|
| -class FileSystemDirURLRequestJob::CallbackDispatcher
|
| - : public FileSystemCallbackDispatcher {
|
| - public:
|
| - // An instance of this class must be created by Create()
|
| - // (so that we do not leak ownership).
|
| - static scoped_ptr<FileSystemCallbackDispatcher> Create(
|
| - FileSystemDirURLRequestJob* job) {
|
| - return scoped_ptr<FileSystemCallbackDispatcher>(
|
| - new CallbackDispatcher(job));
|
| - }
|
| -
|
| - // fileapi::FileSystemCallbackDispatcher overrides.
|
| - virtual void DidSucceed() OVERRIDE {
|
| - NOTREACHED();
|
| - }
|
| -
|
| - virtual void DidReadMetadata(const base::PlatformFileInfo& file_info,
|
| - const FilePath& platform_path) OVERRIDE {
|
| - NOTREACHED();
|
| - }
|
| -
|
| - virtual void DidReadDirectory(
|
| - const std::vector<base::FileUtilProxy::Entry>& entries,
|
| - bool has_more) OVERRIDE {
|
| - job_->DidReadDirectory(entries, has_more);
|
| - }
|
| -
|
| - virtual void DidWrite(int64 bytes, bool complete) OVERRIDE {
|
| - NOTREACHED();
|
| - }
|
| -
|
| - virtual void DidOpenFileSystem(const std::string& name,
|
| - const GURL& root_path) OVERRIDE {
|
| - NOTREACHED();
|
| - }
|
| -
|
| - virtual void DidFail(base::PlatformFileError error_code) OVERRIDE {
|
| - int rv = net::ERR_FILE_NOT_FOUND;
|
| - if (error_code == base::PLATFORM_FILE_ERROR_INVALID_URL)
|
| - rv = net::ERR_INVALID_URL;
|
| - job_->NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
|
| - }
|
| -
|
| - private:
|
| - explicit CallbackDispatcher(FileSystemDirURLRequestJob* job) : job_(job) {
|
| - DCHECK(job_);
|
| - }
|
| -
|
| - // TODO(adamk): Get rid of the need for refcounting here by
|
| - // allowing FileSystemOperations to be cancelled.
|
| - scoped_refptr<FileSystemDirURLRequestJob> job_;
|
| - DISALLOW_COPY_AND_ASSIGN(CallbackDispatcher);
|
| -};
|
| -
|
| FileSystemDirURLRequestJob::FileSystemDirURLRequestJob(
|
| URLRequest* request, FileSystemContext* file_system_context,
|
| scoped_refptr<base::MessageLoopProxy> file_thread_proxy)
|
| @@ -148,12 +93,23 @@ void FileSystemDirURLRequestJob::StartAsync() {
|
| net::ERR_INVALID_URL));
|
| return;
|
| }
|
| - operation->ReadDirectory(request_->url());
|
| + operation->ReadDirectory(
|
| + request_->url(),
|
| + base::Bind(&FileSystemDirURLRequestJob::DidReadDirectory, this));
|
| }
|
|
|
| void FileSystemDirURLRequestJob::DidReadDirectory(
|
| + base::PlatformFileError result,
|
| const std::vector<base::FileUtilProxy::Entry>& entries,
|
| bool has_more) {
|
| + if (result != base::PLATFORM_FILE_OK) {
|
| + int rv = net::ERR_FILE_NOT_FOUND;
|
| + if (result == base::PLATFORM_FILE_ERROR_INVALID_URL)
|
| + rv = net::ERR_INVALID_URL;
|
| + NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
|
| + return;
|
| + }
|
| +
|
| if (!request_)
|
| return;
|
|
|
| @@ -182,7 +138,9 @@ void FileSystemDirURLRequestJob::DidReadDirectory(
|
| }
|
|
|
| if (has_more) {
|
| - GetNewOperation(request_->url())->ReadDirectory(request_->url());
|
| + GetNewOperation(request_->url())->ReadDirectory(
|
| + request_->url(),
|
| + base::Bind(&FileSystemDirURLRequestJob::DidReadDirectory, this));
|
| } else {
|
| set_expected_content_size(data_.size());
|
| NotifyHeadersComplete();
|
| @@ -193,7 +151,6 @@ FileSystemOperationInterface*
|
| FileSystemDirURLRequestJob::GetNewOperation(const GURL& url) {
|
| return file_system_context_->CreateFileSystemOperation(
|
| url,
|
| - CallbackDispatcher::Create(this),
|
| file_thread_proxy_);
|
| }
|
|
|
|
|