| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef DOMFileSystemBase_h | 31 #ifndef DOMFileSystemBase_h |
| 32 #define DOMFileSystemBase_h | 32 #define DOMFileSystemBase_h |
| 33 | 33 |
| 34 #include "heap/Handle.h" |
| 34 #include "modules/filesystem/FileSystemFlags.h" | 35 #include "modules/filesystem/FileSystemFlags.h" |
| 35 #include "platform/FileSystemType.h" | 36 #include "platform/FileSystemType.h" |
| 36 #include "platform/weborigin/KURL.h" | 37 #include "platform/weborigin/KURL.h" |
| 37 #include "wtf/PassRefPtr.h" | 38 #include "wtf/PassRefPtr.h" |
| 38 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
| 39 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
| 40 | 41 |
| 41 namespace blink { | 42 namespace blink { |
| 42 class WebFileSystem; | 43 class WebFileSystem; |
| 43 } | 44 } |
| 44 | 45 |
| 45 namespace WebCore { | 46 namespace WebCore { |
| 46 | 47 |
| 47 class DirectoryEntry; | 48 class DirectoryEntry; |
| 48 class DirectoryReaderBase; | 49 class DirectoryReaderBase; |
| 49 class EntriesCallback; | 50 class EntriesCallback; |
| 50 class EntryBase; | 51 class EntryBase; |
| 51 class EntryCallback; | 52 class EntryCallback; |
| 52 class ErrorCallback; | 53 class ErrorCallback; |
| 53 class FileError; | 54 class FileError; |
| 54 class MetadataCallback; | 55 class MetadataCallback; |
| 55 class ExecutionContext; | 56 class ExecutionContext; |
| 56 class SecurityOrigin; | 57 class SecurityOrigin; |
| 57 class VoidCallback; | 58 class VoidCallback; |
| 58 | 59 |
| 59 // A common base class for DOMFileSystem and DOMFileSystemSync. | 60 // A common base class for DOMFileSystem and DOMFileSystemSync. |
| 60 class DOMFileSystemBase : public RefCounted<DOMFileSystemBase> { | 61 class DOMFileSystemBase : public RefCountedWillBeRefCountedGarbageCollected<DOMF
ileSystemBase> { |
| 61 public: | 62 public: |
| 62 enum SynchronousType { | 63 enum SynchronousType { |
| 63 Synchronous, | 64 Synchronous, |
| 64 Asynchronous, | 65 Asynchronous, |
| 65 }; | 66 }; |
| 66 | 67 |
| 67 // Path prefixes that are used in the filesystem URLs (that can be obtained
by toURL()). | 68 // Path prefixes that are used in the filesystem URLs (that can be obtained
by toURL()). |
| 68 // http://www.w3.org/TR/file-system-api/#widl-Entry-toURL | 69 // http://www.w3.org/TR/file-system-api/#widl-Entry-toURL |
| 69 static const char persistentPathPrefix[]; | 70 static const char persistentPathPrefix[]; |
| 70 static const char temporaryPathPrefix[]; | 71 static const char temporaryPathPrefix[]; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 106 |
| 106 // Actual FileSystem API implementations. All the validity checks on virtual
paths are done at this level. | 107 // Actual FileSystem API implementations. All the validity checks on virtual
paths are done at this level. |
| 107 void getMetadata(const EntryBase*, PassOwnPtr<MetadataCallback>, PassOwnPtr<
ErrorCallback>, SynchronousType = Asynchronous); | 108 void getMetadata(const EntryBase*, PassOwnPtr<MetadataCallback>, PassOwnPtr<
ErrorCallback>, SynchronousType = Asynchronous); |
| 108 void move(const EntryBase* source, EntryBase* parent, const String& name, Pa
ssOwnPtr<EntryCallback>, PassOwnPtr<ErrorCallback>, SynchronousType = Asynchrono
us); | 109 void move(const EntryBase* source, EntryBase* parent, const String& name, Pa
ssOwnPtr<EntryCallback>, PassOwnPtr<ErrorCallback>, SynchronousType = Asynchrono
us); |
| 109 void copy(const EntryBase* source, EntryBase* parent, const String& name, Pa
ssOwnPtr<EntryCallback>, PassOwnPtr<ErrorCallback>, SynchronousType = Asynchrono
us); | 110 void copy(const EntryBase* source, EntryBase* parent, const String& name, Pa
ssOwnPtr<EntryCallback>, PassOwnPtr<ErrorCallback>, SynchronousType = Asynchrono
us); |
| 110 void remove(const EntryBase*, PassOwnPtr<VoidCallback>, PassOwnPtr<ErrorCall
back>, SynchronousType = Asynchronous); | 111 void remove(const EntryBase*, PassOwnPtr<VoidCallback>, PassOwnPtr<ErrorCall
back>, SynchronousType = Asynchronous); |
| 111 void removeRecursively(const EntryBase*, PassOwnPtr<VoidCallback>, PassOwnPt
r<ErrorCallback>, SynchronousType = Asynchronous); | 112 void removeRecursively(const EntryBase*, PassOwnPtr<VoidCallback>, PassOwnPt
r<ErrorCallback>, SynchronousType = Asynchronous); |
| 112 void getParent(const EntryBase*, PassOwnPtr<EntryCallback>, PassOwnPtr<Error
Callback>); | 113 void getParent(const EntryBase*, PassOwnPtr<EntryCallback>, PassOwnPtr<Error
Callback>); |
| 113 void getFile(const EntryBase*, const String& path, const FileSystemFlags&, P
assOwnPtr<EntryCallback>, PassOwnPtr<ErrorCallback>, SynchronousType = Asynchron
ous); | 114 void getFile(const EntryBase*, const String& path, const FileSystemFlags&, P
assOwnPtr<EntryCallback>, PassOwnPtr<ErrorCallback>, SynchronousType = Asynchron
ous); |
| 114 void getDirectory(const EntryBase*, const String& path, const FileSystemFlag
s&, PassOwnPtr<EntryCallback>, PassOwnPtr<ErrorCallback>, SynchronousType = Asyn
chronous); | 115 void getDirectory(const EntryBase*, const String& path, const FileSystemFlag
s&, PassOwnPtr<EntryCallback>, PassOwnPtr<ErrorCallback>, SynchronousType = Asyn
chronous); |
| 115 int readDirectory(PassRefPtr<DirectoryReaderBase>, const String& path, PassO
wnPtr<EntriesCallback>, PassOwnPtr<ErrorCallback>, SynchronousType = Asynchronou
s); | 116 bool readDirectory(PassRefPtrWillBeRawPtr<DirectoryReaderBase>, const String
& path, PassOwnPtr<EntriesCallback>, PassOwnPtr<ErrorCallback>, SynchronousType
= Asynchronous); |
| 116 bool waitForAdditionalResult(int callbacksId); | 117 bool waitForAdditionalResult(int callbacksId); |
| 117 | 118 |
| 119 virtual void trace(Visitor*) { } |
| 120 |
| 118 protected: | 121 protected: |
| 119 DOMFileSystemBase(ExecutionContext*, const String& name, FileSystemType, con
st KURL& rootURL); | 122 DOMFileSystemBase(ExecutionContext*, const String& name, FileSystemType, con
st KURL& rootURL); |
| 120 friend class DOMFileSystemSync; | 123 friend class DOMFileSystemSync; |
| 121 | 124 |
| 122 ExecutionContext* m_context; | 125 ExecutionContext* m_context; |
| 123 String m_name; | 126 String m_name; |
| 124 FileSystemType m_type; | 127 FileSystemType m_type; |
| 125 KURL m_filesystemRootURL; | 128 KURL m_filesystemRootURL; |
| 126 bool m_clonable; | 129 bool m_clonable; |
| 127 }; | 130 }; |
| 128 | 131 |
| 129 inline bool operator==(const DOMFileSystemBase& a, const DOMFileSystemBase& b) {
return a.name() == b.name() && a.type() == b.type() && a.rootURL() == b.rootURL
(); } | 132 inline bool operator==(const DOMFileSystemBase& a, const DOMFileSystemBase& b) {
return a.name() == b.name() && a.type() == b.type() && a.rootURL() == b.rootURL
(); } |
| 130 | 133 |
| 131 } // namespace WebCore | 134 } // namespace WebCore |
| 132 | 135 |
| 133 #endif // DOMFileSystemBase_h | 136 #endif // DOMFileSystemBase_h |
| OLD | NEW |