1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/file/FileRequest.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,71 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim: set ts=2 et sw=2 tw=80: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.8 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef mozilla_dom_file_filerequest_h__ 1.11 +#define mozilla_dom_file_filerequest_h__ 1.12 + 1.13 +#include "mozilla/Attributes.h" 1.14 +#include "FileCommon.h" 1.15 + 1.16 +#include "DOMRequest.h" 1.17 + 1.18 +namespace mozilla { 1.19 +class EventChainPreVisitor; 1.20 +} // namespace mozilla 1.21 + 1.22 +BEGIN_FILE_NAMESPACE 1.23 + 1.24 +class FileHelper; 1.25 +class LockedFile; 1.26 + 1.27 +class FileRequest : public mozilla::dom::DOMRequest 1.28 +{ 1.29 +public: 1.30 + NS_DECL_ISUPPORTS_INHERITED 1.31 + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileRequest, DOMRequest) 1.32 + 1.33 + static already_AddRefed<FileRequest> 1.34 + Create(nsPIDOMWindow* aOwner, LockedFile* aLockedFile, 1.35 + bool aWrapAsDOMRequest); 1.36 + 1.37 + // nsIDOMEventTarget 1.38 + virtual nsresult 1.39 + PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE; 1.40 + 1.41 + void 1.42 + OnProgress(uint64_t aProgress, uint64_t aProgressMax) 1.43 + { 1.44 + FireProgressEvent(aProgress, aProgressMax); 1.45 + } 1.46 + 1.47 + nsresult 1.48 + NotifyHelperCompleted(FileHelper* aFileHelper); 1.49 + 1.50 + // nsWrapperCache 1.51 + virtual JSObject* 1.52 + WrapObject(JSContext* aCx) MOZ_OVERRIDE; 1.53 + 1.54 + // WebIDL 1.55 + LockedFile* 1.56 + GetLockedFile() const; 1.57 + 1.58 + IMPL_EVENT_HANDLER(progress) 1.59 + 1.60 +protected: 1.61 + FileRequest(nsPIDOMWindow* aWindow); 1.62 + ~FileRequest(); 1.63 + 1.64 + void 1.65 + FireProgressEvent(uint64_t aLoaded, uint64_t aTotal); 1.66 + 1.67 + nsRefPtr<LockedFile> mLockedFile; 1.68 + 1.69 + bool mWrapAsDOMRequest; 1.70 +}; 1.71 + 1.72 +END_FILE_NAMESPACE 1.73 + 1.74 +#endif // mozilla_dom_file_filerequest_h__