| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) |
| 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) | 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) |
| 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 class DataTransferItemList; | 40 class DataTransferItemList; |
| 41 class DragImage; | 41 class DragImage; |
| 42 class Element; | 42 class Element; |
| 43 class FileList; | 43 class FileList; |
| 44 class FrameSelection; | 44 class FrameSelection; |
| 45 class LocalFrame; | 45 class LocalFrame; |
| 46 class Node; | 46 class Node; |
| 47 class Range; | 47 class Range; |
| 48 | 48 |
| 49 // Used for drag and drop and copy/paste. | 49 // Used for drag and drop and copy/paste. |
| 50 // Drag and Drop: http://www.whatwg.org/specs/web-apps/current-work/multipage/dn
d.html | 50 // Drag and Drop: |
| 51 // Clipboard API (copy/paste): http://dev.w3.org/2006/webapi/clipops/clipops.htm
l | 51 // http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html |
| 52 // Clipboard API (copy/paste): |
| 53 // http://dev.w3.org/2006/webapi/clipops/clipops.html |
| 52 class CORE_EXPORT DataTransfer final | 54 class CORE_EXPORT DataTransfer final |
| 53 : public GarbageCollectedFinalized<DataTransfer>, | 55 : public GarbageCollectedFinalized<DataTransfer>, |
| 54 public ScriptWrappable { | 56 public ScriptWrappable { |
| 55 DEFINE_WRAPPERTYPEINFO(); | 57 DEFINE_WRAPPERTYPEINFO(); |
| 56 | 58 |
| 57 public: | 59 public: |
| 58 // Whether this transfer is serving a drag-drop or copy-paste request. | 60 // Whether this transfer is serving a drag-drop or copy-paste request. |
| 59 enum DataTransferType { | 61 enum DataTransferType { |
| 60 CopyAndPaste, | 62 CopyAndPaste, |
| 61 DragAndDrop, | 63 DragAndDrop, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 std::unique_ptr<DragImage> createDragImage(IntPoint& dragLocation, | 98 std::unique_ptr<DragImage> createDragImage(IntPoint& dragLocation, |
| 97 LocalFrame*) const; | 99 LocalFrame*) const; |
| 98 void declareAndWriteDragImage(Element*, const KURL&, const String& title); | 100 void declareAndWriteDragImage(Element*, const KURL&, const String& title); |
| 99 void writeURL(Node*, const KURL&, const String&); | 101 void writeURL(Node*, const KURL&, const String&); |
| 100 void writeSelection(const FrameSelection&); | 102 void writeSelection(const FrameSelection&); |
| 101 | 103 |
| 102 void setAccessPolicy(DataTransferAccessPolicy); | 104 void setAccessPolicy(DataTransferAccessPolicy); |
| 103 bool canReadTypes() const; | 105 bool canReadTypes() const; |
| 104 bool canReadData() const; | 106 bool canReadData() const; |
| 105 bool canWriteData() const; | 107 bool canWriteData() const; |
| 106 // Note that the spec doesn't actually allow drag image modification outside t
he dragstart | 108 // Note that the spec doesn't actually allow drag image modification outside |
| 107 // event. This capability is maintained for backwards compatiblity for ports t
hat have | 109 // the dragstart event. This capability is maintained for backwards |
| 108 // supported this in the past. On many ports, attempting to set a drag image o
utside the | 110 // compatiblity for ports that have supported this in the past. On many ports, |
| 109 // dragstart operation is a no-op anyway. | 111 // attempting to set a drag image outside the dragstart operation is a no-op |
| 112 // anyway. |
| 110 bool canSetDragImage() const; | 113 bool canSetDragImage() const; |
| 111 | 114 |
| 112 DragOperation sourceOperation() const; | 115 DragOperation sourceOperation() const; |
| 113 DragOperation destinationOperation() const; | 116 DragOperation destinationOperation() const; |
| 114 void setSourceOperation(DragOperation); | 117 void setSourceOperation(DragOperation); |
| 115 void setDestinationOperation(DragOperation); | 118 void setDestinationOperation(DragOperation); |
| 116 | 119 |
| 117 bool hasDropZoneType(const String&); | 120 bool hasDropZoneType(const String&); |
| 118 | 121 |
| 119 DataTransferItemList* items(); | 122 DataTransferItemList* items(); |
| 120 | 123 |
| 121 DataObject* dataObject() const; | 124 DataObject* dataObject() const; |
| 122 | 125 |
| 123 DECLARE_TRACE(); | 126 DECLARE_TRACE(); |
| 124 | 127 |
| 125 private: | 128 private: |
| 126 DataTransfer(DataTransferType, DataTransferAccessPolicy, DataObject*); | 129 DataTransfer(DataTransferType, DataTransferAccessPolicy, DataObject*); |
| 127 | 130 |
| 128 void setDragImage(ImageResource*, Node*, const IntPoint&); | 131 void setDragImage(ImageResource*, Node*, const IntPoint&); |
| 129 | 132 |
| 130 bool hasFileOfType(const String&) const; | 133 bool hasFileOfType(const String&) const; |
| 131 bool hasStringOfType(const String&) const; | 134 bool hasStringOfType(const String&) const; |
| 132 | 135 |
| 133 // Instead of using this member directly, prefer to use the can*() methods abo
ve. | 136 // Instead of using this member directly, prefer to use the can*() methods |
| 137 // above. |
| 134 DataTransferAccessPolicy m_policy; | 138 DataTransferAccessPolicy m_policy; |
| 135 String m_dropEffect; | 139 String m_dropEffect; |
| 136 String m_effectAllowed; | 140 String m_effectAllowed; |
| 137 DataTransferType m_transferType; | 141 DataTransferType m_transferType; |
| 138 Member<DataObject> m_dataObject; | 142 Member<DataObject> m_dataObject; |
| 139 | 143 |
| 140 IntPoint m_dragLoc; | 144 IntPoint m_dragLoc; |
| 141 Member<ImageResource> m_dragImage; | 145 Member<ImageResource> m_dragImage; |
| 142 Member<Node> m_dragImageElement; | 146 Member<Node> m_dragImageElement; |
| 143 }; | 147 }; |
| 144 | 148 |
| 145 DragOperation convertDropZoneOperationToDragOperation( | 149 DragOperation convertDropZoneOperationToDragOperation( |
| 146 const String& dragOperation); | 150 const String& dragOperation); |
| 147 String convertDragOperationToDropZoneOperation(DragOperation); | 151 String convertDragOperationToDropZoneOperation(DragOperation); |
| 148 | 152 |
| 149 } // namespace blink | 153 } // namespace blink |
| 150 | 154 |
| 151 #endif // DataTransfer_h | 155 #endif // DataTransfer_h |
| OLD | NEW |