| Index: chrome/browser/resources/md_bookmarks/dnd_manager.js
|
| diff --git a/chrome/browser/resources/md_bookmarks/dnd_manager.js b/chrome/browser/resources/md_bookmarks/dnd_manager.js
|
| index cbe61a67b9ff56bffde54f49609a41729a953586..34b1a953be68000e5ad6531e2855ecfcc97b49f1 100644
|
| --- a/chrome/browser/resources/md_bookmarks/dnd_manager.js
|
| +++ b/chrome/browser/resources/md_bookmarks/dnd_manager.js
|
| @@ -464,12 +464,22 @@ cr.define('bookmarks', function() {
|
| // Complete the drag by moving all dragged items to the drop
|
| // destination.
|
| var dropInfo = this.calculateDropInfo_(this.dropDestination_);
|
| - this.dragInfo_.dragData.elements.forEach((item) => {
|
| - chrome.bookmarks.move(item.id, {
|
| - parentId: dropInfo.parentId,
|
| - index: dropInfo.index == -1 ? undefined : dropInfo.index
|
| + var shouldHighlight = this.shouldHighlight_(this.dropDestination_);
|
| +
|
| + var movePromises = this.dragInfo_.dragData.elements.map((item) => {
|
| + return new Promise((resolve) => {
|
| + chrome.bookmarks.move(item.id, {
|
| + parentId: dropInfo.parentId,
|
| + index: dropInfo.index == -1 ? undefined : dropInfo.index
|
| + }, resolve);
|
| });
|
| });
|
| +
|
| + if (shouldHighlight) {
|
| + bookmarks.ApiListener.trackUpdatedItems();
|
| + Promise.all(movePromises)
|
| + .then(() => bookmarks.ApiListener.highlightUpdatedItems());
|
| + }
|
| }
|
|
|
| this.clearDragData_();
|
| @@ -521,10 +531,16 @@ cr.define('bookmarks', function() {
|
| e.preventDefault();
|
|
|
| var dropInfo = this.calculateDropInfo_(this.dropDestination_);
|
| - if (dropInfo.index != -1)
|
| - chrome.bookmarkManagerPrivate.drop(dropInfo.parentId, dropInfo.index);
|
| - else
|
| - chrome.bookmarkManagerPrivate.drop(dropInfo.parentId);
|
| + var index = dropInfo.index != -1 ? dropInfo.index : undefined;
|
| + var shouldHighlight = this.shouldHighlight_(this.dropDestination_);
|
| +
|
| + if (shouldHighlight)
|
| + bookmarks.ApiListener.trackUpdatedItems();
|
| +
|
| + chrome.bookmarkManagerPrivate.drop(
|
| + dropInfo.parentId, index,
|
| + shouldHighlight ? bookmarks.ApiListener.highlightUpdatedItems :
|
| + undefined);
|
| }
|
|
|
| this.clearDragData_();
|
| @@ -862,6 +878,15 @@ cr.define('bookmarks', function() {
|
| return !this.dragInfo_.isDraggingChildBookmark(overElement.itemId);
|
| },
|
|
|
| + /**
|
| + * @param {DropDestination} dropDestination
|
| + * @private
|
| + */
|
| + shouldHighlight_: function(dropDestination) {
|
| + return isBookmarkItem(dropDestination.element) ||
|
| + isBookmarkList(dropDestination.element);
|
| + },
|
| +
|
| /** @param {bookmarks.TimerProxy} timerProxy */
|
| setTimerProxyForTesting: function(timerProxy) {
|
| this.timerProxy_ = timerProxy;
|
|
|