Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / dom / indexedDB / IDBFileRequest.h
blobd7939d9b6e1a4476d2b2353972fa326ece7f9e11
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_indexeddb_idbfilerequest_h__
8 #define mozilla_dom_indexeddb_idbfilerequest_h__
10 #include "DOMRequest.h"
11 #include "js/TypeDecls.h"
12 #include "mozilla/Attributes.h"
13 #include "mozilla/dom/FileRequest.h"
14 #include "nsAutoPtr.h"
15 #include "nsCycleCollectionParticipant.h"
17 class nsPIDOMWindow;
19 namespace mozilla {
21 class EventChainPreVisitor;
23 namespace dom {
24 namespace indexedDB {
26 class IDBFileHandle;
28 class IDBFileRequest MOZ_FINAL : public DOMRequest,
29 public FileRequestBase
31 public:
32 NS_DECL_ISUPPORTS_INHERITED
34 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(IDBFileRequest, DOMRequest)
36 static already_AddRefed<IDBFileRequest>
37 Create(nsPIDOMWindow* aOwner, IDBFileHandle* aFileHandle,
38 bool aWrapAsDOMRequest);
40 // nsIDOMEventTarget
41 virtual nsresult
42 PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
44 // FileRequest
45 virtual void
46 OnProgress(uint64_t aProgress, uint64_t aProgressMax) MOZ_OVERRIDE;
48 virtual nsresult
49 NotifyHelperCompleted(FileHelper* aFileHelper) MOZ_OVERRIDE;
51 // nsWrapperCache
52 virtual JSObject*
53 WrapObject(JSContext* aCx) MOZ_OVERRIDE;
55 // WebIDL
56 IDBFileHandle*
57 GetFileHandle() const;
59 IDBFileHandle*
60 GetLockedFile() const
62 return GetFileHandle();
65 IMPL_EVENT_HANDLER(progress)
67 private:
68 IDBFileRequest(nsPIDOMWindow* aWindow);
69 ~IDBFileRequest();
71 void
72 FireProgressEvent(uint64_t aLoaded, uint64_t aTotal);
74 nsRefPtr<IDBFileHandle> mFileHandle;
76 bool mWrapAsDOMRequest;
79 } // namespace indexedDB
80 } // namespace dom
81 } // namespace mozilla
83 #endif // mozilla_dom_indexeddb_idbfilerequest_h__