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/. */
|
|
|
|
|
2014-05-07 07:32:12 -07:00
|
|
|
#ifndef mozilla_dom_FileRequest_h
|
|
|
|
#define mozilla_dom_FileRequest_h
|
2012-06-03 09:33:52 -07:00
|
|
|
|
2014-05-07 07:32:12 -07:00
|
|
|
#include "DOMRequest.h"
|
|
|
|
#include "js/TypeDecls.h"
|
2013-06-05 09:15:48 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-05-07 07:32:12 -07:00
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2012-06-03 09:33:52 -07:00
|
|
|
|
2014-05-07 07:32:12 -07:00
|
|
|
class nsPIDOMWindow;
|
2012-06-03 09:33:52 -07:00
|
|
|
|
2014-03-17 21:48:19 -07:00
|
|
|
namespace mozilla {
|
2014-05-07 07:32:12 -07:00
|
|
|
|
2014-03-17 21:48:19 -07:00
|
|
|
class EventChainPreVisitor;
|
|
|
|
|
2014-05-07 07:32:12 -07:00
|
|
|
namespace dom {
|
2012-06-03 09:33:52 -07:00
|
|
|
|
|
|
|
class FileHelper;
|
|
|
|
class LockedFile;
|
|
|
|
|
2014-05-07 07:32:12 -07:00
|
|
|
class FileRequest : public DOMRequest
|
2012-06-03 09:33:52 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2014-05-07 07:32:12 -07:00
|
|
|
|
2012-06-03 09:33:52 -07:00
|
|
|
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*
|
2014-04-08 15:27:18 -07:00
|
|
|
WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
2014-03-16 09:53:44 -07:00
|
|
|
|
|
|
|
// WebIDL
|
2014-03-24 08:10:27 -07:00
|
|
|
LockedFile*
|
2014-03-16 09:53:44 -07:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2014-05-07 07:32:12 -07:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2012-06-03 09:33:52 -07:00
|
|
|
|
2014-05-07 07:32:12 -07:00
|
|
|
#endif // mozilla_dom_FileRequest_h
|