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 nsIOfflineStorage_h__ michael@0: #define nsIOfflineStorage_h__ michael@0: michael@0: #include "nsIFileStorage.h" michael@0: michael@0: #include "mozilla/dom/quota/PersistenceType.h" michael@0: michael@0: #define NS_OFFLINESTORAGE_IID \ michael@0: {0xec7e878d, 0xc8c1, 0x402e, \ michael@0: { 0xa2, 0xc4, 0xf6, 0x82, 0x29, 0x4e, 0x3c, 0xb1 } } michael@0: michael@0: class nsPIDOMWindow; michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: namespace quota { michael@0: class Client; michael@0: } michael@0: } michael@0: } michael@0: michael@0: class nsIOfflineStorage : public nsIFileStorage michael@0: { michael@0: public: michael@0: typedef mozilla::dom::quota::Client Client; michael@0: typedef mozilla::dom::quota::PersistenceType PersistenceType; michael@0: michael@0: NS_DECLARE_STATIC_IID_ACCESSOR(NS_OFFLINESTORAGE_IID) michael@0: michael@0: NS_IMETHOD_(Client*) michael@0: GetClient() = 0; michael@0: michael@0: NS_IMETHOD_(bool) michael@0: IsOwned(nsPIDOMWindow* aOwner) = 0; michael@0: michael@0: NS_IMETHOD_(PersistenceType) michael@0: Type() michael@0: { michael@0: return mPersistenceType; michael@0: } michael@0: michael@0: NS_IMETHOD_(const nsACString&) michael@0: Group() michael@0: { michael@0: return mGroup; michael@0: } michael@0: michael@0: NS_IMETHOD_(const nsACString&) michael@0: Origin() = 0; michael@0: michael@0: // Implementation of this method should close the storage (without aborting michael@0: // running operations nor discarding pending operations). michael@0: NS_IMETHOD_(nsresult) michael@0: Close() = 0; michael@0: michael@0: // Whether or not the storage has had Close called on it. michael@0: NS_IMETHOD_(bool) michael@0: IsClosed() = 0; michael@0: michael@0: // Implementation of this method should close the storage, all running michael@0: // operations should be aborted and pending operations should be discarded. michael@0: NS_IMETHOD_(void) michael@0: Invalidate() = 0; michael@0: michael@0: protected: michael@0: nsIOfflineStorage() michael@0: : mPersistenceType(mozilla::dom::quota::PERSISTENCE_TYPE_INVALID) michael@0: { } michael@0: michael@0: virtual ~nsIOfflineStorage() michael@0: { } michael@0: michael@0: PersistenceType mPersistenceType; michael@0: nsCString mGroup; michael@0: }; michael@0: michael@0: NS_DEFINE_STATIC_IID_ACCESSOR(nsIOfflineStorage, NS_OFFLINESTORAGE_IID) michael@0: michael@0: #define NS_DECL_NSIOFFLINESTORAGE \ michael@0: NS_IMETHOD_(Client*) \ michael@0: GetClient() MOZ_OVERRIDE; \ michael@0: \ michael@0: NS_IMETHOD_(bool) \ michael@0: IsOwned(nsPIDOMWindow* aOwner) MOZ_OVERRIDE; \ michael@0: \ michael@0: NS_IMETHOD_(const nsACString&) \ michael@0: Origin() MOZ_OVERRIDE; \ michael@0: \ michael@0: NS_IMETHOD_(nsresult) \ michael@0: Close() MOZ_OVERRIDE; \ michael@0: \ michael@0: NS_IMETHOD_(bool) \ michael@0: IsClosed() MOZ_OVERRIDE; \ michael@0: \ michael@0: NS_IMETHOD_(void) \ michael@0: Invalidate() MOZ_OVERRIDE; michael@0: michael@0: #endif // nsIOfflineStorage_h__