Bug 1295570 - Entries API - part 4 - Rename DirectoryEntry to FileSystemDirectoryEntry, r=smaug

--HG--
rename : dom/filesystem/compat/DirectoryEntry.cpp => dom/filesystem/compat/FileSystemDirectoryEntry.cpp
rename : dom/filesystem/compat/DirectoryEntry.h => dom/filesystem/compat/FileSystemDirectoryEntry.h
rename : dom/filesystem/compat/RootDirectoryEntry.cpp => dom/filesystem/compat/FileSystemRootDirectoryEntry.cpp
rename : dom/filesystem/compat/RootDirectoryEntry.h => dom/filesystem/compat/FileSystemRootDirectoryEntry.h
This commit is contained in:
Andrea Marchesini 2016-08-18 09:18:05 +02:00
Родитель e06457dcf2
Коммит de09eb6947
13 изменённых файлов: 93 добавлений и 86 удалений

Просмотреть файл

@ -10,9 +10,9 @@
#include "mozilla/EventForwards.h"
#include "mozilla/dom/DataTransferItemBinding.h"
#include "mozilla/dom/Directory.h"
#include "mozilla/dom/DirectoryEntry.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/FileSystem.h"
#include "mozilla/dom/FileSystemDirectoryEntry.h"
#include "mozilla/dom/FileSystemFileEntry.h"
#include "nsIClipboard.h"
#include "nsISupportsPrimitives.h"
@ -329,7 +329,7 @@ DataTransferItem::GetAsEntry(ErrorResult& aRv)
}
RefPtr<Directory> directory = Directory::Create(global, directoryFile);
entry = new DirectoryEntry(global, directory, fs);
entry = new FileSystemDirectoryEntry(global, directory, fs);
} else {
entry = new FileSystemFileEntry(global, file, fs);
}

Просмотреть файл

@ -76,7 +76,7 @@ GetEntryHelper::GetEntryHelper(nsIGlobalObject* aGlobalObject,
FileSystem* aFileSystem,
EntryCallback* aSuccessCallback,
ErrorCallback* aErrorCallback,
DirectoryEntry::GetInternalType aType)
FileSystemDirectoryEntry::GetInternalType aType)
: mGlobal(aGlobalObject)
, mFileSystem(aFileSystem)
, mSuccessCallback(aSuccessCallback)
@ -100,7 +100,7 @@ GetEntryHelper::ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue)
JS::Rooted<JSObject*> obj(aCx, &aValue.toObject());
if (mType == DirectoryEntry::eGetFile) {
if (mType == FileSystemDirectoryEntry::eGetFile) {
RefPtr<File> file;
if (NS_FAILED(UNWRAP_OBJECT(File, obj, file))) {
Error(NS_ERROR_DOM_TYPE_MISMATCH_ERR);
@ -113,7 +113,7 @@ GetEntryHelper::ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue)
return;
}
MOZ_ASSERT(mType == DirectoryEntry::eGetDirectory);
MOZ_ASSERT(mType == FileSystemDirectoryEntry::eGetDirectory);
RefPtr<Directory> directory;
if (NS_FAILED(UNWRAP_OBJECT(Directory, obj, directory))) {
@ -121,8 +121,8 @@ GetEntryHelper::ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue)
return;
}
RefPtr<DirectoryEntry> entry =
new DirectoryEntry(mGlobal, directory, mFileSystem);
RefPtr<FileSystemDirectoryEntry> entry =
new FileSystemDirectoryEntry(mGlobal, directory, mFileSystem);
mSuccessCallback->HandleEvent(*entry);
}

Просмотреть файл

