Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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"
10 #include "nsITimer.h"
11 #include "nsWeakReference.h"
12 #include "nsTArray.h"
13 #include "nsString.h"
15 namespace mozilla {
16 namespace dom {
18 class DOMStorageObserver;
20 // Implementers are DOMStorageManager and DOMStorageDBParent to forward to
21 // child processes.
22 class DOMStorageObserverSink
23 {
24 public:
25 virtual ~DOMStorageObserverSink() {}
27 private:
28 friend class DOMStorageObserver;
29 virtual nsresult Observe(const char* aTopic, const nsACString& aScopePrefix) = 0;
30 };
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
36 {
37 public:
38 NS_DECL_ISUPPORTS
39 NS_DECL_NSIOBSERVER
41 virtual ~DOMStorageObserver() {}
43 static nsresult Init();
44 static nsresult Shutdown();
45 static DOMStorageObserver* Self() { return sSelf; }
47 void AddSink(DOMStorageObserverSink* aObs);
48 void RemoveSink(DOMStorageObserverSink* aObs);
49 void Notify(const char* aTopic, const nsACString& aData = EmptyCString());
51 private:
52 static DOMStorageObserver* sSelf;
54 // Weak references
55 nsTArray<DOMStorageObserverSink*> mSinks;
56 nsCOMPtr<nsITimer> mDBThreadStartDelayTimer;
57 };
59 } // ::dom
60 } // ::mozilla
62 #endif