Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Unified Diff: chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc

Issue 528683002: [fsp] Remove the exclusive field from the CreateDirectory operation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a comment. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc
index 0c886c93bacd230da1466d47ce1b256959f55828..bb9b43139b532bb3cc310ef4a84ada7b5b3c4d05 100644
--- a/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc
@@ -97,14 +97,22 @@ void CreateDirectoryOnUIThread(
}
parser.file_system()->CreateDirectory(
- parser.file_path(), exclusive, recursive, callback);
+ parser.file_path(), recursive, callback);
}
// Routes the response of CreateDirectory back to the IO thread.
-void OnCreateDirectory(const storage::AsyncFileUtil::StatusCallback& callback,
+void OnCreateDirectory(bool exclusive,
+ const storage::AsyncFileUtil::StatusCallback& callback,
base::File::Error result) {
+ // If the directory already existed and the operation wasn't exclusive, then
+ // return success anyway, since it is not an error.
+ const base::File::Error error =
+ (result == base::File::FILE_ERROR_EXISTS && !exclusive)
+ ? base::File::FILE_OK
+ : result;
+
BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE, base::Bind(callback, result));
+ BrowserThread::IO, FROM_HERE, base::Bind(callback, error));
}
// Executes DeleteEntry on the UI thread.
@@ -282,14 +290,15 @@ void ProviderAsyncFileUtil::CreateDirectory(
bool recursive,
const StatusCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- BrowserThread::PostTask(BrowserThread::UI,
- FROM_HERE,
- base::Bind(&CreateDirectoryOnUIThread,
- base::Passed(&context),
- url,
- exclusive,
- recursive,
- base::Bind(&OnCreateDirectory, callback)));
+ BrowserThread::PostTask(
+ BrowserThread::UI,
+ FROM_HERE,
+ base::Bind(&CreateDirectoryOnUIThread,
+ base::Passed(&context),
+ url,
+ exclusive,
+ recursive,
+ base::Bind(&OnCreateDirectory, exclusive, callback)));
}
void ProviderAsyncFileUtil::GetFileInfo(

Powered by Google App Engine
This is Rietveld 408576698