Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | #ifndef _nsNativeDragSource_h_ |
michael@0 | 6 | #define _nsNativeDragSource_h_ |
michael@0 | 7 | |
michael@0 | 8 | #include "nscore.h" |
michael@0 | 9 | #include "nsIDOMDataTransfer.h" |
michael@0 | 10 | #include "nsCOMPtr.h" |
michael@0 | 11 | #include <ole2.h> |
michael@0 | 12 | #include <oleidl.h> |
michael@0 | 13 | #include "mozilla/Attributes.h" |
michael@0 | 14 | |
michael@0 | 15 | //class nsIDragSource; |
michael@0 | 16 | |
michael@0 | 17 | /* |
michael@0 | 18 | * nsNativeDragSource implements the IDropSource interface and gets |
michael@0 | 19 | * most of its behavior from the associated adapter (m_dragDrop). |
michael@0 | 20 | */ |
michael@0 | 21 | class nsNativeDragSource MOZ_FINAL : public IDropSource |
michael@0 | 22 | { |
michael@0 | 23 | public: |
michael@0 | 24 | |
michael@0 | 25 | // construct an nsNativeDragSource referencing adapter |
michael@0 | 26 | // nsNativeDragSource(nsIDragSource * adapter); |
michael@0 | 27 | nsNativeDragSource(nsIDOMDataTransfer* aDataTransfer); |
michael@0 | 28 | ~nsNativeDragSource(); |
michael@0 | 29 | |
michael@0 | 30 | // IUnknown methods - see iunknown.h for documentation |
michael@0 | 31 | |
michael@0 | 32 | STDMETHODIMP QueryInterface(REFIID, void**); |
michael@0 | 33 | STDMETHODIMP_(ULONG) AddRef(); |
michael@0 | 34 | STDMETHODIMP_(ULONG) Release(); |
michael@0 | 35 | |
michael@0 | 36 | // IDropSource methods - see idropsrc.h for documentation |
michael@0 | 37 | |
michael@0 | 38 | // Return DRAGDROP_S_USEDEFAULTCURSORS if this object lets OLE provide |
michael@0 | 39 | // default cursors, otherwise return NOERROR. This method gets called in |
michael@0 | 40 | // response to changes that the target makes to dEffect (DragEnter, |
michael@0 | 41 | // DragOver). |
michael@0 | 42 | STDMETHODIMP GiveFeedback(DWORD dEffect); |
michael@0 | 43 | |
michael@0 | 44 | // This method gets called if there is any change in the mouse or key |
michael@0 | 45 | // state. Return DRAGDROP_S_CANCEL to stop the drag, DRAGDROP_S_DROP |
michael@0 | 46 | // to execute the drop, otherwise NOERROR. |
michael@0 | 47 | STDMETHODIMP QueryContinueDrag(BOOL fESC, DWORD grfKeyState); |
michael@0 | 48 | |
michael@0 | 49 | bool UserCancelled() { return mUserCancelled; } |
michael@0 | 50 | |
michael@0 | 51 | protected: |
michael@0 | 52 | // Reference count |
michael@0 | 53 | ULONG m_cRef; |
michael@0 | 54 | |
michael@0 | 55 | // Data object, hold information about cursor state |
michael@0 | 56 | nsCOMPtr<nsIDOMDataTransfer> mDataTransfer; |
michael@0 | 57 | |
michael@0 | 58 | // Custom drag cursor |
michael@0 | 59 | HCURSOR m_hCursor; |
michael@0 | 60 | |
michael@0 | 61 | // true if the user cancelled the drag by pressing escape |
michael@0 | 62 | bool mUserCancelled; |
michael@0 | 63 | }; |
michael@0 | 64 | |
michael@0 | 65 | #endif // _nsNativeDragSource_h_ |
michael@0 | 66 |