Bumping manifests a=b2g-bump
[gecko.git] / dom / base / nsContentAreaDragDrop.h
blob091502e575ce8232df1a524011faafd5f1408f96
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;
32 // class nsContentAreaDragDrop, used to generate the dragdata
34 class nsContentAreaDragDrop
36 public:
38 /**
39 * Determine what data in the content area, if any, is being dragged.
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.
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);
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
71 virtual ~nsContentAreaDragDropDataProvider() {}
73 public:
74 NS_DECL_ISUPPORTS
75 NS_DECL_NSIFLAVORDATAPROVIDER
77 nsresult SaveURIToFile(nsAString& inSourceURIString,
78 nsIFile* inDestFile, bool isPrivate);
82 #endif /* nsContentAreaDragDrop_h__ */