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 10 matching lines...) Loading... |
21 * | 21 * |
22 */ | 22 */ |
23 | 23 |
24 #ifndef Clipboard_h | 24 #ifndef Clipboard_h |
25 #define Clipboard_h | 25 #define Clipboard_h |
26 | 26 |
27 #include "bindings/v8/ScriptWrappable.h" | 27 #include "bindings/v8/ScriptWrappable.h" |
28 #include "core/clipboard/ClipboardAccessPolicy.h" | 28 #include "core/clipboard/ClipboardAccessPolicy.h" |
29 #include "core/fetch/ResourcePtr.h" | 29 #include "core/fetch/ResourcePtr.h" |
30 #include "core/page/DragActions.h" | 30 #include "core/page/DragActions.h" |
| 31 #include "heap/Handle.h" |
31 #include "platform/geometry/IntPoint.h" | 32 #include "platform/geometry/IntPoint.h" |
32 #include "wtf/Forward.h" | 33 #include "wtf/Forward.h" |
33 #include "wtf/RefCounted.h" | 34 #include "wtf/RefCounted.h" |
34 #include "wtf/RefPtr.h" | 35 #include "wtf/RefPtr.h" |
35 #include "wtf/Vector.h" | 36 #include "wtf/Vector.h" |
36 | 37 |
37 namespace WebCore { | 38 namespace WebCore { |
38 | 39 |
39 class DataObject; | 40 class DataObject; |
40 class DataTransferItemList; | 41 class DataTransferItemList; |
41 class DragImage; | 42 class DragImage; |
42 class Element; | 43 class Element; |
43 class ExceptionState; | 44 class ExceptionState; |
44 class FileList; | 45 class FileList; |
45 class Frame; | 46 class Frame; |
46 class ImageResource; | 47 class ImageResource; |
47 class Node; | 48 class Node; |
48 class Range; | 49 class Range; |
49 | 50 |
50 // State available during IE's events for drag and drop and copy/paste | 51 // State available during IE's events for drag and drop and copy/paste |
51 class Clipboard : public RefCounted<Clipboard>, public ScriptWrappable { | 52 class Clipboard : public RefCountedWillBeGarbageCollectedFinalized<Clipboard>, p
ublic ScriptWrappable { |
| 53 DECLARE_GC_INFO; |
52 public: | 54 public: |
53 // Whether this clipboard is serving a drag-drop or copy-paste request. | 55 // Whether this clipboard is serving a drag-drop or copy-paste request. |
54 enum ClipboardType { | 56 enum ClipboardType { |
55 CopyAndPaste, | 57 CopyAndPaste, |
56 DragAndDrop, | 58 DragAndDrop, |
57 }; | 59 }; |
58 | 60 |
59 static PassRefPtr<Clipboard> create(ClipboardType, ClipboardAccessPolicy, Pa
ssRefPtr<DataObject>); | 61 static PassRefPtrWillBeRawPtr<Clipboard> create(ClipboardType, ClipboardAcce
ssPolicy, PassRefPtrWillBeRawPtr<DataObject>); |
60 ~Clipboard(); | 62 ~Clipboard(); |
61 | 63 |
62 bool isForCopyAndPaste() const { return m_clipboardType == CopyAndPaste; } | 64 bool isForCopyAndPaste() const { return m_clipboardType == CopyAndPaste; } |
63 bool isForDragAndDrop() const { return m_clipboardType == DragAndDrop; } | 65 bool isForDragAndDrop() const { return m_clipboardType == DragAndDrop; } |
64 | 66 |
65 String dropEffect() const { return dropEffectIsUninitialized() ? "none" : m_
dropEffect; } | 67 String dropEffect() const { return dropEffectIsUninitialized() ? "none" : m_
dropEffect; } |
66 void setDropEffect(const String&); | 68 void setDropEffect(const String&); |
67 bool dropEffectIsUninitialized() const { return m_dropEffect == "uninitializ
ed"; } | 69 bool dropEffectIsUninitialized() const { return m_dropEffect == "uninitializ
ed"; } |
68 String effectAllowed() const { return m_effectAllowed; } | 70 String effectAllowed() const { return m_effectAllowed; } |
69 void setEffectAllowed(const String&); | 71 void setEffectAllowed(const String&); |
(...skipping 31 matching lines...) Loading... |
101 // dragstart operation is a no-op anyway. | 103 // dragstart operation is a no-op anyway. |
102 bool canSetDragImage() const; | 104 bool canSetDragImage() const; |
103 | 105 |
104 DragOperation sourceOperation() const; | 106 DragOperation sourceOperation() const; |
105 DragOperation destinationOperation() const; | 107 DragOperation destinationOperation() const; |
106 void setSourceOperation(DragOperation); | 108 void setSourceOperation(DragOperation); |
107 void setDestinationOperation(DragOperation); | 109 void setDestinationOperation(DragOperation); |
108 | 110 |
109 bool hasDropZoneType(const String&); | 111 bool hasDropZoneType(const String&); |
110 | 112 |
111 PassRefPtr<DataTransferItemList> items(); | 113 PassRefPtrWillBeRawPtr<DataTransferItemList> items(); |
112 | 114 |
113 PassRefPtr<DataObject> dataObject() const; | 115 PassRefPtrWillBeRawPtr<DataObject> dataObject() const; |
| 116 |
| 117 void trace(Visitor*); |
114 | 118 |
115 private: | 119 private: |
116 Clipboard(ClipboardType, ClipboardAccessPolicy, PassRefPtr<DataObject>); | 120 Clipboard(ClipboardType, ClipboardAccessPolicy, PassRefPtrWillBeRawPtr<DataO
bject>); |
117 | 121 |
118 void setDragImage(ImageResource*, Node*, const IntPoint&); | 122 void setDragImage(ImageResource*, Node*, const IntPoint&); |
119 | 123 |
120 bool hasFileOfType(const String&) const; | 124 bool hasFileOfType(const String&) const; |
121 bool hasStringOfType(const String&) const; | 125 bool hasStringOfType(const String&) const; |
122 | 126 |
123 // Instead of using this member directly, prefer to use the can*() methods a
bove. | 127 // Instead of using this member directly, prefer to use the can*() methods a
bove. |
124 ClipboardAccessPolicy m_policy; | 128 ClipboardAccessPolicy m_policy; |
125 String m_dropEffect; | 129 String m_dropEffect; |
126 String m_effectAllowed; | 130 String m_effectAllowed; |
127 ClipboardType m_clipboardType; | 131 ClipboardType m_clipboardType; |
128 RefPtr<DataObject> m_dataObject; | 132 RefPtrWillBeMember<DataObject> m_dataObject; |
129 | 133 |
130 IntPoint m_dragLoc; | 134 IntPoint m_dragLoc; |
131 ResourcePtr<ImageResource> m_dragImage; | 135 ResourcePtr<ImageResource> m_dragImage; |
132 RefPtr<Node> m_dragImageElement; | 136 RefPtr<Node> m_dragImageElement; |
133 }; | 137 }; |
134 | 138 |
135 DragOperation convertDropZoneOperationToDragOperation(const String& dragOperatio
n); | 139 DragOperation convertDropZoneOperationToDragOperation(const String& dragOperatio
n); |
136 String convertDragOperationToDropZoneOperation(DragOperation); | 140 String convertDragOperationToDropZoneOperation(DragOperation); |
137 | 141 |
138 } // namespace WebCore | 142 } // namespace WebCore |
139 | 143 |
140 #endif // Clipboard_h | 144 #endif // Clipboard_h |
OLD | NEW |