2012-06-03 16:33:52 +00: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 14:32:12 +00:00
|
|
|
#ifndef mozilla_dom_FileRequest_h
|
|
|
|
#define mozilla_dom_FileRequest_h
|
2012-06-03 16:33:52 +00:00
|
|
|
|
2014-05-07 14:32:12 +00:00
|
|
|
#include "DOMRequest.h"
|
|
|
|
#include "js/TypeDecls.h"
|
2013-06-05 16:15:48 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-05-07 14:32:12 +00:00
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2012-06-03 16:33:52 +00:00
|
|
|
|
2014-05-07 14:32:12 +00:00
|
|
|
class nsPIDOMWindow;
|
2012-06-03 16:33:52 +00:00
|
|
|
|
2014-03-18 04:48:19 +00:00
|
|
|
namespace mozilla {
|
2014-05-07 14:32:12 +00:00
|
|
|
|
2014-03-18 04:48:19 +00:00
|
|
|
class EventChainPreVisitor;
|
|
|
|
|
2014-05-07 14:32:12 +00:00
|
|
|
namespace dom {
|
2012-06-03 16:33:52 +00:00
|
|
|
|
2014-06-12 03:35:29 +00:00
|
|
|
class FileHandle;
|
2012-06-03 16:33:52 +00:00
|
|
|
class FileHelper;
|
|
|
|
|
2014-05-07 14:32:12 +00:00
|
|
|
class FileRequest : public DOMRequest
|
2012-06-03 16:33:52 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2014-05-07 14:32:12 +00:00
|
|
|
|
2012-06-03 16:33:52 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileRequest, DOMRequest)
|
|
|
|
|
|
|
|
static already_AddRefed<FileRequest>
|
2014-06-12 03:35:29 +00:00
|
|
|
Create(nsPIDOMWindow* aOwner, FileHandle* aFileHandle,
|
2014-03-16 16:53:44 +00:00
|
|
|
bool aWrapAsDOMRequest);
|
2012-06-03 16:33:52 +00:00
|
|
|
|
|
|
|
// nsIDOMEventTarget
|
|
|
|
virtual nsresult
|
2014-03-18 04:48:19 +00:00
|
|
|
PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
2012-06-03 16:33:52 +00:00
|
|
|
|
|
|
|
void
|
2012-08-22 15:56:38 +00:00
|
|
|
OnProgress(uint64_t aProgress, uint64_t aProgressMax)
|
2012-06-03 16:33:52 +00:00
|
|
|
{
|
|
|
|
FireProgressEvent(aProgress, aProgressMax);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
NotifyHelperCompleted(FileHelper* aFileHelper);
|
|
|
|
|
2014-03-16 16:53:44 +00:00
|
|
|
// nsWrapperCache
|
|
|
|
virtual JSObject*
|
2014-04-08 22:27:18 +00:00
|
|
|
WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
2014-03-16 16:53:44 +00:00
|
|
|
|
|
|
|
// WebIDL
|
2014-06-12 03:35:29 +00:00
|
|
|
FileHandle*
|
|
|
|
GetFileHandle() const;
|
|
|
|
|
|
|
|
FileHandle*
|
|
|
|
GetLockedFile() const
|
|
|
|
{
|
|
|
|
return GetFileHandle();
|
|
|
|
}
|
2014-03-16 16:53:44 +00:00
|
|
|
|
|
|
|
IMPL_EVENT_HANDLER(progress)
|
|
|
|
|
2013-03-17 08:51:36 +00:00
|
|
|
protected:
|
2014-01-07 02:53:23 +00:00
|
|
|
FileRequest(nsPIDOMWindow* aWindow);
|
2012-06-03 16:33:52 +00:00
|
|
|
~FileRequest();
|
|
|
|
|
|
|
|
void
|
2012-08-22 15:56:38 +00:00
|
|
|
FireProgressEvent(uint64_t aLoaded, uint64_t aTotal);
|
2012-06-03 16:33:52 +00:00
|
|
|
|
2014-06-12 03:35:29 +00:00
|
|
|
nsRefPtr<FileHandle> mFileHandle;
|
2014-03-16 16:53:44 +00:00
|
|
|
|
|
|
|
bool mWrapAsDOMRequest;
|
2012-06-03 16:33:52 +00:00
|
|
|
};
|
|
|
|
|
2014-05-07 14:32:12 +00:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2012-06-03 16:33:52 +00:00
|
|
|
|
2014-05-07 14:32:12 +00:00
|
|
|
#endif // mozilla_dom_FileRequest_h
|