| Index: third_party/WebKit/Source/core/clipboard/DataObject.cpp
|
| diff --git a/third_party/WebKit/Source/core/clipboard/DataObject.cpp b/third_party/WebKit/Source/core/clipboard/DataObject.cpp
|
| index 480e775cbb1b1fceb3fb0315b2f471605f8905c7..799c43096751a5c5713d7462949bde2f78526c6f 100644
|
| --- a/third_party/WebKit/Source/core/clipboard/DataObject.cpp
|
| +++ b/third_party/WebKit/Source/core/clipboard/DataObject.cpp
|
| @@ -90,10 +90,14 @@ void DataObject::DeleteItem(unsigned long index) {
|
| if (index >= length())
|
| return;
|
| item_list_.erase(index);
|
| + NotifyItemListChanged();
|
| }
|
|
|
| void DataObject::ClearAll() {
|
| + if (item_list_.IsEmpty())
|
| + return;
|
| item_list_.clear();
|
| + NotifyItemListChanged();
|
| }
|
|
|
| DataObjectItem* DataObject::Add(const String& data, const String& type) {
|
| @@ -128,6 +132,7 @@ void DataObject::ClearData(const String& type) {
|
| item_list_[i]->GetType() == type) {
|
| // Per the spec, type must be unique among all items of kind 'string'.
|
| item_list_.erase(i);
|
| + NotifyItemListChanged();
|
| return;
|
| }
|
| }
|
| @@ -256,16 +261,29 @@ bool DataObject::InternalAddStringItem(DataObjectItem* item) {
|
| }
|
|
|
| item_list_.push_back(item);
|
| + NotifyItemListChanged();
|
| return true;
|
| }
|
|
|
| void DataObject::InternalAddFileItem(DataObjectItem* item) {
|
| DCHECK_EQ(item->Kind(), DataObjectItem::kFileKind);
|
| item_list_.push_back(item);
|
| + NotifyItemListChanged();
|
| +}
|
| +
|
| +void DataObject::AddObserver(Observer* observer) {
|
| + DCHECK(!observers_.Contains(observer));
|
| + observers_.insert(observer);
|
| +}
|
| +
|
| +void DataObject::NotifyItemListChanged() const {
|
| + for (const auto& observer : observers_)
|
| + observer->OnItemListChanged();
|
| }
|
|
|
| DEFINE_TRACE(DataObject) {
|
| visitor->Trace(item_list_);
|
| + visitor->Trace(observers_);
|
| Supplementable<DataObject>::Trace(visitor);
|
| }
|
|
|
|
|