| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/common/file_system/webfilesystem_impl.h" | |
| 6 | |
| 7 #include "content/common/child_thread.h" | |
| 8 #include "content/common/file_system/file_system_dispatcher.h" | |
| 9 #include "content/common/file_system/webfilesystem_callback_dispatcher.h" | |
| 10 #include "content/common/file_system/webfilewriter_impl.h" | |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileInfo.h" | |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback
s.h" | |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | |
| 15 #include "webkit/glue/webkit_glue.h" | |
| 16 | |
| 17 using WebKit::WebFileInfo; | |
| 18 using WebKit::WebFileSystemCallbacks; | |
| 19 using WebKit::WebFileSystemEntry; | |
| 20 using WebKit::WebString; | |
| 21 using WebKit::WebURL; | |
| 22 using WebKit::WebVector; | |
| 23 | |
| 24 WebFileSystemImpl::WebFileSystemImpl() { | |
| 25 } | |
| 26 | |
| 27 void WebFileSystemImpl::move(const WebURL& src_path, | |
| 28 const WebURL& dest_path, | |
| 29 WebFileSystemCallbacks* callbacks) { | |
| 30 FileSystemDispatcher* dispatcher = | |
| 31 ChildThread::current()->file_system_dispatcher(); | |
| 32 dispatcher->Move(GURL(src_path), | |
| 33 GURL(dest_path), | |
| 34 new WebFileSystemCallbackDispatcher(callbacks)); | |
| 35 } | |
| 36 | |
| 37 void WebFileSystemImpl::copy(const WebURL& src_path, | |
| 38 const WebURL& dest_path, | |
| 39 WebFileSystemCallbacks* callbacks) { | |
| 40 FileSystemDispatcher* dispatcher = | |
| 41 ChildThread::current()->file_system_dispatcher(); | |
| 42 dispatcher->Copy(GURL(src_path), | |
| 43 GURL(dest_path), | |
| 44 new WebFileSystemCallbackDispatcher(callbacks)); | |
| 45 } | |
| 46 | |
| 47 void WebFileSystemImpl::remove(const WebURL& path, | |
| 48 WebFileSystemCallbacks* callbacks) { | |
| 49 FileSystemDispatcher* dispatcher = | |
| 50 ChildThread::current()->file_system_dispatcher(); | |
| 51 dispatcher->Remove(GURL(path), | |
| 52 false /* recursive */, | |
| 53 new WebFileSystemCallbackDispatcher(callbacks)); | |
| 54 } | |
| 55 | |
| 56 void WebFileSystemImpl::removeRecursively(const WebURL& path, | |
| 57 WebFileSystemCallbacks* callbacks) { | |
| 58 FileSystemDispatcher* dispatcher = | |
| 59 ChildThread::current()->file_system_dispatcher(); | |
| 60 dispatcher->Remove(GURL(path), | |
| 61 true /* recursive */, | |
| 62 new WebFileSystemCallbackDispatcher(callbacks)); | |
| 63 } | |
| 64 | |
| 65 void WebFileSystemImpl::readMetadata(const WebURL& path, | |
| 66 WebFileSystemCallbacks* callbacks) { | |
| 67 FileSystemDispatcher* dispatcher = | |
| 68 ChildThread::current()->file_system_dispatcher(); | |
| 69 dispatcher->ReadMetadata(GURL(path), | |
| 70 new WebFileSystemCallbackDispatcher(callbacks)); | |
| 71 } | |
| 72 | |
| 73 void WebFileSystemImpl::createFile(const WebURL& path, | |
| 74 bool exclusive, | |
| 75 WebFileSystemCallbacks* callbacks) { | |
| 76 FileSystemDispatcher* dispatcher = | |
| 77 ChildThread::current()->file_system_dispatcher(); | |
| 78 dispatcher->Create(GURL(path), exclusive, false, | |
| 79 false, new WebFileSystemCallbackDispatcher(callbacks)); | |
| 80 } | |
| 81 | |
| 82 void WebFileSystemImpl::createDirectory(const WebURL& path, | |
| 83 bool exclusive, | |
| 84 WebFileSystemCallbacks* callbacks) { | |
| 85 FileSystemDispatcher* dispatcher = | |
| 86 ChildThread::current()->file_system_dispatcher(); | |
| 87 dispatcher->Create(GURL(path), exclusive, true, | |
| 88 false, new WebFileSystemCallbackDispatcher(callbacks)); | |
| 89 } | |
| 90 | |
| 91 void WebFileSystemImpl::fileExists(const WebURL& path, | |
| 92 WebFileSystemCallbacks* callbacks) { | |
| 93 FileSystemDispatcher* dispatcher = | |
| 94 ChildThread::current()->file_system_dispatcher(); | |
| 95 dispatcher->Exists(GURL(path), false, | |
| 96 new WebFileSystemCallbackDispatcher(callbacks)); | |
| 97 } | |
| 98 | |
| 99 void WebFileSystemImpl::directoryExists(const WebURL& path, | |
| 100 WebFileSystemCallbacks* callbacks) { | |
| 101 FileSystemDispatcher* dispatcher = | |
| 102 ChildThread::current()->file_system_dispatcher(); | |
| 103 dispatcher->Exists(GURL(path), true, | |
| 104 new WebFileSystemCallbackDispatcher(callbacks)); | |
| 105 } | |
| 106 | |
| 107 void WebFileSystemImpl::readDirectory(const WebURL& path, | |
| 108 WebFileSystemCallbacks* callbacks) { | |
| 109 FileSystemDispatcher* dispatcher = | |
| 110 ChildThread::current()->file_system_dispatcher(); | |
| 111 dispatcher->ReadDirectory(GURL(path), | |
| 112 new WebFileSystemCallbackDispatcher(callbacks)); | |
| 113 } | |
| 114 | |
| 115 WebKit::WebFileWriter* WebFileSystemImpl::createFileWriter( | |
| 116 const WebURL& path, WebKit::WebFileWriterClient* client) { | |
| 117 return new WebFileWriterImpl(GURL(path), client); | |
| 118 } | |
| 119 | |
| 120 void WebFileSystemImpl::createSnapshotFileAndReadMetadata( | |
| 121 const WebKit::WebURL& blobURL, | |
| 122 const WebKit::WebURL& path, | |
| 123 WebKit::WebFileSystemCallbacks* callbacks) { | |
| 124 FileSystemDispatcher* dispatcher = | |
| 125 ChildThread::current()->file_system_dispatcher(); | |
| 126 dispatcher->CreateSnapshotFile( | |
| 127 GURL(blobURL), GURL(path), | |
| 128 new WebFileSystemCallbackDispatcher(callbacks)); | |
| 129 } | |
| OLD | NEW |