Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 #include "core/page/DragActions.h" | 31 #include "core/page/DragActions.h" |
| 32 #include "platform/geometry/IntPoint.h" | 32 #include "platform/geometry/IntPoint.h" |
| 33 #include "platform/heap/Handle.h" | 33 #include "platform/heap/Handle.h" |
| 34 #include "platform/weborigin/KURL.h" | 34 #include "platform/weborigin/KURL.h" |
| 35 #include "wtf/Forward.h" | 35 #include "wtf/Forward.h" |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 class DataTransfer; | 39 class DataTransfer; |
| 40 class Document; | 40 class Document; |
| 41 class DragClient; | |
| 42 class DragData; | 41 class DragData; |
| 43 class DragImage; | 42 class DragImage; |
| 44 struct DragSession; | 43 struct DragSession; |
| 45 class DragState; | 44 class DragState; |
| 46 class LocalFrame; | 45 class LocalFrame; |
| 47 class FrameSelection; | 46 class FrameSelection; |
| 48 class HTMLInputElement; | 47 class HTMLInputElement; |
| 49 class Node; | 48 class Node; |
| 50 class Page; | 49 class Page; |
| 51 class PlatformMouseEvent; | 50 class PlatformMouseEvent; |
| 52 | 51 |
| 53 class CORE_EXPORT DragController final : public GarbageCollectedFinalized<DragCo ntroller> { | 52 class CORE_EXPORT DragController final : public GarbageCollectedFinalized<DragCo ntroller> { |
| 54 WTF_MAKE_NONCOPYABLE(DragController); | 53 WTF_MAKE_NONCOPYABLE(DragController); |
| 55 public: | 54 public: |
| 56 ~DragController(); | 55 ~DragController(); |
| 57 | 56 |
| 58 static DragController* create(Page*, DragClient*); | 57 static DragController* create(Page*); |
| 59 | 58 |
| 60 DragSession dragEntered(DragData*); | 59 DragSession dragEntered(DragData*); |
| 61 void dragExited(DragData*); | 60 void dragExited(DragData*); |
| 62 DragSession dragUpdated(DragData*); | 61 DragSession dragUpdated(DragData*); |
| 63 bool performDrag(DragData*); | 62 bool performDrag(DragData*); |
| 64 | 63 |
| 65 enum SelectionDragPolicy { | 64 enum SelectionDragPolicy { |
| 66 ImmediateSelectionDragResolution, | 65 ImmediateSelectionDragResolution, |
| 67 DelayedSelectionDragResolution, | 66 DelayedSelectionDragResolution, |
| 68 }; | 67 }; |
| 69 Node* draggableNode(const LocalFrame*, Node*, const IntPoint&, SelectionDrag Policy, DragSourceAction&) const; | 68 Node* draggableNode(const LocalFrame*, Node*, const IntPoint&, SelectionDrag Policy, DragSourceAction&) const; |
| 70 void dragEnded(); | 69 void dragEnded(); |
| 71 | 70 |
| 72 bool populateDragDataTransfer(LocalFrame* src, const DragState&, const IntPo int& dragOrigin); | 71 bool populateDragDataTransfer(LocalFrame* src, const DragState&, const IntPo int& dragOrigin); |
| 73 bool startDrag(LocalFrame* src, const DragState&, const PlatformMouseEvent& dragEvent, const IntPoint& dragOrigin); | 72 bool startDrag(LocalFrame* src, const DragState&, const PlatformMouseEvent& dragEvent, const IntPoint& dragOrigin); |
| 74 | 73 |
| 75 DECLARE_TRACE(); | 74 DECLARE_TRACE(); |
| 76 | 75 |
| 77 static const int DragIconRightInset; | 76 static const int DragIconRightInset; |
| 78 static const int DragIconBottomInset; | 77 static const int DragIconBottomInset; |
| 79 | 78 |
| 80 private: | 79 private: |
| 81 DragController(Page*, DragClient*); | 80 DragController(Page*); |
|
dcheng
2016/04/15 07:20:34
Nit: explicit
| |
| 82 | 81 |
| 83 DispatchEventResult dispatchTextInputEventFor(LocalFrame*, DragData*); | 82 DispatchEventResult dispatchTextInputEventFor(LocalFrame*, DragData*); |
| 84 bool canProcessDrag(DragData*); | 83 bool canProcessDrag(DragData*); |
| 85 bool concludeEditDrag(DragData*); | 84 bool concludeEditDrag(DragData*); |
| 86 DragSession dragEnteredOrUpdated(DragData*); | 85 DragSession dragEnteredOrUpdated(DragData*); |
| 87 DragOperation operationForLoad(DragData*); | 86 DragOperation operationForLoad(DragData*); |
| 88 bool tryDocumentDrag(DragData*, DragDestinationAction, DragSession&); | 87 bool tryDocumentDrag(DragData*, DragDestinationAction, DragSession&); |
| 89 bool tryDHTMLDrag(DragData*, DragOperation&); | 88 bool tryDHTMLDrag(DragData*, DragOperation&); |
| 90 DragOperation dragOperation(DragData*); | 89 DragOperation dragOperation(DragData*); |
| 91 void cancelDrag(); | 90 void cancelDrag(); |
| 92 bool dragIsMove(FrameSelection&, DragData*); | 91 bool dragIsMove(FrameSelection&, DragData*); |
| 93 bool isCopyKeyDown(DragData*); | 92 bool isCopyKeyDown(DragData*); |
| 94 | 93 |
| 95 void mouseMovedIntoDocument(Document*); | 94 void mouseMovedIntoDocument(Document*); |
| 96 | 95 |
| 97 void doSystemDrag(DragImage*, const IntPoint& dragLocation, const IntPoint& dragOrigin, DataTransfer*, LocalFrame*, bool forLink); | 96 void doSystemDrag(DragImage*, const IntPoint& dragLocation, const IntPoint& dragOrigin, DataTransfer*, LocalFrame*, bool forLink); |
| 98 void cleanupAfterSystemDrag(); | |
| 99 | 97 |
| 100 Member<Page> m_page; | 98 Member<Page> m_page; |
| 101 DragClient* m_client; | |
| 102 | 99 |
| 103 Member<Document> m_documentUnderMouse; // The document the mouse was last dr agged over. | 100 Member<Document> m_documentUnderMouse; // The document the mouse was last dr agged over. |
| 104 Member<Document> m_dragInitiator; // The Document (if any) that initiated th e drag. | 101 Member<Document> m_dragInitiator; // The Document (if any) that initiated th e drag. |
| 105 Member<HTMLInputElement> m_fileInputElementUnderMouse; | 102 Member<HTMLInputElement> m_fileInputElementUnderMouse; |
| 106 bool m_documentIsHandlingDrag; | 103 bool m_documentIsHandlingDrag; |
| 107 | 104 |
| 108 DragDestinationAction m_dragDestinationAction; | 105 DragDestinationAction m_dragDestinationAction; |
| 109 bool m_didInitiateDrag; | 106 bool m_didInitiateDrag; |
| 110 }; | 107 }; |
| 111 | 108 |
| 112 } // namespace blink | 109 } // namespace blink |
| 113 | 110 |
| 114 #endif // DragController_h | 111 #endif // DragController_h |
| OLD | NEW |