1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/xpwidgets/nsClipboardPrivacyHandler.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,41 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsClipboardPrivacyHandler_h__ 1.10 +#define nsClipboardPrivacyHandler_h__ 1.11 + 1.12 +#include "nsIObserver.h" 1.13 +#include "nsWeakReference.h" 1.14 +#include "nsCOMPtr.h" 1.15 +#include "mozilla/Attributes.h" 1.16 + 1.17 +class nsITransferable; 1.18 + 1.19 +// nsClipboardPrivacyHandler makes sure that clipboard data copied during 1.20 +// the private browsing mode does not leak after exiting this mode. 1.21 +// In order to ensure this, callers should store an object of this class 1.22 +// for their lifetime, and call PrepareDataForClipboard in their 1.23 +// nsIClipboard::SetData implementation before starting to use the 1.24 +// nsITransferable object in any way. 1.25 + 1.26 +class nsClipboardPrivacyHandler MOZ_FINAL : public nsIObserver, 1.27 + public nsSupportsWeakReference 1.28 +{ 1.29 + 1.30 +public: 1.31 + 1.32 + // nsISupports 1.33 + NS_DECL_ISUPPORTS 1.34 + 1.35 + // nsIObserver 1.36 + NS_DECL_NSIOBSERVER 1.37 + 1.38 + nsresult Init(); 1.39 + nsresult PrepareDataForClipboard(nsITransferable * aTransferable); 1.40 +}; 1.41 + 1.42 +nsresult NS_NewClipboardPrivacyHandler(nsClipboardPrivacyHandler ** aHandler); 1.43 + 1.44 +#endif // nsClipboardPrivacyHandler_h__