Chromium Code Reviews| 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_; |