widget/windows/nsNativeDragSource.h

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

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.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     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/. */
     5 #ifndef _nsNativeDragSource_h_
     6 #define _nsNativeDragSource_h_
     8 #include "nscore.h"
     9 #include "nsIDOMDataTransfer.h"
    10 #include "nsCOMPtr.h"
    11 #include <ole2.h>
    12 #include <oleidl.h>
    13 #include "mozilla/Attributes.h"
    15 //class nsIDragSource;
    17 /*
    18  * nsNativeDragSource implements the IDropSource interface and gets
    19  * most of its behavior from the associated adapter (m_dragDrop).
    20  */
    21 class nsNativeDragSource MOZ_FINAL : public IDropSource
    22 {
    23 public:
    25   // construct an nsNativeDragSource referencing adapter
    26   // nsNativeDragSource(nsIDragSource * adapter);
    27   nsNativeDragSource(nsIDOMDataTransfer* aDataTransfer);
    28   ~nsNativeDragSource();
    30   // IUnknown methods - see iunknown.h for documentation
    32   STDMETHODIMP QueryInterface(REFIID, void**);
    33   STDMETHODIMP_(ULONG) AddRef();
    34   STDMETHODIMP_(ULONG) Release();
    36   // IDropSource methods - see idropsrc.h for documentation
    38   // Return DRAGDROP_S_USEDEFAULTCURSORS if this object lets OLE provide
    39   // default cursors, otherwise return NOERROR. This method gets called in
    40   // response to changes that the target makes to dEffect (DragEnter,
    41   // DragOver).
    42   STDMETHODIMP GiveFeedback(DWORD dEffect);
    44   // This method gets called if there is any change in the mouse or key
    45   // state.  Return DRAGDROP_S_CANCEL to stop the drag, DRAGDROP_S_DROP
    46   // to execute the drop, otherwise NOERROR.
    47   STDMETHODIMP QueryContinueDrag(BOOL fESC, DWORD grfKeyState);
    49   bool UserCancelled() { return mUserCancelled; }
    51 protected:
    52   // Reference count
    53   ULONG m_cRef;
    55   // Data object, hold information about cursor state
    56   nsCOMPtr<nsIDOMDataTransfer> mDataTransfer;
    58   // Custom drag cursor
    59   HCURSOR m_hCursor;
    61   // true if the user cancelled the drag by pressing escape
    62   bool mUserCancelled;
    63 };
    65 #endif // _nsNativeDragSource_h_

mercurial