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

Side by Side Diff: chrome/browser/resources/md_bookmarks/command_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 /** 5 /**
6 * @fileoverview Element which shows context menus and handles keyboard 6 * @fileoverview Element which shows context menus and handles keyboard
7 * shortcuts. 7 * shortcuts.
8 */ 8 */
9 cr.define('bookmarks', function() { 9 cr.define('bookmarks', function() {
10 10
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 chrome.bookmarkManagerPrivate.copy(idList, function() { 209 chrome.bookmarkManagerPrivate.copy(idList, function() {
210 bookmarks.ToastManager.getInstance().show( 210 bookmarks.ToastManager.getInstance().show(
211 loadTimeData.getString('toastUrlCopied'), false); 211 loadTimeData.getString('toastUrlCopied'), false);
212 }); 212 });
213 break; 213 break;
214 case Command.DELETE: 214 case Command.DELETE:
215 var idList = Array.from(this.minimizeDeletionSet_(itemIds)); 215 var idList = Array.from(this.minimizeDeletionSet_(itemIds));
216 var title = state.nodes[idList[0]].title; 216 var title = state.nodes[idList[0]].title;
217 var labelPromise = cr.sendWithPromise( 217 var labelPromise = cr.sendWithPromise(
218 'getPluralString', 'toastItemsDeleted', idList.length); 218 'getPluralString', 'toastItemsDeleted', idList.length);
219 var store = bookmarks.Store.getInstance();
220 store.beginBatchUpdate();
219 chrome.bookmarkManagerPrivate.removeTrees(idList, function() { 221 chrome.bookmarkManagerPrivate.removeTrees(idList, function() {
222 store.endBatchUpdate();
220 labelPromise.then(function(label) { 223 labelPromise.then(function(label) {
221 var pieces = loadTimeData.getSubstitutedStringPieces(label, title) 224 var pieces = loadTimeData.getSubstitutedStringPieces(label, title)
222 .map(function(p) { 225 .map(function(p) {
223 // Make the bookmark name collapsible. 226 // Make the bookmark name collapsible.
224 p.collapsible = !!p.arg; 227 p.collapsible = !!p.arg;
225 return p; 228 return p;
226 }); 229 });
227 bookmarks.ToastManager.getInstance().showForStringPieces( 230 bookmarks.ToastManager.getInstance().showForStringPieces(
228 pieces, true); 231 pieces, true);
229 }.bind(this)); 232 }.bind(this));
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 512
510 /** @return {!bookmarks.CommandManager} */ 513 /** @return {!bookmarks.CommandManager} */
511 CommandManager.getInstance = function() { 514 CommandManager.getInstance = function() {
512 return assert(CommandManager.instance_); 515 return assert(CommandManager.instance_);
513 }; 516 };
514 517
515 return { 518 return {
516 CommandManager: CommandManager, 519 CommandManager: CommandManager,
517 }; 520 };
518 }); 521 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698