@ -7,7 +7,7 @@
#ifndef mozilla_dom_ErrorCallbackRunnable_h
#define mozilla_dom_ErrorCallbackRunnable_h
#include "DirectoryEntry.h"
#include "FileSystemDirectoryEntry.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/PromiseNativeHandler.h"
@ -67,7 +67,7 @@ public:
FileSystem* aFileSystem,
EntryCallback* aSuccessCallback,
ErrorCallback* aErrorCallback,
DirectoryEntry::GetInternalType aType);
FileSystemDirectoryEntry::GetInternalType aType);
virtual void
ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override;
@ -85,7 +85,7 @@ private:
RefPtr<FileSystem> mFileSystem;
RefPtr<EntryCallback> mSuccessCallback;
RefPtr<ErrorCallback> mErrorCallback;
DirectoryEntry::GetInternalType mType;
FileSystemDirectoryEntry::GetInternalType mType;
};
class ErrorCallbackHelper

Просмотреть файл

@ -83,8 +83,8 @@ public:
return;
}
RefPtr<DirectoryEntry> entry =
new DirectoryEntry(mGlobal, directory, mFileSystem);
RefPtr<FileSystemDirectoryEntry> entry =
new FileSystemDirectoryEntry(mGlobal, directory, mFileSystem);
sequence[i] = entry;
}

Просмотреть файл

@ -5,7 +5,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "FileSystem.h"
#include "RootDirectoryEntry.h"
#include "FileSystemRootDirectoryEntry.h"
#include "mozilla/dom/FileSystemBinding.h"
#include "nsContentUtils.h"
@ -68,7 +68,7 @@ void
FileSystem::CreateRoot(const Sequence<RefPtr<FileSystemEntry>>& aEntries)
{
MOZ_ASSERT(!mRoot);
mRoot = new RootDirectoryEntry(mParent, aEntries, this);
mRoot = new FileSystemRootDirectoryEntry(mParent, aEntries, this);
}
} // dom namespace

Просмотреть файл

