1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsIDOMStorageObserver_h__
7 #define nsIDOMStorageObserver_h__
9 #include "nsIObserver.h"
11 #include "nsWeakReference.h"
18 class DOMStorageObserver
;
20 // Implementers are DOMStorageManager and DOMStorageDBParent to forward to
22 class DOMStorageObserverSink
25 virtual ~DOMStorageObserverSink() {}
28 friend class DOMStorageObserver
;
29 virtual nsresult
Observe(const char* aTopic
, const nsACString
& aScopePrefix
) = 0;
32 // Statically (though layout statics) initialized observer receiving and processing
33 // chrome clearing notifications, such as cookie deletion etc.
34 class DOMStorageObserver
: public nsIObserver
35 , public nsSupportsWeakReference
41 static nsresult
Init();
42 static nsresult
Shutdown();
43 static DOMStorageObserver
* Self() { return sSelf
; }
45 void AddSink(DOMStorageObserverSink
* aObs
);
46 void RemoveSink(DOMStorageObserverSink
* aObs
);
47 void Notify(const char* aTopic
, const nsACString
& aData
= EmptyCString());
50 virtual ~DOMStorageObserver() {}
52 static DOMStorageObserver
* sSelf
;
55 nsTArray
<DOMStorageObserverSink
*> mSinks
;
56 nsCOMPtr
<nsITimer
> mDBThreadStartDelayTimer
;