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

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

Issue 2875013002: DataTransfer: Make |types| be a FrozenArray<DOMString>. (Closed)
Patch Set: Use an observer to be notified of changes 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..1cee0fbc7652f4441c288f15429a48c2ce0478cd 100644
--- a/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp
+++ b/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp
@@ -192,12 +192,20 @@ 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 {
+bool DataTransfer::hasDataStoreItemListChanged() const {
+ return data_store_item_list_changed_ || !CanReadTypes();
+}
+
+void DataTransfer::OnItemListChanged() {
+ data_store_item_list_changed_ = true;
+}
+
+Vector<String> DataTransfer::types() {
Vector<String> types;
if (!CanReadTypes())
return types;
jsbell 2017/05/15 20:49:28 Not new in this CL, but how about `return Vector<S
Raphael Kubo da Costa (rakuco) 2017/05/16 08:51:51 Done.
+ data_store_item_list_changed_ = false;
return data_object_->Types();
}
@@ -429,7 +437,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 +472,7 @@ bool DataTransfer::HasStringOfType(const String& type) const {
if (!CanReadTypes())
return false;
- return types().Contains(type);
+ return data_object_->Types().Contains(type);
}
DragOperation ConvertDropZoneOperationToDragOperation(

Powered by Google App Engine
This is Rietveld 408576698