Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: third_party/WebKit/Source/core/clipboard/DataTransfer.h

Issue 2875013002: DataTransfer: Make |types| be a FrozenArray<DOMString>. (Closed)
Patch Set: Fix win_chromium_compile_dbg_ng Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.
11 * 11 *
12 * This library is distributed in the hope that it will be useful, 12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details. 15 * Library General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU Library General Public License 17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to 18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA. 20 * Boston, MA 02110-1301, USA.
21 * 21 *
22 */ 22 */
23 23
24 #ifndef DataTransfer_h 24 #ifndef DataTransfer_h
25 #define DataTransfer_h 25 #define DataTransfer_h
26 26
27 #include <memory> 27 #include <memory>
28 #include "core/CoreExport.h" 28 #include "core/CoreExport.h"
29 #include "core/clipboard/DataObject.h"
29 #include "core/clipboard/DataTransferAccessPolicy.h" 30 #include "core/clipboard/DataTransferAccessPolicy.h"
30 #include "core/loader/resource/ImageResourceContent.h" 31 #include "core/loader/resource/ImageResourceContent.h"
31 #include "core/page/DragActions.h" 32 #include "core/page/DragActions.h"
32 #include "platform/bindings/ScriptWrappable.h" 33 #include "platform/bindings/ScriptWrappable.h"
33 #include "platform/geometry/IntPoint.h" 34 #include "platform/geometry/IntPoint.h"
34 #include "platform/heap/Handle.h" 35 #include "platform/heap/Handle.h"
35 #include "platform/wtf/Forward.h" 36 #include "platform/wtf/Forward.h"
36 37
37 namespace blink { 38 namespace blink {
38 39
39 class DataObject;
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 47
48 // Used for drag and drop and copy/paste. 48 // Used for drag and drop and copy/paste.
49 // Drag and Drop: 49 // Drag and Drop:
50 // http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html 50 // http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html
51 // Clipboard API (copy/paste): 51 // Clipboard API (copy/paste):
52 // http://dev.w3.org/2006/webapi/clipops/clipops.html 52 // http://dev.w3.org/2006/webapi/clipops/clipops.html
53 class CORE_EXPORT DataTransfer final 53 class CORE_EXPORT DataTransfer final
54 : public GarbageCollectedFinalized<DataTransfer>, 54 : public GarbageCollectedFinalized<DataTransfer>,
55 public ScriptWrappable { 55 public ScriptWrappable,
56 public DataObject::Observer {
57 USING_GARBAGE_COLLECTED_MIXIN(DataTransfer);
56 DEFINE_WRAPPERTYPEINFO(); 58 DEFINE_WRAPPERTYPEINFO();
57 59
58 public: 60 public:
59 // Whether this transfer is serving a drag-drop, copy-paste, spellcheck, 61 // Whether this transfer is serving a drag-drop, copy-paste, spellcheck,
60 // auto-correct or similar request. 62 // auto-correct or similar request.
61 enum DataTransferType { 63 enum DataTransferType {
62 kCopyAndPaste, 64 kCopyAndPaste,
63 kDragAndDrop, 65 kDragAndDrop,
64 kInsertReplacementText, 66 kInsertReplacementText,
65 }; 67 };
(...skipping 14 matching lines...) Expand all
80 bool DropEffectIsUninitialized() const { 82 bool DropEffectIsUninitialized() const {
81 return drop_effect_ == "uninitialized"; 83 return drop_effect_ == "uninitialized";
82 } 84 }
83 String effectAllowed() const { return effect_allowed_; } 85 String effectAllowed() const { return effect_allowed_; }
84 void setEffectAllowed(const String&); 86 void setEffectAllowed(const String&);
85 87
86 void clearData(const String& type = String()); 88 void clearData(const String& type = String());
87 String getData(const String& type) const; 89 String getData(const String& type) const;
88 void setData(const String& type, const String& data); 90 void setData(const String& type, const String& data);
89 91
90 // extensions beyond IE's API 92 // Used by the bindings code to determine whether to call types() again.
91 Vector<String> types() const; 93 bool hasDataStoreItemListChanged() const;
94
95 Vector<String> types();
92 FileList* files() const; 96 FileList* files() const;
93 97
94 IntPoint DragLocation() const { return drag_loc_; } 98 IntPoint DragLocation() const { return drag_loc_; }
95 void setDragImage(Element*, int x, int y); 99 void setDragImage(Element*, int x, int y);
96 void ClearDragImage(); 100 void ClearDragImage();
97 void SetDragImageResource(ImageResourceContent*, const IntPoint&); 101 void SetDragImageResource(ImageResourceContent*, const IntPoint&);
98 void SetDragImageElement(Node*, const IntPoint&); 102 void SetDragImageElement(Node*, const IntPoint&);
99 103
100 std::unique_ptr<DragImage> CreateDragImage(IntPoint& drag_location, 104 std::unique_ptr<DragImage> CreateDragImage(IntPoint& drag_location,
101 LocalFrame*) const; 105 LocalFrame*) const;
(...skipping 29 matching lines...) Expand all
131 DECLARE_TRACE(); 135 DECLARE_TRACE();
132 136
133 private: 137 private:
134 DataTransfer(DataTransferType, DataTransferAccessPolicy, DataObject*); 138 DataTransfer(DataTransferType, DataTransferAccessPolicy, DataObject*);
135 139
136 void setDragImage(ImageResourceContent*, Node*, const IntPoint&); 140 void setDragImage(ImageResourceContent*, Node*, const IntPoint&);
137 141
138 bool HasFileOfType(const String&) const; 142 bool HasFileOfType(const String&) const;
139 bool HasStringOfType(const String&) const; 143 bool HasStringOfType(const String&) const;
140 144
145 // DataObject::Observer override.
146 void OnItemListChanged() override;
147
141 // Instead of using this member directly, prefer to use the can*() methods 148 // Instead of using this member directly, prefer to use the can*() methods
142 // above. 149 // above.
143 DataTransferAccessPolicy policy_; 150 DataTransferAccessPolicy policy_;
144 String drop_effect_; 151 String drop_effect_;
145 String effect_allowed_; 152 String effect_allowed_;
146 DataTransferType transfer_type_; 153 DataTransferType transfer_type_;
147 Member<DataObject> data_object_; 154 Member<DataObject> data_object_;
148 155
156 bool data_store_item_list_changed_;
157
149 IntPoint drag_loc_; 158 IntPoint drag_loc_;
150 Member<ImageResourceContent> drag_image_; 159 Member<ImageResourceContent> drag_image_;
151 Member<Node> drag_image_element_; 160 Member<Node> drag_image_element_;
152 }; 161 };
153 162
154 DragOperation ConvertDropZoneOperationToDragOperation( 163 DragOperation ConvertDropZoneOperationToDragOperation(
155 const String& drag_operation); 164 const String& drag_operation);
156 String ConvertDragOperationToDropZoneOperation(DragOperation); 165 String ConvertDragOperationToDropZoneOperation(DragOperation);
157 166
158 } // namespace blink 167 } // namespace blink
159 168
160 #endif // DataTransfer_h 169 #endif // DataTransfer_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/clipboard/DataObjectTest.cpp ('k') | third_party/WebKit/Source/core/clipboard/DataTransfer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698