Chromium Code Reviews| 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 bool readDirectory(PassRefPtr<DirectoryReaderBase>, const String& path, Pass OwnPtr<EntriesCallback>, PassOwnPtr<ErrorCallback>, SynchronousType = Asynchrono us); | 116 bool readDirectory(PassRefPtrWillBeRawPtr<DirectoryReaderBase>, const String & path, PassOwnPtr<EntriesCallback>, PassOwnPtr<ErrorCallback>, SynchronousType = Asynchronous); |
| 117 | |
| 118 virtual void trace(Visitor*) { } | |
| 116 | 119 |
| 117 protected: | 120 protected: |
| 118 DOMFileSystemBase(ExecutionContext*, const String& name, FileSystemType, con st KURL& rootURL); | 121 DOMFileSystemBase(ExecutionContext*, const String& name, FileSystemType, con st KURL& rootURL); |
| 119 friend class DOMFileSystemSync; | 122 friend class DOMFileSystemSync; |
| 120 | 123 |
| 121 ExecutionContext* m_context; | 124 ExecutionContext* m_context; |
|
haraken
2014/03/07 08:24:35
Are you sure that this raw pointer is safe? There
sof
2014/03/07 09:37:36
It is used to gain access to the SecurityOrigin wh
| |
| 122 String m_name; | 125 String m_name; |
| 123 FileSystemType m_type; | 126 FileSystemType m_type; |
| 124 KURL m_filesystemRootURL; | 127 KURL m_filesystemRootURL; |
| 125 bool m_clonable; | 128 bool m_clonable; |
| 126 }; | 129 }; |
| 127 | 130 |
| 128 inline bool operator==(const DOMFileSystemBase& a, const DOMFileSystemBase& b) { return a.name() == b.name() && a.type() == b.type() && a.rootURL() == b.rootURL (); } | 131 inline bool operator==(const DOMFileSystemBase& a, const DOMFileSystemBase& b) { return a.name() == b.name() && a.type() == b.type() && a.rootURL() == b.rootURL (); } |
| 129 | 132 |
| 130 } // namespace WebCore | 133 } // namespace WebCore |
| 131 | 134 |
| 132 #endif // DOMFileSystemBase_h | 135 #endif // DOMFileSystemBase_h |
| OLD | NEW |