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

Unified Diff: third_party/WebKit/Source/core/clipboard/DataTransfer.cpp

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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/clipboard/DataTransfer.cpp
diff --git a/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp b/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp
index 2738516710bd335ed2df5c41eca8df85e30a864e..4a9232872ad78139e64744c2c21025501f09045c 100644
--- a/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp
+++ b/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp
@@ -192,12 +192,19 @@ void DataTransfer::setData(const String& type, const String& data) {
data_object_->SetData(NormalizeType(type), data);
}
-// extensions beyond IE's API
-Vector<String> DataTransfer::types() const {
- Vector<String> types;
+bool DataTransfer::hasDataStoreItemListChanged() const {
+ return data_store_item_list_changed_ || !CanReadTypes();
+}
+
+void DataTransfer::OnItemListChanged() {
+ data_store_item_list_changed_ = true;
+}
+
+Vector<String> DataTransfer::types() {
if (!CanReadTypes())
- return types;
+ return Vector<String>();
+ data_store_item_list_changed_ = false;
return data_object_->Types();
}
@@ -429,7 +436,10 @@ DataTransfer::DataTransfer(DataTransferType type,
drop_effect_("uninitialized"),
effect_allowed_("uninitialized"),
transfer_type_(type),
- data_object_(data_object) {}
+ data_object_(data_object),
+ data_store_item_list_changed_(true) {
+ data_object_->AddObserver(this);
+}
void DataTransfer::setDragImage(ImageResourceContent* image,
Node* node,
@@ -461,7 +471,7 @@ bool DataTransfer::HasStringOfType(const String& type) const {
if (!CanReadTypes())
return false;
- return types().Contains(type);
+ return data_object_->Types().Contains(type);
}
DragOperation ConvertDropZoneOperationToDragOperation(
« no previous file with comments | « third_party/WebKit/Source/core/clipboard/DataTransfer.h ('k') | third_party/WebKit/Source/core/clipboard/DataTransfer.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698