michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_file_filerequest_h__ michael@0: #define mozilla_dom_file_filerequest_h__ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "FileCommon.h" michael@0: michael@0: #include "DOMRequest.h" michael@0: michael@0: namespace mozilla { michael@0: class EventChainPreVisitor; michael@0: } // namespace mozilla michael@0: michael@0: BEGIN_FILE_NAMESPACE michael@0: michael@0: class FileHelper; michael@0: class LockedFile; michael@0: michael@0: class FileRequest : public mozilla::dom::DOMRequest michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileRequest, DOMRequest) michael@0: michael@0: static already_AddRefed michael@0: Create(nsPIDOMWindow* aOwner, LockedFile* aLockedFile, michael@0: bool aWrapAsDOMRequest); michael@0: michael@0: // nsIDOMEventTarget michael@0: virtual nsresult michael@0: PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE; michael@0: michael@0: void michael@0: OnProgress(uint64_t aProgress, uint64_t aProgressMax) michael@0: { michael@0: FireProgressEvent(aProgress, aProgressMax); michael@0: } michael@0: michael@0: nsresult michael@0: NotifyHelperCompleted(FileHelper* aFileHelper); michael@0: michael@0: // nsWrapperCache michael@0: virtual JSObject* michael@0: WrapObject(JSContext* aCx) MOZ_OVERRIDE; michael@0: michael@0: // WebIDL michael@0: LockedFile* michael@0: GetLockedFile() const; michael@0: michael@0: IMPL_EVENT_HANDLER(progress) michael@0: michael@0: protected: michael@0: FileRequest(nsPIDOMWindow* aWindow); michael@0: ~FileRequest(); michael@0: michael@0: void michael@0: FireProgressEvent(uint64_t aLoaded, uint64_t aTotal); michael@0: michael@0: nsRefPtr mLockedFile; michael@0: michael@0: bool mWrapAsDOMRequest; michael@0: }; michael@0: michael@0: END_FILE_NAMESPACE michael@0: michael@0: #endif // mozilla_dom_file_filerequest_h__