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

Unified Diff: third_party/WebKit/Source/core/clipboard/DataObject.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 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..71f9889cd800319dfdfd99832958ae709f202422 100644
--- a/third_party/WebKit/Source/core/clipboard/DataObject.h
+++ b/third_party/WebKit/Source/core/clipboard/DataObject.h
@@ -55,6 +55,13 @@ class CORE_EXPORT DataObject : public GarbageCollectedFinalized<DataObject>,
USING_GARBAGE_COLLECTED_MIXIN(DataObject);
public:
+ struct CORE_EXPORT Observer : public GarbageCollectedMixin {
+ // Called whenever |item_list_| is modified. Note it can be called multiple
+ // times for a single mutation. For example, DataObject::SetData() calls
+ // both ClearData() and Add(), each of which can call this method.
+ virtual void OnItemListChanged() = 0;
+ };
+
static DataObject* CreateFromPasteboard(PasteMode);
static DataObject* CreateFromString(const String&);
static DataObject* Create();
@@ -111,6 +118,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 +133,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