michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsClipboardPrivacyHandler_h__ michael@0: #define nsClipboardPrivacyHandler_h__ michael@0: michael@0: #include "nsIObserver.h" michael@0: #include "nsWeakReference.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: class nsITransferable; michael@0: michael@0: // nsClipboardPrivacyHandler makes sure that clipboard data copied during michael@0: // the private browsing mode does not leak after exiting this mode. michael@0: // In order to ensure this, callers should store an object of this class michael@0: // for their lifetime, and call PrepareDataForClipboard in their michael@0: // nsIClipboard::SetData implementation before starting to use the michael@0: // nsITransferable object in any way. michael@0: michael@0: class nsClipboardPrivacyHandler MOZ_FINAL : public nsIObserver, michael@0: public nsSupportsWeakReference michael@0: { michael@0: michael@0: public: michael@0: michael@0: // nsISupports michael@0: NS_DECL_ISUPPORTS michael@0: michael@0: // nsIObserver michael@0: NS_DECL_NSIOBSERVER michael@0: michael@0: nsresult Init(); michael@0: nsresult PrepareDataForClipboard(nsITransferable * aTransferable); michael@0: }; michael@0: michael@0: nsresult NS_NewClipboardPrivacyHandler(nsClipboardPrivacyHandler ** aHandler); michael@0: michael@0: #endif // nsClipboardPrivacyHandler_h__