2012-06-03 09:33:52 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_file_filerequest_h__
|
|
|
|
#define mozilla_dom_file_filerequest_h__
|
|
|
|
|
2013-06-05 09:15:48 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-06-03 09:33:52 -07:00
|
|
|
#include "FileCommon.h"
|
|
|
|
|
|
|
|
#include "DOMRequest.h"
|
|
|
|
|
2014-03-16 10:37:22 -07:00
|
|
|
class nsIDOMLockedFile;
|
|
|
|
|
2014-03-17 21:48:19 -07:00
|
|
|
namespace mozilla {
|
|
|
|
class EventChainPreVisitor;
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2012-06-03 09:33:52 -07:00
|
|
|
BEGIN_FILE_NAMESPACE
|
|
|
|
|
|
|
|
class FileHelper;
|
|
|
|
class LockedFile;
|
|
|
|
|
2013-03-17 01:51:36 -07:00
|
|
|
class FileRequest : public mozilla::dom::DOMRequest
|
2012-06-03 09:33:52 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileRequest, DOMRequest)
|
|
|
|
|
|
|
|
static already_AddRefed<FileRequest>
|
2014-03-16 09:53:44 -07:00
|
|
|
Create(nsPIDOMWindow* aOwner, LockedFile* aLockedFile,
|
|
|
|
bool aWrapAsDOMRequest);
|
2012-06-03 09:33:52 -07:00
|
|
|
|
|
|
|
// nsIDOMEventTarget
|
|
|
|
virtual nsresult
|
2014-03-17 21:48:19 -07:00
|
|
|
PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
2012-06-03 09:33:52 -07:00
|
|
|
|
|
|
|
void
|
2012-08-22 08:56:38 -07:00
|
|
|
OnProgress(uint64_t aProgress, uint64_t aProgressMax)
|
2012-06-03 09:33:52 -07:00
|
|
|
{
|
|
|
|
FireProgressEvent(aProgress, aProgressMax);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
NotifyHelperCompleted(FileHelper* aFileHelper);
|
|
|
|
|
2014-03-16 09:53:44 -07:00
|
|
|
// nsWrapperCache
|
|
|
|
virtual JSObject*
|
|
|
|
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
// WebIDL
|
|
|
|
nsIDOMLockedFile*
|
|
|
|
GetLockedFile() const;
|
|
|
|
|
|
|
|
IMPL_EVENT_HANDLER(progress)
|
|
|
|
|
2013-03-17 01:51:36 -07:00
|
|
|
protected:
|
2014-01-06 18:53:23 -08:00
|
|
|
FileRequest(nsPIDOMWindow* aWindow);
|
2012-06-03 09:33:52 -07:00
|
|
|
~FileRequest();
|
|
|
|
|
|
|
|
void
|
2012-08-22 08:56:38 -07:00
|
|
|
FireProgressEvent(uint64_t aLoaded, uint64_t aTotal);
|
2012-06-03 09:33:52 -07:00
|
|
|
|
|
|
|
nsRefPtr<LockedFile> mLockedFile;
|
2014-03-16 09:53:44 -07:00
|
|
|
|
|
|
|
bool mWrapAsDOMRequest;
|
2012-06-03 09:33:52 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
END_FILE_NAMESPACE
|
|
|
|
|
|
|
|
#endif // mozilla_dom_file_filerequest_h__
|