@ -18,7 +18,7 @@ class nsIGlobalObject;
namespace mozilla {
namespace dom {
class DirectoryEntry;
class FileSystemDirectoryEntry;
class FileSystemEntry;
class OwningFileOrDirectory;
@ -48,7 +48,7 @@ public:
aName = mName;
}
DirectoryEntry*
FileSystemDirectoryEntry*
Root() const
{
return mRoot;
@ -63,7 +63,7 @@ private:
~FileSystem();
nsCOMPtr<nsIGlobalObject> mParent;
RefPtr<DirectoryEntry> mRoot;
RefPtr<FileSystemDirectoryEntry> mRoot;
nsString mName;
};

Просмотреть файл

@ -4,7 +4,7 @@
* 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/. */
#include "DirectoryEntry.h"
#include "FileSystemDirectoryEntry.h"
#include "CallbackRunnables.h"
#include "DirectoryReader.h"
#include "mozilla/dom/Directory.h"
@ -13,48 +13,50 @@
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_INHERITED(DirectoryEntry, FileSystemEntry, mDirectory)
NS_IMPL_CYCLE_COLLECTION_INHERITED(FileSystemDirectoryEntry, FileSystemEntry,
mDirectory)
NS_IMPL_ADDREF_INHERITED(DirectoryEntry, FileSystemEntry)
NS_IMPL_RELEASE_INHERITED(DirectoryEntry, FileSystemEntry)
NS_IMPL_ADDREF_INHERITED(FileSystemDirectoryEntry, FileSystemEntry)
NS_IMPL_RELEASE_INHERITED(FileSystemDirectoryEntry, FileSystemEntry)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(DirectoryEntry)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FileSystemDirectoryEntry)
NS_INTERFACE_MAP_END_INHERITING(FileSystemEntry)
DirectoryEntry::DirectoryEntry(nsIGlobalObject* aGlobal,
Directory* aDirectory,
FileSystem* aFileSystem)
FileSystemDirectoryEntry::FileSystemDirectoryEntry(nsIGlobalObject* aGlobal,
Directory* aDirectory,
FileSystem* aFileSystem)
: FileSystemEntry(aGlobal, aFileSystem)
, mDirectory(aDirectory)
{
MOZ_ASSERT(aGlobal);
}
DirectoryEntry::~DirectoryEntry()
FileSystemDirectoryEntry::~FileSystemDirectoryEntry()
{}
JSObject*
DirectoryEntry::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
FileSystemDirectoryEntry::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
return DirectoryEntryBinding::Wrap(aCx, this, aGivenProto);
return FileSystemDirectoryEntryBinding::Wrap(aCx, this, aGivenProto);
}
void
DirectoryEntry::GetName(nsAString& aName, ErrorResult& aRv) const
FileSystemDirectoryEntry::GetName(nsAString& aName, ErrorResult& aRv) const
{
MOZ_ASSERT(mDirectory);
mDirectory->GetName(aName, aRv);
}
void
DirectoryEntry::GetFullPath(nsAString& aPath, ErrorResult& aRv) const
FileSystemDirectoryEntry::GetFullPath(nsAString& aPath, ErrorResult& aRv) const
{
MOZ_ASSERT(mDirectory);
mDirectory->GetPath(aPath, aRv);
}
already_AddRefed<DirectoryReader>
DirectoryEntry::CreateReader() const
FileSystemDirectoryEntry::CreateReader() const
{
MOZ_ASSERT(mDirectory);
@ -64,10 +66,11 @@ DirectoryEntry::CreateReader() const
}
void
DirectoryEntry::GetInternal(const nsAString& aPath, const FileSystemFlags& aFlag,
const Optional<OwningNonNull<EntryCallback>>& aSuccessCallback,
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
GetInternalType aType) const
FileSystemDirectoryEntry::GetInternal(const nsAString& aPath,
const FileSystemFlags& aFlag,
const Optional<OwningNonNull<EntryCallback>>& aSuccessCallback,
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
GetInternalType aType) const
{
MOZ_ASSERT(mDirectory);
@ -107,8 +110,8 @@ DirectoryEntry::GetInternal(const nsAString& aPath, const FileSystemFlags& aFlag
}
void
DirectoryEntry::RemoveRecursively(VoidCallback& aSuccessCallback,
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
FileSystemDirectoryEntry::RemoveRecursively(VoidCallback& aSuccessCallback,
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
{
ErrorCallbackHelper::Call(GetParentObject(), aErrorCallback,
NS_ERROR_DOM_SECURITY_ERR);

Просмотреть файл

@ -4,8 +4,8 @@
* 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/. */
#ifndef mozilla_dom_DirectoryEntry_h
#define mozilla_dom_DirectoryEntry_h
#ifndef mozilla_dom_FileSystemDirectoryEntry_h
#define mozilla_dom_FileSystemDirectoryEntry_h
#include "mozilla/dom/FileSystemBinding.h"
#include "mozilla/dom/FileSystemEntry.h"
@ -15,14 +15,16 @@ namespace dom {
class Directory;
class DirectoryEntry : public FileSystemEntry
class FileSystemDirectoryEntry : public FileSystemEntry
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DirectoryEntry, FileSystemEntry)
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileSystemDirectoryEntry,
FileSystemEntry)
DirectoryEntry(nsIGlobalObject* aGlobalObject, Directory* aDirectory,
FileSystem* aFileSystem);
FileSystemDirectoryEntry(nsIGlobalObject* aGlobalObject,
Directory* aDirectory,
FileSystem* aFileSystem);
virtual JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
@ -71,7 +73,7 @@ public:
GetInternalType aType) const;
protected:
virtual ~DirectoryEntry();
virtual ~FileSystemDirectoryEntry();
private:
RefPtr<Directory> mDirectory;
@ -80,4 +82,4 @@ private:
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_DirectoryEntry_h
#endif // mozilla_dom_FileSystemDirectoryEntry_h

Просмотреть файл

@ -5,7 +5,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "FileSystemEntry.h"
#include "DirectoryEntry.h"
#include "FileSystemDirectoryEntry.h"
#include "FileSystemFileEntry.h"
#include "mozilla/dom/UnionTypes.h"
@ -37,9 +37,9 @@ FileSystemEntry::Create(nsIGlobalObject* aGlobalObject,
aFileSystem);
} else {
MOZ_ASSERT(aFileOrDirectory.IsDirectory());
entry = new DirectoryEntry(aGlobalObject,
aFileOrDirectory.GetAsDirectory(),
aFileSystem);
entry = new FileSystemDirectoryEntry(aGlobalObject,
aFileOrDirectory.GetAsDirectory(),
aFileSystem);
}
return entry.forget();

Просмотреть файл

@ -4,47 +4,48 @@
* 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/. */
#include "RootDirectoryEntry.h"
#include "FileSystemRootDirectoryEntry.h"
#include "RootDirectoryReader.h"
#include "mozilla/dom/FileSystemUtils.h"
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_INHERITED(RootDirectoryEntry, DirectoryEntry, mEntries)
NS_IMPL_CYCLE_COLLECTION_INHERITED(FileSystemRootDirectoryEntry,
FileSystemDirectoryEntry, mEntries)
NS_IMPL_ADDREF_INHERITED(RootDirectoryEntry, DirectoryEntry)
NS_IMPL_RELEASE_INHERITED(RootDirectoryEntry, DirectoryEntry)
NS_IMPL_ADDREF_INHERITED(FileSystemRootDirectoryEntry, FileSystemDirectoryEntry)
NS_IMPL_RELEASE_INHERITED(FileSystemRootDirectoryEntry, FileSystemDirectoryEntry)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(RootDirectoryEntry)
NS_INTERFACE_MAP_END_INHERITING(DirectoryEntry)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FileSystemRootDirectoryEntry)
NS_INTERFACE_MAP_END_INHERITING(FileSystemDirectoryEntry)
RootDirectoryEntry::RootDirectoryEntry(nsIGlobalObject* aGlobal,
const Sequence<RefPtr<FileSystemEntry>>& aEntries,
FileSystem* aFileSystem)
: DirectoryEntry(aGlobal, nullptr, aFileSystem)
FileSystemRootDirectoryEntry::FileSystemRootDirectoryEntry(nsIGlobalObject* aGlobal,
const Sequence<RefPtr<FileSystemEntry>>& aEntries,
FileSystem* aFileSystem)
: FileSystemDirectoryEntry(aGlobal, nullptr, aFileSystem)
, mEntries(aEntries)
{
MOZ_ASSERT(aGlobal);
}
RootDirectoryEntry::~RootDirectoryEntry()
FileSystemRootDirectoryEntry::~FileSystemRootDirectoryEntry()
{}
void
RootDirectoryEntry::GetName(nsAString& aName, ErrorResult& aRv) const
FileSystemRootDirectoryEntry::GetName(nsAString& aName, ErrorResult& aRv) const
{
aName.Truncate();
}
void
RootDirectoryEntry::GetFullPath(nsAString& aPath, ErrorResult& aRv) const
FileSystemRootDirectoryEntry::GetFullPath(nsAString& aPath, ErrorResult& aRv) const
{
aPath.AssignLiteral(FILESYSTEM_DOM_PATH_SEPARATOR_LITERAL);
}
already_AddRefed<DirectoryReader>
RootDirectoryEntry::CreateReader() const
FileSystemRootDirectoryEntry::CreateReader() const
{
RefPtr<DirectoryReader> reader =
new RootDirectoryReader(GetParentObject(), Filesystem(), mEntries);
@ -52,10 +53,11 @@ RootDirectoryEntry::CreateReader() const
}
void
RootDirectoryEntry::GetInternal(const nsAString& aPath, const FileSystemFlags& aFlag,
const Optional<OwningNonNull<EntryCallback>>& aSuccessCallback,
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
GetInternalType aType) const
FileSystemRootDirectoryEntry::GetInternal(const nsAString& aPath,
const FileSystemFlags& aFlag,
const Optional<OwningNonNull<EntryCallback>>& aSuccessCallback,
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
GetInternalType aType) const
{
if (!aSuccessCallback.WasPassed() && !aErrorCallback.WasPassed()) {
return;
@ -135,7 +137,7 @@ RootDirectoryEntry::GetInternal(const nsAString& aPath, const FileSystemFlags& a
}
}
auto* directoryEntry = static_cast<DirectoryEntry*>(entry.get());
auto* directoryEntry = static_cast<FileSystemDirectoryEntry*>(entry.get());
directoryEntry->GetInternal(path, aFlag, aSuccessCallback, aErrorCallback,
aType);
}

