Index: content/child/fileapi/webfilesystem_impl.cc |
diff --git a/content/child/fileapi/webfilesystem_impl.cc b/content/child/fileapi/webfilesystem_impl.cc |
index e05ded3733d9d8f42be30235e8a2f349f5cc4495..d4affe6515839a724d0e4b51f12bdd1c63418d73 100644 |
--- a/content/child/fileapi/webfilesystem_impl.cc |
+++ b/content/child/fileapi/webfilesystem_impl.cc |
@@ -24,6 +24,23 @@ using WebKit::WebVector; |
namespace content { |
+namespace { |
+ |
+void DidReadMetadataForCreateFileWriter( |
+ const GURL& path, |
+ WebKit::WebFileWriterClient* client, |
+ WebKit::WebFileSystemCallbacks* callbacks, |
+ const base::PlatformFileInfo& file_info) { |
+ if (file_info.is_directory || file_info.size < 0) { |
+ callbacks->didFail(WebKit::WebFileErrorInvalidState); |
+ return; |
+ } |
+ callbacks->didCreateFileWriter(new WebFileWriterImpl(path, client), |
+ file_info.size); |
+} |
+ |
+} // namespace |
+ |
WebFileSystemImpl::WebFileSystemImpl() { |
} |
@@ -130,6 +147,19 @@ WebKit::WebFileWriter* WebFileSystemImpl::createFileWriter( |
return new WebFileWriterImpl(GURL(path), client); |
} |
+void WebFileSystemImpl::createFileWriter( |
+ const WebURL& path, |
+ WebKit::WebFileWriterClient* client, |
+ WebKit::WebFileSystemCallbacks* callbacks) { |
+ FileSystemDispatcher* dispatcher = |
+ ChildThread::current()->file_system_dispatcher(); |
+ dispatcher->ReadMetadata( |
+ GURL(path), |
+ base::Bind(&DidReadMetadataForCreateFileWriter, |
+ GURL(path), client, callbacks), |
+ base::Bind(&FileStatusCallbackAdapter, callbacks)); |
+} |
+ |
void WebFileSystemImpl::createSnapshotFileAndReadMetadata( |
const WebKit::WebURL& path, |
WebKit::WebFileSystemCallbacks* callbacks) { |