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 17 matching lines...) Expand all Loading... |
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 "modules/filesystem/FileSystemFlags.h" | 34 #include "modules/filesystem/FileSystemFlags.h" |
35 #include "platform/FileSystemType.h" | 35 #include "platform/FileSystemType.h" |
36 #include "platform/heap/Handle.h" | 36 #include "platform/heap/Handle.h" |
37 #include "platform/weborigin/KURL.h" | 37 #include "platform/weborigin/KURL.h" |
38 #include "wtf/RefCounted.h" | |
39 #include "wtf/text/WTFString.h" | 38 #include "wtf/text/WTFString.h" |
40 | 39 |
41 namespace blink { | 40 namespace blink { |
42 class WebFileSystem; | 41 class WebFileSystem; |
43 } | 42 } |
44 | 43 |
45 namespace WebCore { | 44 namespace WebCore { |
46 | 45 |
47 class DirectoryEntry; | 46 class DirectoryEntry; |
48 class DirectoryReaderBase; | 47 class DirectoryReaderBase; |
49 class EntriesCallback; | 48 class EntriesCallback; |
50 class EntryBase; | 49 class EntryBase; |
51 class EntryCallback; | 50 class EntryCallback; |
52 class ErrorCallback; | 51 class ErrorCallback; |
53 class FileError; | 52 class FileError; |
54 class MetadataCallback; | 53 class MetadataCallback; |
55 class ExecutionContext; | 54 class ExecutionContext; |
56 class SecurityOrigin; | 55 class SecurityOrigin; |
57 class VoidCallback; | 56 class VoidCallback; |
58 | 57 |
59 // A common base class for DOMFileSystem and DOMFileSystemSync. | 58 // A common base class for DOMFileSystem and DOMFileSystemSync. |
60 class DOMFileSystemBase : public RefCountedWillBeRefCountedGarbageCollected<DOMF
ileSystemBase> { | 59 class DOMFileSystemBase : public GarbageCollectedFinalized<DOMFileSystemBase> { |
61 public: | 60 public: |
62 enum SynchronousType { | 61 enum SynchronousType { |
63 Synchronous, | 62 Synchronous, |
64 Asynchronous, | 63 Asynchronous, |
65 }; | 64 }; |
66 | 65 |
67 // Path prefixes that are used in the filesystem URLs (that can be obtained
by toURL()). | 66 // 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 | 67 // http://www.w3.org/TR/file-system-api/#widl-Entry-toURL |
69 static const char persistentPathPrefix[]; | 68 static const char persistentPathPrefix[]; |
70 static const char temporaryPathPrefix[]; | 69 static const char temporaryPathPrefix[]; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 104 |
106 // Actual FileSystem API implementations. All the validity checks on virtual
paths are done at this level. | 105 // 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); | 106 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); | 107 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); | 108 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); | 109 void remove(const EntryBase*, PassOwnPtr<VoidCallback>, PassOwnPtr<ErrorCall
back>, SynchronousType = Asynchronous); |
111 void removeRecursively(const EntryBase*, PassOwnPtr<VoidCallback>, PassOwnPt
r<ErrorCallback>, SynchronousType = Asynchronous); | 110 void removeRecursively(const EntryBase*, PassOwnPtr<VoidCallback>, PassOwnPt
r<ErrorCallback>, SynchronousType = Asynchronous); |
112 void getParent(const EntryBase*, PassOwnPtr<EntryCallback>, PassOwnPtr<Error
Callback>); | 111 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); | 112 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); | 113 void getDirectory(const EntryBase*, const String& path, const FileSystemFlag
s&, PassOwnPtr<EntryCallback>, PassOwnPtr<ErrorCallback>, SynchronousType = Asyn
chronous); |
115 int readDirectory(PassRefPtrWillBeRawPtr<DirectoryReaderBase>, const String&
path, PassOwnPtr<EntriesCallback>, PassOwnPtr<ErrorCallback>, SynchronousType =
Asynchronous); | 114 int readDirectory(DirectoryReaderBase*, const String& path, PassOwnPtr<Entri
esCallback>, PassOwnPtr<ErrorCallback>, SynchronousType = Asynchronous); |
116 bool waitForAdditionalResult(int callbacksId); | 115 bool waitForAdditionalResult(int callbacksId); |
117 | 116 |
118 virtual void trace(Visitor*) { } | 117 virtual void trace(Visitor*) { } |
119 | 118 |
120 protected: | 119 protected: |
121 DOMFileSystemBase(ExecutionContext*, const String& name, FileSystemType, con
st KURL& rootURL); | 120 DOMFileSystemBase(ExecutionContext*, const String& name, FileSystemType, con
st KURL& rootURL); |
122 friend class DOMFileSystemSync; | 121 friend class DOMFileSystemSync; |
123 | 122 |
124 ExecutionContext* m_context; | 123 ExecutionContext* m_context; |
125 String m_name; | 124 String m_name; |
126 FileSystemType m_type; | 125 FileSystemType m_type; |
127 KURL m_filesystemRootURL; | 126 KURL m_filesystemRootURL; |
128 bool m_clonable; | 127 bool m_clonable; |
129 }; | 128 }; |
130 | 129 |
131 inline bool operator==(const DOMFileSystemBase& a, const DOMFileSystemBase& b) {
return a.name() == b.name() && a.type() == b.type() && a.rootURL() == b.rootURL
(); } | 130 inline bool operator==(const DOMFileSystemBase& a, const DOMFileSystemBase& b) {
return a.name() == b.name() && a.type() == b.type() && a.rootURL() == b.rootURL
(); } |
132 | 131 |
133 } // namespace WebCore | 132 } // namespace WebCore |
134 | 133 |
135 #endif // DOMFileSystemBase_h | 134 #endif // DOMFileSystemBase_h |
OLD | NEW |