Просмотреть файл

@ -4,23 +4,23 @@
* 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/. */
#ifndef mozilla_dom_RootDirectoryEntry_h
#define mozilla_dom_RootDirectoryEntry_h
#ifndef mozilla_dom_FileSystemRootDirectoryEntry_h
#define mozilla_dom_FileSystemRootDirectoryEntry_h
#include "mozilla/dom/DirectoryEntry.h"
#include "mozilla/dom/FileSystemDirectoryEntry.h"
namespace mozilla {
namespace dom {
class RootDirectoryEntry final : public DirectoryEntry
class FileSystemRootDirectoryEntry final : public FileSystemDirectoryEntry
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RootDirectoryEntry, DirectoryEntry)
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileSystemRootDirectoryEntry, FileSystemDirectoryEntry)
RootDirectoryEntry(nsIGlobalObject* aGlobalObject,
const Sequence<RefPtr<FileSystemEntry>>& aEntries,
FileSystem* aFileSystem);
FileSystemRootDirectoryEntry(nsIGlobalObject* aGlobalObject,
const Sequence<RefPtr<FileSystemEntry>>& aEntries,
FileSystem* aFileSystem);
virtual void
GetName(nsAString& aName, ErrorResult& aRv) const override;
@ -32,7 +32,7 @@ public:
CreateReader() const override;
private:
~RootDirectoryEntry();
~FileSystemRootDirectoryEntry();
virtual void
GetInternal(const nsAString& aPath, const FileSystemFlags& aFlag,
@ -50,4 +50,4 @@ private:
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_RootDirectoryEntry_h
#endif // mozilla_dom_FileSystemRootDirectoryEntry_h

Просмотреть файл

@ -7,21 +7,21 @@
TEST_DIRS += ['tests']
EXPORTS.mozilla.dom += [
'DirectoryEntry.h',
'DirectoryReader.h',
'FileSystem.h',
'FileSystemDirectoryEntry.h',
'FileSystemEntry.h',
'FileSystemFileEntry.h',
]
UNIFIED_SOURCES += [
'CallbackRunnables.cpp',
'DirectoryEntry.cpp',
'DirectoryReader.cpp',
'FileSystem.cpp',
'FileSystemDirectoryEntry.cpp',
'FileSystemEntry.cpp',
'FileSystemFileEntry.cpp',
'RootDirectoryEntry.cpp',
'FileSystemRootDirectoryEntry.cpp',
'RootDirectoryReader.cpp',
]

Просмотреть файл

@ -19,8 +19,8 @@ interface FileSystemEntry {
/** Not implemented:
* void getMetadata(MetadataCallback successCallback, optional ErrorCallback errorCallback);
* void moveTo(DirectoryEntry parent, optional DOMString? name, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
* void copyTo(DirectoryEntry parent, optional DOMString? name, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
* void moveTo(FileSystemDirectoryEntry parent, optional DOMString? name, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
* void copyTo(FileSystemDirectoryEntry parent, optional DOMString? name, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
* DOMString toURL();
* void remove(VoidCallback successCallback, optional ErrorCallback errorCallback);
* void getParent(optional EntryCallback successCallback, optional ErrorCallback errorCallback);
@ -41,7 +41,7 @@ callback interface VoidCallback {
};
[NoInterfaceObject]
interface DirectoryEntry : FileSystemEntry {
interface FileSystemDirectoryEntry : FileSystemEntry {
DirectoryReader createReader();
void getFile(DOMString? path, optional FileSystemFlags options, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
@ -88,6 +88,6 @@ interface FileSystemFileEntry : FileSystemEntry {
[NoInterfaceObject]
interface FileSystem {
readonly attribute DOMString name;
readonly attribute DirectoryEntry root;
readonly attribute DOMString name;
readonly attribute FileSystemDirectoryEntry root;
};