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:17:25 +03:00
|
|
|
#ifndef mozilla_dom_FileSystemEntry_h
|
|
|
|
#define mozilla_dom_FileSystemEntry_h
|
2016-06-07 01:55:16 +03:00
|
|
|
|
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
#include "mozilla/ErrorResult.h"
|
|
|
|
#include "mozilla/dom/BindingDeclarations.h"
|
2016-11-03 09:55:30 +03:00
|
|
|
#include "mozilla/dom/FileSystemBinding.h"
|
2016-06-07 01:55:16 +03:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2016-06-07 01:55:17 +03:00
|
|
|
#include "nsIGlobalObject.h"
|
2016-06-07 01:55:16 +03:00
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2016-08-18 10:17:02 +03:00
|
|
|
class FileSystem;
|
2016-06-07 01:55:16 +03:00
|
|
|
class OwningFileOrDirectory;
|
2016-06-07 01:55:16 +03:00
|
|
|
|
|
|
|
class FileSystemEntry : public nsISupports, public nsWrapperCache {
|
|
|
|
public:
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2016-08-18 10:17:25 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(FileSystemEntry)
|
2016-06-07 01:55:16 +03:00
|
|
|
|
2016-08-18 10:17:25 +03:00
|
|
|
static already_AddRefed<FileSystemEntry> Create(
|
2016-06-07 01:55:16 +03:00
|
|
|
nsIGlobalObject* aGlobalObject,
|
2016-06-07 01:55:17 +03:00
|
|
|
const OwningFileOrDirectory& aFileOrDirectory, FileSystem* aFileSystem);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-06-07 01:55:16 +03:00
|
|
|
nsIGlobalObject* GetParentObject() const { return mParent; }
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-06-07 01:55:16 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-06-07 01:55:16 +03:00
|
|
|
virtual bool IsFile() const { return false; }
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-06-07 01:55:16 +03:00
|
|
|
virtual bool IsDirectory() const { return false; }
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-06-07 01:55:16 +03:00
|
|
|
virtual void GetName(nsAString& aName, ErrorResult& aRv) const = 0;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-06-07 01:55:16 +03:00
|
|
|
virtual void GetFullPath(nsAString& aFullPath, ErrorResult& aRv) const = 0;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-11-03 09:55:30 +03:00
|
|
|
void GetParent(
|
|
|
|
const Optional<OwningNonNull<FileSystemEntryCallback>>& aSuccessCallback,
|
|
|
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-06-07 01:55:17 +03:00
|
|
|
FileSystem* Filesystem() const { return mFileSystem; }
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-06-07 01:55:16 +03:00
|
|
|
protected:
|
2016-08-18 10:17:25 +03:00
|
|
|
FileSystemEntry(nsIGlobalObject* aGlobalObject, FileSystemEntry* aParentEntry,
|
|
|
|
FileSystem* aFileSystem);
|
|
|
|
virtual ~FileSystemEntry();
|
2016-06-07 01:55:16 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
nsCOMPtr<nsIGlobalObject> mParent;
|
2016-11-03 09:55:30 +03:00
|
|
|
RefPtr<FileSystemEntry> mParentEntry;
|
2016-08-18 10:17:02 +03:00
|
|
|
RefPtr<FileSystem> mFileSystem;
|
2016-06-07 01:55:16 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2016-08-18 10:17:25 +03:00
|
|
|
#endif // mozilla_dom_FileSystemEntry_h
|