diff options
Diffstat (limited to 'Source/WebCore/fileapi/FileList.h')
-rw-r--r-- | Source/WebCore/fileapi/FileList.h | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/Source/WebCore/fileapi/FileList.h b/Source/WebCore/fileapi/FileList.h index 1e982ee77..7296bc5de 100644 --- a/Source/WebCore/fileapi/FileList.h +++ b/Source/WebCore/fileapi/FileList.h @@ -23,12 +23,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef FileList_h -#define FileList_h +#pragma once #include "File.h" #include "ScriptWrappable.h" -#include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> @@ -37,25 +35,35 @@ namespace WebCore { class FileList : public ScriptWrappable, public RefCounted<FileList> { public: - static PassRefPtr<FileList> create() + static Ref<FileList> create() { - return adoptRef(new FileList); + return adoptRef(*new FileList); + } + + static Ref<FileList> create(Vector<RefPtr<File>>&& files) + { + return adoptRef(*new FileList(WTFMove(files))); } unsigned length() const { return m_files.size(); } - File* item(unsigned index) const; + WEBCORE_EXPORT File* item(unsigned index) const; bool isEmpty() const { return m_files.isEmpty(); } - void clear() { m_files.clear(); } - void append(PassRefPtr<File> file) { m_files.append(file); } Vector<String> paths() const; private: FileList(); + FileList(Vector<RefPtr<File>>&& files) + : m_files(WTFMove(files)) + { } + + // FileLists can only be changed by their owners. + friend class DataTransfer; + friend class FileInputType; + void append(RefPtr<File>&& file) { m_files.append(WTFMove(file)); } + void clear() { m_files.clear(); } Vector<RefPtr<File>> m_files; }; } // namespace WebCore - -#endif // FileList_h |