author Mike Hommey <>
Thu, 26 Mar 2015 12:07:17 +0900
changeset 258314 fc1e894eec2fbd34b745cd94f505080427d24705
parent 236672 2db29c0ae60b6eb0e196165631127d195fe2ef0b
child 270302 73917a03e7347846cbc9a9f5da14a4c50f04fcde
permissions -rw-r--r--
Bug 1147207 - Add a ComposedFinder class that acts like a FileFinder proxy over multiple FileFinders. r=gps, a=sledru

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */

#ifndef nsContentAreaDragDrop_h__
#define nsContentAreaDragDrop_h__

#include "nsCOMPtr.h"

#include "nsIDOMEventListener.h"
#include "nsITransferable.h"

class nsIDOMNode;
class nsPIDOMWindow;
class nsIDOMDragEvent;
class nsISelection;
class nsITransferable;
class nsIContent;
class nsIURI;
class nsIFile;
class nsISimpleEnumerator;

namespace mozilla {
namespace dom {
class DataTransfer;

// class nsContentAreaDragDrop, used to generate the dragdata
class nsContentAreaDragDrop

   * Determine what data in the content area, if any, is being dragged.
   * aWindow - the window containing the target node
   * aTarget - the mousedown event target that started the drag
   * aSelectionTargetNode - the node where the drag event should be fired
   * aIsAltKeyPressed - true if the Alt key is pressed. In some cases, this
   *                    will prevent the drag from occuring. For example,
   *                    holding down Alt over a link should select the text,
   *                    not drag the link.
   * aDataTransfer - the dataTransfer for the drag event.
   * aCanDrag - [out] set to true if the drag may proceed, false to stop the
   *            drag entirely
   * aSelection - [out] set to the selection being dragged, or null if no
   *                    selection is being dragged.
   * aDragNode - [out] the link, image or area being dragged, or null if the
   *             drag occurred on another element.
  static nsresult GetDragData(nsPIDOMWindow* aWindow,
                              nsIContent* aTarget,
                              nsIContent* aSelectionTargetNode,
                              bool aIsAltKeyPressed,
                              mozilla::dom::DataTransfer* aDataTransfer,
                              bool* aCanDrag,
                              nsISelection** aSelection,
                              nsIContent** aDragNode);

// this is used to save images to disk lazily when the image data is asked for
// during the drop instead of when it is added to the drag data transfer. This
// ensures that the image data is only created when an image drop is allowed.
class nsContentAreaDragDropDataProvider : public nsIFlavorDataProvider
  virtual ~nsContentAreaDragDropDataProvider() {}


  nsresult SaveURIToFile(nsAString& inSourceURIString,
                         nsIFile* inDestFile, bool isPrivate);

#endif /* nsContentAreaDragDrop_h__ */