| Index: ui/base/models/list_model.h
|
| diff --git a/ui/base/models/list_model.h b/ui/base/models/list_model.h
|
| index 9b4440d9a020d2db41d8bfb7adade37fe2ec173e..861d6ffd1e13d0a87d394aadd032d90777acdeec 100644
|
| --- a/ui/base/models/list_model.h
|
| +++ b/ui/base/models/list_model.h
|
| @@ -34,6 +34,19 @@ class ListModel {
|
| AddAt(item_count(), item);
|
| }
|
|
|
| + // Add a vector of items to the end of the model. This triggers one
|
| + // notification after adding all items. No notification is sent if |new_items|
|
| + // is empty.
|
| + void AddAll(ScopedVector<ItemType> new_items) {
|
| + if (new_items.empty())
|
| + return;
|
| +
|
| + const size_t count = item_count();
|
| + items_.insert(items_.end(), new_items.begin(), new_items.end());
|
| + new_items.weak_clear();
|
| + NotifyItemsAdded(count, items_.size() - count);
|
| + }
|
| +
|
| // Removes an item at given |index| from the model. Note the removed item
|
| // is NOT deleted and it's up to the caller to delete it.
|
| ItemType* RemoveAt(size_t index) {
|
|
|