dom/quota/nsIOfflineStorage.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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 nsIOfflineStorage_h__
     8 #define nsIOfflineStorage_h__
    10 #include "nsIFileStorage.h"
    12 #include "mozilla/dom/quota/PersistenceType.h"
    14 #define NS_OFFLINESTORAGE_IID \
    15   {0xec7e878d, 0xc8c1, 0x402e, \
    16   { 0xa2, 0xc4, 0xf6, 0x82, 0x29, 0x4e, 0x3c, 0xb1 } }
    18 class nsPIDOMWindow;
    20 namespace mozilla {
    21 namespace dom {
    22 namespace quota {
    23 class Client;
    24 }
    25 }
    26 }
    28 class nsIOfflineStorage : public nsIFileStorage
    29 {
    30 public:
    31   typedef mozilla::dom::quota::Client Client;
    32   typedef mozilla::dom::quota::PersistenceType PersistenceType;
    34   NS_DECLARE_STATIC_IID_ACCESSOR(NS_OFFLINESTORAGE_IID)
    36   NS_IMETHOD_(Client*)
    37   GetClient() = 0;
    39   NS_IMETHOD_(bool)
    40   IsOwned(nsPIDOMWindow* aOwner) = 0;
    42   NS_IMETHOD_(PersistenceType)
    43   Type()
    44   {
    45     return mPersistenceType;
    46   }
    48   NS_IMETHOD_(const nsACString&)
    49   Group()
    50   {
    51     return mGroup;
    52   }
    54   NS_IMETHOD_(const nsACString&)
    55   Origin() = 0;
    57   // Implementation of this method should close the storage (without aborting
    58   // running operations nor discarding pending operations).
    59   NS_IMETHOD_(nsresult)
    60   Close() = 0;
    62   // Whether or not the storage has had Close called on it.
    63   NS_IMETHOD_(bool)
    64   IsClosed() = 0;
    66   // Implementation of this method should close the storage, all running
    67   // operations should be aborted and pending operations should be discarded.
    68   NS_IMETHOD_(void)
    69   Invalidate() = 0;
    71 protected:
    72   nsIOfflineStorage()
    73   : mPersistenceType(mozilla::dom::quota::PERSISTENCE_TYPE_INVALID)
    74   { }
    76   virtual ~nsIOfflineStorage()
    77   { }
    79   PersistenceType mPersistenceType;
    80   nsCString mGroup;
    81 };
    83 NS_DEFINE_STATIC_IID_ACCESSOR(nsIOfflineStorage, NS_OFFLINESTORAGE_IID)
    85 #define NS_DECL_NSIOFFLINESTORAGE                                              \
    86   NS_IMETHOD_(Client*)                                                         \
    87   GetClient() MOZ_OVERRIDE;                                                    \
    88                                                                                \
    89   NS_IMETHOD_(bool)                                                            \
    90   IsOwned(nsPIDOMWindow* aOwner) MOZ_OVERRIDE;                                 \
    91                                                                                \
    92   NS_IMETHOD_(const nsACString&)                                               \
    93   Origin() MOZ_OVERRIDE;                                                       \
    94                                                                                \
    95   NS_IMETHOD_(nsresult)                                                        \
    96   Close() MOZ_OVERRIDE;                                                        \
    97                                                                                \
    98   NS_IMETHOD_(bool)                                                            \
    99   IsClosed() MOZ_OVERRIDE;                                                     \
   100                                                                                \
   101   NS_IMETHOD_(void)                                                            \
   102   Invalidate() MOZ_OVERRIDE;
   104 #endif // nsIOfflineStorage_h__

mercurial