1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/quota/nsIOfflineStorage.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,104 @@ 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 nsIOfflineStorage_h__ 1.11 +#define nsIOfflineStorage_h__ 1.12 + 1.13 +#include "nsIFileStorage.h" 1.14 + 1.15 +#include "mozilla/dom/quota/PersistenceType.h" 1.16 + 1.17 +#define NS_OFFLINESTORAGE_IID \ 1.18 + {0xec7e878d, 0xc8c1, 0x402e, \ 1.19 + { 0xa2, 0xc4, 0xf6, 0x82, 0x29, 0x4e, 0x3c, 0xb1 } } 1.20 + 1.21 +class nsPIDOMWindow; 1.22 + 1.23 +namespace mozilla { 1.24 +namespace dom { 1.25 +namespace quota { 1.26 +class Client; 1.27 +} 1.28 +} 1.29 +} 1.30 + 1.31 +class nsIOfflineStorage : public nsIFileStorage 1.32 +{ 1.33 +public: 1.34 + typedef mozilla::dom::quota::Client Client; 1.35 + typedef mozilla::dom::quota::PersistenceType PersistenceType; 1.36 + 1.37 + NS_DECLARE_STATIC_IID_ACCESSOR(NS_OFFLINESTORAGE_IID) 1.38 + 1.39 + NS_IMETHOD_(Client*) 1.40 + GetClient() = 0; 1.41 + 1.42 + NS_IMETHOD_(bool) 1.43 + IsOwned(nsPIDOMWindow* aOwner) = 0; 1.44 + 1.45 + NS_IMETHOD_(PersistenceType) 1.46 + Type() 1.47 + { 1.48 + return mPersistenceType; 1.49 + } 1.50 + 1.51 + NS_IMETHOD_(const nsACString&) 1.52 + Group() 1.53 + { 1.54 + return mGroup; 1.55 + } 1.56 + 1.57 + NS_IMETHOD_(const nsACString&) 1.58 + Origin() = 0; 1.59 + 1.60 + // Implementation of this method should close the storage (without aborting 1.61 + // running operations nor discarding pending operations). 1.62 + NS_IMETHOD_(nsresult) 1.63 + Close() = 0; 1.64 + 1.65 + // Whether or not the storage has had Close called on it. 1.66 + NS_IMETHOD_(bool) 1.67 + IsClosed() = 0; 1.68 + 1.69 + // Implementation of this method should close the storage, all running 1.70 + // operations should be aborted and pending operations should be discarded. 1.71 + NS_IMETHOD_(void) 1.72 + Invalidate() = 0; 1.73 + 1.74 +protected: 1.75 + nsIOfflineStorage() 1.76 + : mPersistenceType(mozilla::dom::quota::PERSISTENCE_TYPE_INVALID) 1.77 + { } 1.78 + 1.79 + virtual ~nsIOfflineStorage() 1.80 + { } 1.81 + 1.82 + PersistenceType mPersistenceType; 1.83 + nsCString mGroup; 1.84 +}; 1.85 + 1.86 +NS_DEFINE_STATIC_IID_ACCESSOR(nsIOfflineStorage, NS_OFFLINESTORAGE_IID) 1.87 + 1.88 +#define NS_DECL_NSIOFFLINESTORAGE \ 1.89 + NS_IMETHOD_(Client*) \ 1.90 + GetClient() MOZ_OVERRIDE; \ 1.91 + \ 1.92 + NS_IMETHOD_(bool) \ 1.93 + IsOwned(nsPIDOMWindow* aOwner) MOZ_OVERRIDE; \ 1.94 + \ 1.95 + NS_IMETHOD_(const nsACString&) \ 1.96 + Origin() MOZ_OVERRIDE; \ 1.97 + \ 1.98 + NS_IMETHOD_(nsresult) \ 1.99 + Close() MOZ_OVERRIDE; \ 1.100 + \ 1.101 + NS_IMETHOD_(bool) \ 1.102 + IsClosed() MOZ_OVERRIDE; \ 1.103 + \ 1.104 + NS_IMETHOD_(void) \ 1.105 + Invalidate() MOZ_OVERRIDE; 1.106 + 1.107 +#endif // nsIOfflineStorage_h__