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

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

Issue 2977523002: MD Bookmarks: Scroll and select items that are added to the main list (Closed)
Patch Set: Finish highlight on API callback Created 3 years, 5 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 279 }
280 280
281 this.showTitleToast_( 281 this.showTitleToast_(
282 labelPromise, state.nodes[idList[0]].title, false); 282 labelPromise, state.nodes[idList[0]].title, false);
283 }.bind(this)); 283 }.bind(this));
284 break; 284 break;
285 case Command.SHOW_IN_FOLDER: 285 case Command.SHOW_IN_FOLDER:
286 var id = Array.from(itemIds)[0]; 286 var id = Array.from(itemIds)[0];
287 this.dispatch(bookmarks.actions.selectFolder( 287 this.dispatch(bookmarks.actions.selectFolder(
288 assert(state.nodes[id].parentId), state.nodes)); 288 assert(state.nodes[id].parentId), state.nodes));
289 bookmarks.DialogFocusManager.getInstance().clearFocus();
290 this.fire('highlight-items', [id]);
289 break; 291 break;
290 case Command.DELETE: 292 case Command.DELETE:
291 var idList = Array.from(this.minimizeDeletionSet_(itemIds)); 293 var idList = Array.from(this.minimizeDeletionSet_(itemIds));
292 var title = state.nodes[idList[0]].title; 294 var title = state.nodes[idList[0]].title;
293 var labelPromise = cr.sendWithPromise( 295 var labelPromise = cr.sendWithPromise(
294 'getPluralString', 'toastItemsDeleted', idList.length); 296 'getPluralString', 'toastItemsDeleted', idList.length);
295 chrome.bookmarkManagerPrivate.removeTrees(idList, function() { 297 chrome.bookmarkManagerPrivate.removeTrees(idList, function() {
296 this.showTitleToast_(labelPromise, title, true); 298 this.showTitleToast_(labelPromise, title, true);
297 }.bind(this)); 299 }.bind(this));
298 break; 300 break;
(...skipping 28 matching lines...) Expand all
327 break; 329 break;
328 case Command.DESELECT_ALL: 330 case Command.DESELECT_ALL:
329 this.dispatch(bookmarks.actions.deselectItems()); 331 this.dispatch(bookmarks.actions.deselectItems());
330 break; 332 break;
331 case Command.CUT: 333 case Command.CUT:
332 chrome.bookmarkManagerPrivate.cut(Array.from(itemIds)); 334 chrome.bookmarkManagerPrivate.cut(Array.from(itemIds));
333 break; 335 break;
334 case Command.PASTE: 336 case Command.PASTE:
335 var selectedFolder = state.selectedFolder; 337 var selectedFolder = state.selectedFolder;
336 var selectedItems = state.selection.items; 338 var selectedItems = state.selection.items;
339 bookmarks.ApiListener.trackUpdatedItems();
337 chrome.bookmarkManagerPrivate.paste( 340 chrome.bookmarkManagerPrivate.paste(
338 selectedFolder, Array.from(selectedItems)); 341 selectedFolder, Array.from(selectedItems),
342 bookmarks.ApiListener.highlightUpdatedItems);
339 break; 343 break;
340 default: 344 default:
341 assert(false); 345 assert(false);
342 } 346 }
343 }, 347 },
344 348
345 /** 349 /**
346 * @param {!Event} e 350 * @param {!Event} e
347 * @param {!Set<string>} itemIds 351 * @param {!Set<string>} itemIds
348 * @return {boolean} True if the event was handled, triggering a keyboard 352 * @return {boolean} True if the event was handled, triggering a keyboard
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 676
673 /** @return {!bookmarks.CommandManager} */ 677 /** @return {!bookmarks.CommandManager} */
674 CommandManager.getInstance = function() { 678 CommandManager.getInstance = function() {
675 return assert(CommandManager.instance_); 679 return assert(CommandManager.instance_);
676 }; 680 };
677 681
678 return { 682 return {
679 CommandManager: CommandManager, 683 CommandManager: CommandManager,
680 }; 684 };
681 }); 685 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698