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

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

Issue 366263002: [fsp] Add support for creating directories. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 5 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 f733a1cdd844cb4de52b1a1c0ee714da3356d8c2..a3f0ce62af96ede7dc541876898814c9c71baf67 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
@@ -83,6 +83,30 @@ void OnReadDirectory(
base::Bind(callback, result, entry_list, has_more));
}
+// Executes CreateDirectory on the UI thread.
+void CreateDirectoryOnUIThread(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ bool exclusive,
+ bool recursive,
+ const fileapi::AsyncFileUtil::StatusCallback& callback) {
+ util::FileSystemURLParser parser(url);
+ if (!parser.Parse()) {
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION);
+ return;
+ }
+
+ parser.file_system()->CreateDirectory(
+ parser.file_path(), exclusive, recursive, callback);
+}
+
+// Routes the response of CreateDirectory back to the IO thread.
+void OnCreateDirectory(const fileapi::AsyncFileUtil::StatusCallback& callback,
+ base::File::Error result) {
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE, base::Bind(callback, result));
+}
+
} // namespace
ProviderAsyncFileUtil::ProviderAsyncFileUtil() {}
@@ -124,7 +148,14 @@ void ProviderAsyncFileUtil::CreateDirectory(
bool recursive,
const StatusCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- callback.Run(base::File::FILE_ERROR_ACCESS_DENIED);
+ BrowserThread::PostTask(BrowserThread::UI,
+ FROM_HERE,
+ base::Bind(&CreateDirectoryOnUIThread,
+ base::Passed(&context),
+ url,
+ exclusive,
+ recursive,
+ base::Bind(&OnCreateDirectory, callback)));
}
void ProviderAsyncFileUtil::GetFileInfo(

Powered by Google App Engine
This is Rietveld 408576698