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

Side by Side Diff: chrome/browser/resources/md_bookmarks/dnd_manager.js

Issue 2946203002: MD Bookmarks: Batch updates to the UI when processing deletes and moves (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('bookmarks', function() { 5 cr.define('bookmarks', function() {
6 /** 6 /**
7 * @param {BookmarkElement} element 7 * @param {BookmarkElement} element
8 * @return {boolean} 8 * @return {boolean}
9 */ 9 */
10 function isBookmarkItem(element) { 10 function isBookmarkItem(element) {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 329
330 /** 330 /**
331 * @private 331 * @private
332 * @param {!Event} e 332 * @param {!Event} e
333 */ 333 */
334 onDrop_: function(e) { 334 onDrop_: function(e) {
335 if (this.dropDestination_) { 335 if (this.dropDestination_) {
336 e.preventDefault(); 336 e.preventDefault();
337 337
338 var dropInfo = this.calculateDropInfo_(this.dropDestination_); 338 var dropInfo = this.calculateDropInfo_(this.dropDestination_);
339 if (dropInfo.index != -1) 339 var index = dropInfo.index != -1 ? dropInfo.index : undefined;
340 chrome.bookmarkManagerPrivate.drop(dropInfo.parentId, dropInfo.index); 340 var store = bookmarks.Store.getInstance();
341 else 341 store.beginBatchUpdate();
342 chrome.bookmarkManagerPrivate.drop(dropInfo.parentId); 342 chrome.bookmarkManagerPrivate.drop(
calamity 2017/06/22 05:48:27 This works within the BMM, but moving a folder in
tsergeant 2017/06/23 00:20:20 Hmmm, good idea, but I'm not sure that this is pos
calamity 2017/06/26 03:17:24 Hmm. How about just batching in api_listener.js? H
tsergeant 2017/06/27 07:35:53 Done. As discussed, I setTimeout seems to work rel
343 dropInfo.parentId, index, function() {
344 store.endBatchUpdate();
345 });
343 } 346 }
344 347
345 this.dropDestination_ = null; 348 this.dropDestination_ = null;
346 this.dropIndicator_.finish(); 349 this.dropIndicator_.finish();
347 }, 350 },
348 351
349 /** 352 /**
350 * @param {DropDestination} dropDestination 353 * @param {DropDestination} dropDestination
351 * @return {{parentId: string, index: number}} 354 * @return {{parentId: string, index: number}}
352 */ 355 */
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 this.dropIndicator_.setTimeout = this.setTimeout_; 648 this.dropIndicator_.setTimeout = this.setTimeout_;
646 } 649 }
647 }; 650 };
648 651
649 return { 652 return {
650 DNDManager: DNDManager, 653 DNDManager: DNDManager,
651 DragInfo: DragInfo, 654 DragInfo: DragInfo,
652 DropIndicator: DropIndicator, 655 DropIndicator: DropIndicator,
653 }; 656 };
654 }); 657 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_bookmarks/command_manager.js ('k') | chrome/browser/resources/md_bookmarks/store.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698