content/base/src/nsContentAreaDragDrop.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef nsContentAreaDragDrop_h__
     7 #define nsContentAreaDragDrop_h__
    10 #include "nsCOMPtr.h"
    12 #include "nsIDOMEventListener.h"
    13 #include "nsITransferable.h"
    15 class nsIDOMNode;
    16 class nsPIDOMWindow;
    17 class nsIDOMDragEvent;
    18 class nsISelection;
    19 class nsITransferable;
    20 class nsIContent;
    21 class nsIURI;
    22 class nsIFile;
    23 class nsISimpleEnumerator;
    25 namespace mozilla {
    26 namespace dom {
    27 class DataTransfer;
    28 }
    29 }
    31 //
    32 // class nsContentAreaDragDrop, used to generate the dragdata
    33 //
    34 class nsContentAreaDragDrop
    35 {
    36 public:
    38   /**
    39    * Determine what data in the content area, if any, is being dragged.
    40    *
    41    * aWindow - the window containing the target node
    42    * aTarget - the mousedown event target that started the drag
    43    * aSelectionTargetNode - the node where the drag event should be fired
    44    * aIsAltKeyPressed - true if the Alt key is pressed. In some cases, this
    45    *                    will prevent the drag from occuring. For example,
    46    *                    holding down Alt over a link should select the text,
    47    *                    not drag the link.
    48    * aDataTransfer - the dataTransfer for the drag event.
    49    * aCanDrag - [out] set to true if the drag may proceed, false to stop the
    50    *            drag entirely
    51    * aSelection - [out] set to the selection being dragged, or null if no
    52    *                    selection is being dragged.
    53    * aDragNode - [out] the link, image or area being dragged, or null if the
    54    *             drag occurred on another element.
    55    */
    56   static nsresult GetDragData(nsPIDOMWindow* aWindow,
    57                               nsIContent* aTarget,
    58                               nsIContent* aSelectionTargetNode,
    59                               bool aIsAltKeyPressed,
    60                               mozilla::dom::DataTransfer* aDataTransfer,
    61                               bool* aCanDrag,
    62                               nsISelection** aSelection,
    63                               nsIContent** aDragNode);
    64 };
    66 // this is used to save images to disk lazily when the image data is asked for
    67 // during the drop instead of when it is added to the drag data transfer. This
    68 // ensures that the image data is only created when an image drop is allowed.
    69 class nsContentAreaDragDropDataProvider : public nsIFlavorDataProvider
    70 {
    71 public:
    72   NS_DECL_ISUPPORTS
    73   NS_DECL_NSIFLAVORDATAPROVIDER
    75   virtual ~nsContentAreaDragDropDataProvider() {}
    77   nsresult SaveURIToFile(nsAString& inSourceURIString,
    78                          nsIFile* inDestFile, bool isPrivate);
    79 };
    82 #endif /* nsContentAreaDragDrop_h__ */

mercurial