Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 : * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef mozilla_dom_FileSystemDirectoryReader_h
8 : #define mozilla_dom_FileSystemDirectoryReader_h
9 :
10 : #include "mozilla/Attributes.h"
11 : #include "mozilla/ErrorResult.h"
12 : #include "mozilla/dom/BindingDeclarations.h"
13 : #include "mozilla/dom/FileSystemDirectoryEntry.h"
14 : #include "nsCycleCollectionParticipant.h"
15 : #include "nsWrapperCache.h"
16 :
17 : namespace mozilla {
18 : namespace dom {
19 :
20 : class Directory;
21 : class FileSystem;
22 : class FileSystemEntriesCallback;
23 :
24 : class FileSystemDirectoryReader
25 : : public nsISupports
26 : , public nsWrapperCache
27 : {
28 : public:
29 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
30 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(FileSystemDirectoryReader)
31 :
32 : explicit FileSystemDirectoryReader(FileSystemDirectoryEntry* aDirectoryEntry,
33 : FileSystem* aFileSystem,
34 : Directory* aDirectory);
35 :
36 : nsIGlobalObject*
37 0 : GetParentObject() const
38 : {
39 0 : return mParentEntry->GetParentObject();
40 : }
41 :
42 : virtual JSObject*
43 : WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
44 :
45 : virtual void
46 : ReadEntries(FileSystemEntriesCallback& aSuccessCallback,
47 : const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
48 : ErrorResult& aRv);
49 :
50 : protected:
51 : virtual ~FileSystemDirectoryReader();
52 :
53 : private:
54 : RefPtr<FileSystemDirectoryEntry> mParentEntry;
55 : RefPtr<FileSystem> mFileSystem;
56 : RefPtr<Directory> mDirectory;
57 :
58 : bool mAlreadyRead;
59 : };
60 :
61 : } // namespace dom
62 : } // namespace mozilla
63 :
64 : #endif // mozilla_dom_FileSystemDirectoryReader_h
|