#ifndef DragController_h
#define DragController_h
#include "core/page/DragActions.h"
#include "platform/geometry/IntPoint.h"
#include "platform/weborigin/KURL.h"
#include "wtf/Forward.h"
namespace WebCore {
class Clipboard;
class Document;
class DragClient;
class DragData;
class DragImage;
struct DragSession;
class DragState;
class Element;
class LocalFrame;
class FrameSelection;
class HTMLInputElement;
class Image;
class IntRect;
class Node;
class Page;
class PlatformMouseEvent;
class Range;
class DragController {
WTF_MAKE_NONCOPYABLE(DragController); WTF_MAKE_FAST_ALLOCATED;
public:
~DragController();
static PassOwnPtr<DragController> create(Page*, DragClient*);
DragSession dragEntered(DragData*);
void dragExited(DragData*);
DragSession dragUpdated(DragData*);
bool performDrag(DragData*);
enum SelectionDragPolicy {
ImmediateSelectionDragResolution,
DelayedSelectionDragResolution,
};
Node* draggableNode(const LocalFrame*, Node*, const IntPoint&, SelectionDragPolicy, DragSourceAction&) const;
void dragEnded();
bool populateDragClipboard(LocalFrame* src, const DragState&, const IntPoint& dragOrigin);
bool startDrag(LocalFrame* src, const DragState&, const PlatformMouseEvent& dragEvent, const IntPoint& dragOrigin);
static const int DragIconRightInset;
static const int DragIconBottomInset;
private:
DragController(Page*, DragClient*);
bool dispatchTextInputEventFor(LocalFrame*, DragData*);
bool canProcessDrag(DragData*);
bool concludeEditDrag(DragData*);
DragSession dragEnteredOrUpdated(DragData*);
DragOperation operationForLoad(DragData*);
bool tryDocumentDrag(DragData*, DragDestinationAction, DragSession&);
bool tryDHTMLDrag(DragData*, DragOperation&);
DragOperation dragOperation(DragData*);
void cancelDrag();
bool dragIsMove(FrameSelection&, DragData*);
bool isCopyKeyDown(DragData*);
void mouseMovedIntoDocument(Document*);
void doSystemDrag(DragImage*, const IntPoint& dragLocation, const IntPoint& dragOrigin, Clipboard*, LocalFrame*, bool forLink);
void cleanupAfterSystemDrag();
Page* m_page;
DragClient* m_client;
RefPtr<Document> m_documentUnderMouse;
RefPtr<Document> m_dragInitiator;
RefPtr<HTMLInputElement> m_fileInputElementUnderMouse;
bool m_documentIsHandlingDrag;
DragDestinationAction m_dragDestinationAction;
bool m_didInitiateDrag;
};
}
#endif