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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 SecurityOrigin* securityOrigin() const; | 89 SecurityOrigin* securityOrigin() const; |
90 | 90 |
91 // The clonable flag is used in the structured clone algorithm to test | 91 // The clonable flag is used in the structured clone algorithm to test |
92 // whether the FileSystem API object is permitted to be cloned. It defaults | 92 // whether the FileSystem API object is permitted to be cloned. It defaults |
93 // to false, and must be explicitly set by internal code permit cloning. | 93 // to false, and must be explicitly set by internal code permit cloning. |
94 void makeClonable() { m_clonable = true; } | 94 void makeClonable() { m_clonable = true; } |
95 bool clonable() const { return m_clonable; } | 95 bool clonable() const { return m_clonable; } |
96 | 96 |
97 static bool isValidType(FileSystemType); | 97 static bool isValidType(FileSystemType); |
98 static bool crackFileSystemURL(const KURL&, FileSystemType&, String& filePat
h); | 98 static bool crackFileSystemURL(const KURL&, FileSystemType&, String& filePat
h); |
| 99 static KURL createFileSystemRootURL(const String& origin, FileSystemType); |
99 bool supportsToURL() const; | 100 bool supportsToURL() const; |
100 KURL createFileSystemURL(const EntryBase*) const; | 101 KURL createFileSystemURL(const EntryBase*) const; |
101 KURL createFileSystemURL(const String& fullPath) const; | 102 KURL createFileSystemURL(const String& fullPath) const; |
| 103 static bool pathToAbsolutePath(FileSystemType, const EntryBase*, String path
, String& absolutePath); |
| 104 static bool pathPrefixToFileSystemType(const String& pathPrefix, FileSystemT
ype&); |
102 | 105 |
103 // Actual FileSystem API implementations. All the validity checks on virtual
paths are done at this level. | 106 // Actual FileSystem API implementations. All the validity checks on virtual
paths are done at this level. |
104 // They return false for immediate errors that don't involve lower WebFileSy
stem layer (e.g. for name validation errors). Otherwise they return true (but la
ter may call back with an runtime error). | 107 // They return false for immediate errors that don't involve lower WebFileSy
stem layer (e.g. for name validation errors). Otherwise they return true (but la
ter may call back with an runtime error). |
105 bool getMetadata(const EntryBase*, PassRefPtr<MetadataCallback>, PassRefPtr<
ErrorCallback>, SynchronousType = Asynchronous); | 108 bool getMetadata(const EntryBase*, PassRefPtr<MetadataCallback>, PassRefPtr<
ErrorCallback>, SynchronousType = Asynchronous); |
106 bool move(const EntryBase* source, EntryBase* parent, const String& name, Pa
ssRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>, SynchronousType = Asynchrono
us); | 109 bool move(const EntryBase* source, EntryBase* parent, const String& name, Pa
ssRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>, SynchronousType = Asynchrono
us); |
107 bool copy(const EntryBase* source, EntryBase* parent, const String& name, Pa
ssRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>, SynchronousType = Asynchrono
us); | 110 bool copy(const EntryBase* source, EntryBase* parent, const String& name, Pa
ssRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>, SynchronousType = Asynchrono
us); |
108 bool remove(const EntryBase*, PassRefPtr<VoidCallback>, PassRefPtr<ErrorCall
back>, SynchronousType = Asynchronous); | 111 bool remove(const EntryBase*, PassRefPtr<VoidCallback>, PassRefPtr<ErrorCall
back>, SynchronousType = Asynchronous); |
109 bool removeRecursively(const EntryBase*, PassRefPtr<VoidCallback>, PassRefPt
r<ErrorCallback>, SynchronousType = Asynchronous); | 112 bool removeRecursively(const EntryBase*, PassRefPtr<VoidCallback>, PassRefPt
r<ErrorCallback>, SynchronousType = Asynchronous); |
110 bool getParent(const EntryBase*, PassRefPtr<EntryCallback>, PassRefPtr<Error
Callback>); | 113 bool getParent(const EntryBase*, PassRefPtr<EntryCallback>, PassRefPtr<Error
Callback>); |
111 bool getFile(const EntryBase*, const String& path, const FileSystemFlags&, P
assRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>, SynchronousType = Asynchron
ous); | 114 bool getFile(const EntryBase*, const String& path, const FileSystemFlags&, P
assRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>, SynchronousType = Asynchron
ous); |
112 bool getDirectory(const EntryBase*, const String& path, const FileSystemFlag
s&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>, SynchronousType = Asyn
chronous); | 115 bool getDirectory(const EntryBase*, const String& path, const FileSystemFlag
s&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>, SynchronousType = Asyn
chronous); |
113 bool readDirectory(PassRefPtr<DirectoryReaderBase>, const String& path, Pass
RefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>, SynchronousType = Asynchrono
us); | 116 bool readDirectory(PassRefPtr<DirectoryReaderBase>, const String& path, Pass
RefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>, SynchronousType = Asynchrono
us); |
114 | 117 |
115 protected: | 118 protected: |
116 DOMFileSystemBase(ScriptExecutionContext*, const String& name, FileSystemTyp
e, const KURL& rootURL); | 119 DOMFileSystemBase(ScriptExecutionContext*, const String& name, FileSystemTyp
e, const KURL& rootURL); |
117 friend class DOMFileSystemSync; | 120 friend class DOMFileSystemSync; |
118 | 121 |
119 ScriptExecutionContext* m_context; | 122 ScriptExecutionContext* m_context; |
120 String m_name; | 123 String m_name; |
121 FileSystemType m_type; | 124 FileSystemType m_type; |
122 KURL m_filesystemRootURL; | 125 KURL m_filesystemRootURL; |
123 bool m_clonable; | 126 bool m_clonable; |
124 }; | 127 }; |
125 | 128 |
126 inline bool operator==(const DOMFileSystemBase& a, const DOMFileSystemBase& b) {
return a.name() == b.name() && a.type() == b.type() && a.rootURL() == b.rootURL
(); } | 129 inline bool operator==(const DOMFileSystemBase& a, const DOMFileSystemBase& b) {
return a.name() == b.name() && a.type() == b.type() && a.rootURL() == b.rootURL
(); } |
127 | 130 |
128 } // namespace WebCore | 131 } // namespace WebCore |
129 | 132 |
130 #endif // DOMFileSystemBase_h | 133 #endif // DOMFileSystemBase_h |
OLD | NEW |