| Index: content/browser/fileapi/fileapi_message_filter.cc
|
| diff --git a/content/browser/fileapi/fileapi_message_filter.cc b/content/browser/fileapi/fileapi_message_filter.cc
|
| index 446cb8f1133c1e7c20ac7403e1d96bd916edb06c..28b9251d2155fdb5d5f1a8baebdbb3ee9a017e57 100644
|
| --- a/content/browser/fileapi/fileapi_message_filter.cc
|
| +++ b/content/browser/fileapi/fileapi_message_filter.cc
|
| @@ -224,11 +224,15 @@ void FileAPIMessageFilter::OnMove(
|
| return;
|
| }
|
|
|
| - FileSystemOperation* operation = GetNewOperation(src_url, request_id);
|
| + FileSystemURL src_operation_url = src_url.GetForOperations();
|
| + FileSystemURL dest_operation_url = dest_url.GetForOperations();
|
| +
|
| + FileSystemOperation* operation =
|
| + GetNewOperation(src_operation_url, request_id);
|
| if (!operation)
|
| return;
|
| operation->Move(
|
| - src_url, dest_url,
|
| + src_operation_url, dest_operation_url,
|
| base::Bind(&FileAPIMessageFilter::DidFinish, this, request_id));
|
| }
|
|
|
| @@ -245,11 +249,15 @@ void FileAPIMessageFilter::OnCopy(
|
| return;
|
| }
|
|
|
| - FileSystemOperation* operation = GetNewOperation(src_url, request_id);
|
| + FileSystemURL src_operation_url = src_url.GetForOperations();
|
| + FileSystemURL dest_operation_url = dest_url.GetForOperations();
|
| +
|
| + FileSystemOperation* operation =
|
| + GetNewOperation(src_operation_url, request_id);
|
| if (!operation)
|
| return;
|
| operation->Copy(
|
| - src_url, dest_url,
|
| + src_operation_url, dest_operation_url,
|
| base::Bind(&FileAPIMessageFilter::DidFinish, this, request_id));
|
| }
|
|
|
| @@ -263,11 +271,12 @@ void FileAPIMessageFilter::OnRemove(
|
| return;
|
| }
|
|
|
| - FileSystemOperation* operation = GetNewOperation(url, request_id);
|
| + FileSystemURL operation_url = url.GetForOperations();
|
| + FileSystemOperation* operation = GetNewOperation(operation_url, request_id);
|
| if (!operation)
|
| return;
|
| operation->Remove(
|
| - url, recursive,
|
| + operation_url, recursive,
|
| base::Bind(&FileAPIMessageFilter::DidFinish, this, request_id));
|
| }
|
|
|
| @@ -281,11 +290,12 @@ void FileAPIMessageFilter::OnReadMetadata(
|
| return;
|
| }
|
|
|
| - FileSystemOperation* operation = GetNewOperation(url, request_id);
|
| + FileSystemURL operation_url = url.GetForOperations();
|
| + FileSystemOperation* operation = GetNewOperation(operation_url, request_id);
|
| if (!operation)
|
| return;
|
| operation->GetMetadata(
|
| - url,
|
| + operation_url,
|
| base::Bind(&FileAPIMessageFilter::DidGetMetadata, this, request_id));
|
| }
|
|
|
| @@ -300,16 +310,17 @@ void FileAPIMessageFilter::OnCreate(
|
| return;
|
| }
|
|
|
| - FileSystemOperation* operation = GetNewOperation(url, request_id);
|
| + FileSystemURL operation_url = url.GetForOperations();
|
| + FileSystemOperation* operation = GetNewOperation(operation_url, request_id);
|
| if (!operation)
|
| return;
|
| if (is_directory) {
|
| operation->CreateDirectory(
|
| - url, exclusive, recursive,
|
| + operation_url, exclusive, recursive,
|
| base::Bind(&FileAPIMessageFilter::DidFinish, this, request_id));
|
| } else {
|
| operation->CreateFile(
|
| - url, exclusive,
|
| + operation_url, exclusive,
|
| base::Bind(&FileAPIMessageFilter::DidFinish, this, request_id));
|
| }
|
| }
|
| @@ -324,16 +335,17 @@ void FileAPIMessageFilter::OnExists(
|
| return;
|
| }
|
|
|
| - FileSystemOperation* operation = GetNewOperation(url, request_id);
|
| + FileSystemURL operation_url = url.GetForOperations();
|
| + FileSystemOperation* operation = GetNewOperation(operation_url, request_id);
|
| if (!operation)
|
| return;
|
| if (is_directory) {
|
| operation->DirectoryExists(
|
| - url,
|
| + operation_url,
|
| base::Bind(&FileAPIMessageFilter::DidFinish, this, request_id));
|
| } else {
|
| operation->FileExists(
|
| - url,
|
| + operation_url,
|
| base::Bind(&FileAPIMessageFilter::DidFinish, this, request_id));
|
| }
|
| }
|
| @@ -348,12 +360,13 @@ void FileAPIMessageFilter::OnReadDirectory(
|
| return;
|
| }
|
|
|
| - FileSystemOperation* operation = GetNewOperation(url, request_id);
|
| + FileSystemURL operation_url = url.GetForOperations();
|
| + FileSystemOperation* operation = GetNewOperation(operation_url, request_id);
|
| if (!operation)
|
| return;
|
| operation->ReadDirectory(
|
| - url, base::Bind(&FileAPIMessageFilter::DidReadDirectory,
|
| - this, request_id));
|
| + operation_url,
|
| + base::Bind(&FileAPIMessageFilter::DidReadDirectory, this, request_id));
|
| }
|
|
|
| void FileAPIMessageFilter::OnWrite(
|
| @@ -375,11 +388,12 @@ void FileAPIMessageFilter::OnWrite(
|
| return;
|
| }
|
|
|
| - FileSystemOperation* operation = GetNewOperation(url, request_id);
|
| + FileSystemURL operation_url = url.GetForOperations();
|
| + FileSystemOperation* operation = GetNewOperation(operation_url, request_id);
|
| if (!operation)
|
| return;
|
| operation->Write(
|
| - request_context_, url, blob_url, offset,
|
| + request_context_, operation_url, blob_url, offset,
|
| base::Bind(&FileAPIMessageFilter::DidWrite, this, request_id));
|
| }
|
|
|
| @@ -394,11 +408,12 @@ void FileAPIMessageFilter::OnTruncate(
|
| return;
|
| }
|
|
|
| - FileSystemOperation* operation = GetNewOperation(url, request_id);
|
| + FileSystemURL operation_url = url.GetForOperations();
|
| + FileSystemOperation* operation = GetNewOperation(operation_url, request_id);
|
| if (!operation)
|
| return;
|
| operation->Truncate(
|
| - url, length,
|
| + operation_url, length,
|
| base::Bind(&FileAPIMessageFilter::DidFinish, this, request_id));
|
| }
|
|
|
| @@ -415,11 +430,12 @@ void FileAPIMessageFilter::OnTouchFile(
|
| return;
|
| }
|
|
|
| - FileSystemOperation* operation = GetNewOperation(url, request_id);
|
| + FileSystemURL operation_url = url.GetForOperations();
|
| + FileSystemOperation* operation = GetNewOperation(operation_url, request_id);
|
| if (!operation)
|
| return;
|
| operation->TouchFile(
|
| - url, last_access_time, last_modified_time,
|
| + operation_url, last_access_time, last_modified_time,
|
| base::Bind(&FileAPIMessageFilter::DidFinish, this, request_id));
|
| }
|
|
|
| @@ -452,11 +468,12 @@ void FileAPIMessageFilter::OnOpenFile(
|
| return;
|
| }
|
|
|
| - FileSystemOperation* operation = GetNewOperation(url, request_id);
|
| + FileSystemURL operation_url = url.GetForOperations();
|
| + FileSystemOperation* operation = GetNewOperation(operation_url, request_id);
|
| if (!operation)
|
| return;
|
| operation->OpenFile(
|
| - url, file_flags, peer_handle(),
|
| + operation_url, file_flags, peer_handle(),
|
| base::Bind(&FileAPIMessageFilter::DidOpenFile, this, request_id, path));
|
| }
|
|
|
| @@ -469,7 +486,7 @@ void FileAPIMessageFilter::OnNotifyCloseFile(const GURL& path) {
|
| DCHECK(iter != open_filesystem_urls_.end());
|
| open_filesystem_urls_.erase(iter);
|
|
|
| - FileSystemURL url(context_->CrackURL(path));
|
| + FileSystemURL url = context_->CrackURL(path).GetForOperations();
|
|
|
| // Do not use GetNewOperation() here, because NotifyCloseFile is a one-way
|
| // operation that does not have request_id by which we respond back.
|
| @@ -525,14 +542,15 @@ void FileAPIMessageFilter::OnSyncGetPlatformPath(
|
| // (e.g. TEMPORARY or PERSISTENT).
|
| // TODO(kinuko): this hack should go away once appropriate upload-stream
|
| // handling based on element types is supported.
|
| + FileSystemURL operation_url = url.GetForOperations();
|
| LocalFileSystemOperation* operation =
|
| context_->CreateFileSystemOperation(
|
| - url, NULL)->AsLocalFileSystemOperation();
|
| + operation_url, NULL)->AsLocalFileSystemOperation();
|
| DCHECK(operation);
|
| if (!operation)
|
| return;
|
|
|
| - operation->SyncGetPlatformPath(url, platform_path);
|
| + operation->SyncGetPlatformPath(operation_url, platform_path);
|
|
|
| // The path is to be attached to URLLoader so we grant read permission
|
| // for the file. (We first need to check if it can already be read not to
|
| @@ -558,13 +576,14 @@ void FileAPIMessageFilter::OnCreateSnapshotFile(
|
| return;
|
| }
|
|
|
| - FileSystemOperation* operation = GetNewOperation(url, request_id);
|
| + FileSystemURL operation_url = url.GetForOperations();
|
| + FileSystemOperation* operation = GetNewOperation(operation_url, request_id);
|
| if (!operation)
|
| return;
|
| operation->CreateSnapshotFile(
|
| - url,
|
| + operation_url,
|
| base::Bind(&FileAPIMessageFilter::DidCreateSnapshot,
|
| - this, request_id, url));
|
| + this, request_id, operation_url));
|
| }
|
|
|
| void FileAPIMessageFilter::OnDidReceiveSnapshotFile(int request_id) {
|
| @@ -576,9 +595,11 @@ void FileAPIMessageFilter::OnCreateSnapshotFile_Deprecated(
|
| int request_id, const GURL& blob_url, const GURL& path) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| FileSystemURL url(context_->CrackURL(path));
|
| + FileSystemURL operation_url = url.GetForOperations();
|
| +
|
| base::Callback<void(const base::FilePath&)> register_file_callback =
|
| base::Bind(&FileAPIMessageFilter::RegisterFileAsBlob,
|
| - this, blob_url, url);
|
| + this, blob_url, operation_url);
|
|
|
| // Make sure if this file can be read by the renderer as this is
|
| // called when the renderer is about to create a new File object
|
| @@ -589,11 +610,11 @@ void FileAPIMessageFilter::OnCreateSnapshotFile_Deprecated(
|
| return;
|
| }
|
|
|
| - FileSystemOperation* operation = GetNewOperation(url, request_id);
|
| + FileSystemOperation* operation = GetNewOperation(operation_url, request_id);
|
| if (!operation)
|
| return;
|
| operation->CreateSnapshotFile(
|
| - url,
|
| + operation_url,
|
| base::Bind(&FileAPIMessageFilter::DidCreateSnapshot_Deprecated,
|
| this, request_id, register_file_callback));
|
| }
|
|
|