| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 class Element; | 45 class Element; |
| 46 class ExceptionState; | 46 class ExceptionState; |
| 47 class FileList; | 47 class FileList; |
| 48 class LocalFrame; | 48 class LocalFrame; |
| 49 class Node; | 49 class Node; |
| 50 class Range; | 50 class Range; |
| 51 | 51 |
| 52 // Used for drag and drop and copy/paste. | 52 // Used for drag and drop and copy/paste. |
| 53 // Drag and Drop: http://www.whatwg.org/specs/web-apps/current-work/multipage/dn
d.html | 53 // Drag and Drop: http://www.whatwg.org/specs/web-apps/current-work/multipage/dn
d.html |
| 54 // Clipboard API (copy/paste): http://dev.w3.org/2006/webapi/clipops/clipops.htm
l | 54 // Clipboard API (copy/paste): http://dev.w3.org/2006/webapi/clipops/clipops.htm
l |
| 55 class CORE_EXPORT DataTransfer : public RefCountedWillBeGarbageCollectedFinalize
d<DataTransfer>, public ScriptWrappable { | 55 class CORE_EXPORT DataTransfer : public GarbageCollectedFinalized<DataTransfer>,
public ScriptWrappable { |
| 56 DEFINE_WRAPPERTYPEINFO(); | 56 DEFINE_WRAPPERTYPEINFO(); |
| 57 public: | 57 public: |
| 58 // Whether this transfer is serving a drag-drop or copy-paste request. | 58 // Whether this transfer is serving a drag-drop or copy-paste request. |
| 59 enum DataTransferType { | 59 enum DataTransferType { |
| 60 CopyAndPaste, | 60 CopyAndPaste, |
| 61 DragAndDrop, | 61 DragAndDrop, |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 static PassRefPtrWillBeRawPtr<DataTransfer> create(DataTransferType, DataTra
nsferAccessPolicy, PassRefPtrWillBeRawPtr<DataObject>); | 64 static DataTransfer* create(DataTransferType, DataTransferAccessPolicy, Data
Object*); |
| 65 ~DataTransfer(); | 65 ~DataTransfer(); |
| 66 | 66 |
| 67 bool isForCopyAndPaste() const { return m_transferType == CopyAndPaste; } | 67 bool isForCopyAndPaste() const { return m_transferType == CopyAndPaste; } |
| 68 bool isForDragAndDrop() const { return m_transferType == DragAndDrop; } | 68 bool isForDragAndDrop() const { return m_transferType == DragAndDrop; } |
| 69 | 69 |
| 70 String dropEffect() const { return dropEffectIsUninitialized() ? "none" : m_
dropEffect; } | 70 String dropEffect() const { return dropEffectIsUninitialized() ? "none" : m_
dropEffect; } |
| 71 void setDropEffect(const String&); | 71 void setDropEffect(const String&); |
| 72 bool dropEffectIsUninitialized() const { return m_dropEffect == "uninitializ
ed"; } | 72 bool dropEffectIsUninitialized() const { return m_dropEffect == "uninitializ
ed"; } |
| 73 String effectAllowed() const { return m_effectAllowed; } | 73 String effectAllowed() const { return m_effectAllowed; } |
| 74 void setEffectAllowed(const String&); | 74 void setEffectAllowed(const String&); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 105 // dragstart operation is a no-op anyway. | 105 // dragstart operation is a no-op anyway. |
| 106 bool canSetDragImage() const; | 106 bool canSetDragImage() const; |
| 107 | 107 |
| 108 DragOperation sourceOperation() const; | 108 DragOperation sourceOperation() const; |
| 109 DragOperation destinationOperation() const; | 109 DragOperation destinationOperation() const; |
| 110 void setSourceOperation(DragOperation); | 110 void setSourceOperation(DragOperation); |
| 111 void setDestinationOperation(DragOperation); | 111 void setDestinationOperation(DragOperation); |
| 112 | 112 |
| 113 bool hasDropZoneType(const String&); | 113 bool hasDropZoneType(const String&); |
| 114 | 114 |
| 115 PassRefPtrWillBeRawPtr<DataTransferItemList> items(); | 115 DataTransferItemList* items(); |
| 116 | 116 |
| 117 PassRefPtrWillBeRawPtr<DataObject> dataObject() const; | 117 DataObject* dataObject() const; |
| 118 | 118 |
| 119 DECLARE_TRACE(); | 119 DECLARE_TRACE(); |
| 120 | 120 |
| 121 private: | 121 private: |
| 122 DataTransfer(DataTransferType, DataTransferAccessPolicy, PassRefPtrWillBeRaw
Ptr<DataObject>); | 122 DataTransfer(DataTransferType, DataTransferAccessPolicy, DataObject*); |
| 123 | 123 |
| 124 void setDragImage(ImageResource*, Node*, const IntPoint&); | 124 void setDragImage(ImageResource*, Node*, const IntPoint&); |
| 125 | 125 |
| 126 bool hasFileOfType(const String&) const; | 126 bool hasFileOfType(const String&) const; |
| 127 bool hasStringOfType(const String&) const; | 127 bool hasStringOfType(const String&) const; |
| 128 | 128 |
| 129 // Instead of using this member directly, prefer to use the can*() methods a
bove. | 129 // Instead of using this member directly, prefer to use the can*() methods a
bove. |
| 130 DataTransferAccessPolicy m_policy; | 130 DataTransferAccessPolicy m_policy; |
| 131 String m_dropEffect; | 131 String m_dropEffect; |
| 132 String m_effectAllowed; | 132 String m_effectAllowed; |
| 133 DataTransferType m_transferType; | 133 DataTransferType m_transferType; |
| 134 RefPtrWillBeMember<DataObject> m_dataObject; | 134 Member<DataObject> m_dataObject; |
| 135 | 135 |
| 136 IntPoint m_dragLoc; | 136 IntPoint m_dragLoc; |
| 137 ResourcePtr<ImageResource> m_dragImage; | 137 ResourcePtr<ImageResource> m_dragImage; |
| 138 RefPtrWillBeMember<Node> m_dragImageElement; | 138 RefPtrWillBeMember<Node> m_dragImageElement; |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 DragOperation convertDropZoneOperationToDragOperation(const String& dragOperatio
n); | 141 DragOperation convertDropZoneOperationToDragOperation(const String& dragOperatio
n); |
| 142 String convertDragOperationToDropZoneOperation(DragOperation); | 142 String convertDragOperationToDropZoneOperation(DragOperation); |
| 143 | 143 |
| 144 } // namespace blink | 144 } // namespace blink |
| 145 | 145 |
| 146 #endif // DataTransfer_h | 146 #endif // DataTransfer_h |
| OLD | NEW |