DOMFileSystemBase.h [plain text]
#ifndef DOMFileSystemBase_h
#define DOMFileSystemBase_h
#if ENABLE(FILE_SYSTEM)
#include "AsyncFileSystem.h"
#include "FileSystemFlags.h"
#include "FileSystemType.h"
#include "KURL.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class DirectoryEntry;
class DirectoryReaderBase;
class EntriesCallback;
class EntryBase;
class EntryCallback;
class ErrorCallback;
class MetadataCallback;
class ScriptExecutionContext;
class SecurityOrigin;
class VoidCallback;
class DOMFileSystemBase : public RefCounted<DOMFileSystemBase> {
public:
static const char persistentPathPrefix[];
static const size_t persistentPathPrefixLength;
static const char temporaryPathPrefix[];
static const size_t temporaryPathPrefixLength;
static const char isolatedPathPrefix[];
static const size_t isolatedPathPrefixLength;
static PassRefPtr<DOMFileSystemBase> create(ScriptExecutionContext* context, const String& name, FileSystemType type, const KURL& rootURL, PassOwnPtr<AsyncFileSystem> asyncFileSystem)
{
return adoptRef(new DOMFileSystemBase(context, name, type, rootURL, asyncFileSystem));
}
virtual ~DOMFileSystemBase();
const String& name() const { return m_name; }
FileSystemType type() const { return m_type; }
KURL rootURL() const { return m_filesystemRootURL; }
AsyncFileSystem* asyncFileSystem() const { return m_asyncFileSystem.get(); }
SecurityOrigin* securityOrigin() const;
void makeClonable() { m_clonable = true; }
bool clonable() const { return m_clonable; }
static bool isValidType(FileSystemType);
static bool crackFileSystemURL(const KURL&, FileSystemType&, String& filePath);
bool supportsToURL() const;
KURL createFileSystemURL(const EntryBase*) const;
KURL createFileSystemURL(const String& fullPath) const;
bool getMetadata(const EntryBase*, PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>);
bool move(const EntryBase* source, EntryBase* parent, const String& name, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>);
bool copy(const EntryBase* source, EntryBase* parent, const String& name, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>);
bool remove(const EntryBase*, PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>);
bool removeRecursively(const EntryBase*, PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>);
bool getParent(const EntryBase*, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>);
bool getFile(const EntryBase*, const String& path, const FileSystemFlags&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>);
bool getDirectory(const EntryBase*, const String& path, const FileSystemFlags&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>);
bool readDirectory(PassRefPtr<DirectoryReaderBase>, const String& path, PassRefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>);
protected:
DOMFileSystemBase(ScriptExecutionContext*, const String& name, FileSystemType, const KURL& rootURL, PassOwnPtr<AsyncFileSystem>);
friend class DOMFileSystemSync;
ScriptExecutionContext* m_context;
String m_name;
FileSystemType m_type;
KURL m_filesystemRootURL;
bool m_clonable;
mutable OwnPtr<AsyncFileSystem> m_asyncFileSystem;
};
inline bool operator==(const DOMFileSystemBase& a, const DOMFileSystemBase& b) { return a.name() == b.name() && a.type() == b.type() && a.rootURL() == b.rootURL(); }
}
#endif // ENABLE(FILE_SYSTEM)
#endif // DOMFileSystemBase_h