2016-06-07 01:55:16 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2016-08-18 10:18:05 +03:00
|
|
|
#ifndef mozilla_dom_FileSystemDirectoryEntry_h
|
|
|
|
#define mozilla_dom_FileSystemDirectoryEntry_h
|
2016-06-07 01:55:16 +03:00
|
|
|
|
2016-08-18 10:17:02 +03:00
|
|
|
#include "mozilla/dom/FileSystemBinding.h"
|
2016-08-18 10:17:25 +03:00
|
|
|
#include "mozilla/dom/FileSystemEntry.h"
|
2016-06-07 01:55:16 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2016-06-07 01:55:16 +03:00
|
|
|
class Directory;
|
2016-08-18 10:19:41 +03:00
|
|
|
class FileSystemDirectoryReader;
|
2016-06-07 01:55:16 +03:00
|
|
|
|
2016-08-18 10:18:05 +03:00
|
|
|
class FileSystemDirectoryEntry : public FileSystemEntry
|
2016-06-07 01:55:16 +03:00
|
|
|
{
|
|
|
|
public:
|
2016-06-07 01:55:16 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2016-08-18 10:18:05 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileSystemDirectoryEntry,
|
|
|
|
FileSystemEntry)
|
2016-06-07 01:55:16 +03:00
|
|
|
|
2016-08-18 10:18:05 +03:00
|
|
|
FileSystemDirectoryEntry(nsIGlobalObject* aGlobalObject,
|
|
|
|
Directory* aDirectory,
|
|
|
|
FileSystem* aFileSystem);
|
2016-06-07 01:55:16 +03:00
|
|
|
|
|
|
|
virtual JSObject*
|
|
|
|
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
2016-06-07 01:55:16 +03:00
|
|
|
virtual bool
|
|
|
|
IsDirectory() const override
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
GetName(nsAString& aName, ErrorResult& aRv) const override;
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
GetFullPath(nsAString& aFullPath, ErrorResult& aRv) const override;
|
|
|
|
|
2016-08-18 10:18:51 +03:00
|
|
|
virtual already_AddRefed<FileSystemDirectoryReader>
|
2016-06-07 01:55:17 +03:00
|
|
|
CreateReader() const;
|
2016-06-07 01:55:16 +03:00
|
|
|
|
|
|
|
void
|
|
|
|
GetFile(const nsAString& aPath, const FileSystemFlags& aFlag,
|
2016-08-18 10:19:15 +03:00
|
|
|
const Optional<OwningNonNull<FileSystemEntryCallback>>& aSuccessCallback,
|
2016-06-07 01:55:17 +03:00
|
|
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
|
2016-06-07 01:55:16 +03:00
|
|
|
{
|
2016-06-07 01:55:17 +03:00
|
|
|
GetInternal(aPath, aFlag, aSuccessCallback, aErrorCallback, eGetFile);
|
2016-06-07 01:55:16 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GetDirectory(const nsAString& aPath, const FileSystemFlags& aFlag,
|
2016-08-18 10:19:15 +03:00
|
|
|
const Optional<OwningNonNull<FileSystemEntryCallback>>& aSuccessCallback,
|
2016-06-07 01:55:17 +03:00
|
|
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
|
2016-06-07 01:55:16 +03:00
|
|
|
{
|
2016-06-07 01:55:17 +03:00
|
|
|
GetInternal(aPath, aFlag, aSuccessCallback, aErrorCallback, eGetDirectory);
|
2016-06-07 01:55:16 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RemoveRecursively(VoidCallback& aSuccessCallback,
|
2016-06-07 01:55:17 +03:00
|
|
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const;
|
2016-06-07 01:55:16 +03:00
|
|
|
|
2016-06-07 01:55:17 +03:00
|
|
|
enum GetInternalType { eGetFile, eGetDirectory };
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
GetInternal(const nsAString& aPath, const FileSystemFlags& aFlag,
|
2016-08-18 10:19:15 +03:00
|
|
|
const Optional<OwningNonNull<FileSystemEntryCallback>>& aSuccessCallback,
|
2016-06-07 01:55:17 +03:00
|
|
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
|
|
|
GetInternalType aType) const;
|
|
|
|
|
2016-06-07 01:55:17 +03:00
|
|
|
protected:
|
2016-08-18 10:18:05 +03:00
|
|
|
virtual ~FileSystemDirectoryEntry();
|
2016-06-07 01:55:16 +03:00
|
|
|
|
2016-06-07 01:55:17 +03:00
|
|
|
private:
|
2016-06-07 01:55:16 +03:00
|
|
|
RefPtr<Directory> mDirectory;
|
2016-06-07 01:55:16 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2016-08-18 10:18:05 +03:00
|
|
|
#endif // mozilla_dom_FileSystemDirectoryEntry_h
|