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

Unified Diff: third_party/WebKit/Source/core/clipboard/DataObject.h

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/DataObject.h
diff --git a/third_party/WebKit/Source/core/clipboard/DataObject.h b/third_party/WebKit/Source/core/clipboard/DataObject.h
index 2d699c5a2fe10eb9493ec9d01052e094866e7ed7..ac06f46000e599d2d3c06df2907884cc1318d4c8 100644
--- a/third_party/WebKit/Source/core/clipboard/DataObject.h
+++ b/third_party/WebKit/Source/core/clipboard/DataObject.h
@@ -55,6 +55,10 @@ class CORE_EXPORT DataObject : public GarbageCollectedFinalized<DataObject>,
USING_GARBAGE_COLLECTED_MIXIN(DataObject);
public:
+ struct Observer : public GarbageCollectedMixin {
+ virtual void OnItemListChanged() {}
jsbell 2017/05/15 20:49:28 Make this pure virtual? i.e. replace `{}` with `=
Raphael Kubo da Costa (rakuco) 2017/05/16 08:51:51 Done.
+ };
+
static DataObject* CreateFromPasteboard(PasteMode);
static DataObject* CreateFromString(const String&);
static DataObject* Create();
@@ -111,6 +115,10 @@ class CORE_EXPORT DataObject : public GarbageCollectedFinalized<DataObject>,
int GetModifiers() const { return modifiers_; }
void SetModifiers(int modifiers) { modifiers_ = modifiers; }
+ // Adds an observer (and retains a reference to it) that is notified
+ // whenever the underlying item_list_ changes.
+ void AddObserver(Observer*);
+
DECLARE_TRACE();
WebDragData ToWebDragData();
@@ -122,7 +130,10 @@ class CORE_EXPORT DataObject : public GarbageCollectedFinalized<DataObject>,
bool InternalAddStringItem(DataObjectItem*);
void InternalAddFileItem(DataObjectItem*);
+ void NotifyItemListChanged() const;
+
HeapVector<Member<DataObjectItem>> item_list_;
+ HeapHashSet<Member<Observer>> observers_;
// State of Shift/Ctrl/Alt/Meta keys and Left/Right/Middle mouse buttons
int modifiers_;

Powered by Google App Engine
This is Rietveld 408576698