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: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 nsAutoCopyListener_h_
7 #define nsAutoCopyListener_h_
9 #include "nsISelectionListener.h"
10 #include "nsISelectionPrivate.h"
11 #include "mozilla/Attributes.h"
13 class nsAutoCopyListener MOZ_FINAL : public nsISelectionListener
14 {
15 public:
16 NS_DECL_ISUPPORTS
17 NS_DECL_NSISELECTIONLISTENER
19 void Listen(nsISelectionPrivate *aSelection)
20 {
21 NS_ASSERTION(aSelection, "Null selection passed to Listen()");
22 aSelection->AddSelectionListener(this);
23 }
25 static nsAutoCopyListener* GetInstance()
26 {
27 if (!sInstance) {
28 sInstance = new nsAutoCopyListener();
30 NS_ADDREF(sInstance);
31 }
33 return sInstance;
34 }
36 static void Shutdown()
37 {
38 NS_IF_RELEASE(sInstance);
39 }
41 private:
42 static nsAutoCopyListener* sInstance;
43 };
45 #endif