Bumping manifests a=b2g-bump
[gecko.git] / layout / generic / nsAutoCopyListener.h
blob02ea2c0b2938de31c7afed8929726858abd926e5
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
15 public:
16 NS_DECL_ISUPPORTS
17 NS_DECL_NSISELECTIONLISTENER
19 void Listen(nsISelectionPrivate *aSelection)
21 NS_ASSERTION(aSelection, "Null selection passed to Listen()");
22 aSelection->AddSelectionListener(this);
25 static nsAutoCopyListener* GetInstance()
27 if (!sInstance) {
28 sInstance = new nsAutoCopyListener();
30 NS_ADDREF(sInstance);
33 return sInstance;
36 static void Shutdown()
38 NS_IF_RELEASE(sInstance);
41 private:
42 ~nsAutoCopyListener() {}
44 static nsAutoCopyListener* sInstance;
47 #endif