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_indexeddb_idbfilehandle_h__ michael@0: #define mozilla_dom_indexeddb_idbfilehandle_h__ michael@0: michael@0: #include "IndexedDatabase.h" michael@0: michael@0: #include "mozilla/dom/file/FileHandle.h" michael@0: #include "mozilla/dom/indexedDB/FileInfo.h" michael@0: michael@0: BEGIN_INDEXEDDB_NAMESPACE michael@0: michael@0: class IDBDatabase; michael@0: michael@0: class IDBFileHandle : public file::FileHandle michael@0: { michael@0: typedef mozilla::dom::file::LockedFile LockedFile; michael@0: michael@0: public: michael@0: static already_AddRefed michael@0: Create(IDBDatabase* aDatabase, const nsAString& aName, michael@0: const nsAString& aType, already_AddRefed aFileInfo); michael@0: michael@0: michael@0: virtual int64_t michael@0: GetFileId() MOZ_OVERRIDE michael@0: { michael@0: return mFileInfo->Id(); michael@0: } michael@0: michael@0: virtual FileInfo* michael@0: GetFileInfo() MOZ_OVERRIDE michael@0: { michael@0: return mFileInfo; michael@0: } michael@0: michael@0: virtual already_AddRefed michael@0: CreateStream(nsIFile* aFile, bool aReadOnly) MOZ_OVERRIDE; michael@0: michael@0: virtual already_AddRefed michael@0: CreateFileObject(LockedFile* aLockedFile, uint32_t aFileSize) MOZ_OVERRIDE; michael@0: michael@0: // nsWrapperCache michael@0: virtual JSObject* michael@0: WrapObject(JSContext* aCx) MOZ_OVERRIDE; michael@0: michael@0: // WebIDL michael@0: IDBDatabase* michael@0: Database(); michael@0: michael@0: private: michael@0: IDBFileHandle(IDBDatabase* aOwner); michael@0: michael@0: ~IDBFileHandle() michael@0: { michael@0: } michael@0: michael@0: nsRefPtr mFileInfo; michael@0: }; michael@0: michael@0: END_INDEXEDDB_NAMESPACE michael@0: michael@0: #endif // mozilla_dom_indexeddb_idbfilehandle_h__