1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=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
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_SessionStorage_h
8 #define mozilla_dom_SessionStorage_h
17 class SessionStorageCache
;
18 class SessionStorageManager
;
20 class SessionStorage final
: public Storage
{
22 NS_DECL_ISUPPORTS_INHERITED
23 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SessionStorage
, Storage
)
25 SessionStorage(nsPIDOMWindowInner
* aWindow
, nsIPrincipal
* aPrincipal
,
26 SessionStorageCache
* aCache
, SessionStorageManager
* aManager
,
27 const nsAString
& aDocumentURI
, bool aIsPrivate
);
29 StorageType
Type() const override
{ return eSessionStorage
; }
31 SessionStorageManager
* Manager() const { return mManager
; }
33 SessionStorageCache
* Cache() const { return mCache
; }
35 int64_t GetOriginQuotaUsage() const override
;
37 bool IsForkOf(const Storage
* aStorage
) const override
;
40 uint32_t GetLength(nsIPrincipal
& aSubjectPrincipal
,
41 ErrorResult
& aRv
) override
;
43 void Key(uint32_t aIndex
, nsAString
& aResult
, nsIPrincipal
& aSubjectPrincipal
,
44 ErrorResult
& aRv
) override
;
46 void GetItem(const nsAString
& aKey
, nsAString
& aResult
,
47 nsIPrincipal
& aSubjectPrincipal
, ErrorResult
& aRv
) override
;
49 void GetSupportedNames(nsTArray
<nsString
>& aKeys
) override
;
51 void SetItem(const nsAString
& aKey
, const nsAString
& aValue
,
52 nsIPrincipal
& aSubjectPrincipal
, ErrorResult
& aRv
) override
;
54 void RemoveItem(const nsAString
& aKey
, nsIPrincipal
& aSubjectPrincipal
,
55 ErrorResult
& aRv
) override
;
57 void Clear(nsIPrincipal
& aSubjectPrincipal
, ErrorResult
& aRv
) override
;
62 void BroadcastChangeNotification(const nsAString
& aKey
,
63 const nsAString
& aOldValue
,
64 const nsAString
& aNewValue
);
66 RefPtr
<SessionStorageCache
> mCache
;
67 RefPtr
<SessionStorageManager
> mManager
;
69 nsString mDocumentURI
;
74 } // namespace mozilla
76 #endif // mozilla_dom_SessionStorage_h