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

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: Review comments 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 282 }
283 283
284 this.showTitleToast_( 284 this.showTitleToast_(
285 labelPromise, state.nodes[idList[0]].title, false); 285 labelPromise, state.nodes[idList[0]].title, false);
286 }.bind(this)); 286 }.bind(this));
287 break; 287 break;
288 case Command.SHOW_IN_FOLDER: 288 case Command.SHOW_IN_FOLDER:
289 var id = Array.from(itemIds)[0]; 289 var id = Array.from(itemIds)[0];
290 this.dispatch(bookmarks.actions.selectFolder( 290 this.dispatch(bookmarks.actions.selectFolder(
291 assert(state.nodes[id].parentId), state.nodes)); 291 assert(state.nodes[id].parentId), state.nodes));
292 bookmarks.DialogFocusManager.getInstance().clearFocus();
293 this.fire('highlight-items', [id]);
292 break; 294 break;
293 case Command.DELETE: 295 case Command.DELETE:
294 var idList = Array.from(this.minimizeDeletionSet_(itemIds)); 296 var idList = Array.from(this.minimizeDeletionSet_(itemIds));
295 var title = state.nodes[idList[0]].title; 297 var title = state.nodes[idList[0]].title;
296 var labelPromise; 298 var labelPromise;
297 299
298 if (idList.length == 1) { 300 if (idList.length == 1) {
299 labelPromise = 301 labelPromise =
300 Promise.resolve(loadTimeData.getString('toastItemDeleted')); 302 Promise.resolve(loadTimeData.getString('toastItemDeleted'));
301 } else { 303 } else {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 break; 340 break;
339 case Command.DESELECT_ALL: 341 case Command.DESELECT_ALL:
340 this.dispatch(bookmarks.actions.deselectItems()); 342 this.dispatch(bookmarks.actions.deselectItems());
341 break; 343 break;
342 case Command.CUT: 344 case Command.CUT:
343 chrome.bookmarkManagerPrivate.cut(Array.from(itemIds)); 345 chrome.bookmarkManagerPrivate.cut(Array.from(itemIds));
344 break; 346 break;
345 case Command.PASTE: 347 case Command.PASTE:
346 var selectedFolder = state.selectedFolder; 348 var selectedFolder = state.selectedFolder;
347 var selectedItems = state.selection.items; 349 var selectedItems = state.selection.items;
350 bookmarks.ApiListener.trackUpdatedItems();
348 chrome.bookmarkManagerPrivate.paste( 351 chrome.bookmarkManagerPrivate.paste(
349 selectedFolder, Array.from(selectedItems)); 352 selectedFolder, Array.from(selectedItems),
353 bookmarks.ApiListener.highlightUpdatedItems);
350 break; 354 break;
351 default: 355 default:
352 assert(false); 356 assert(false);
353 } 357 }
354 }, 358 },
355 359
356 /** 360 /**
357 * @param {!Event} e 361 * @param {!Event} e
358 * @param {!Set<string>} itemIds 362 * @param {!Set<string>} itemIds
359 * @return {boolean} True if the event was handled, triggering a keyboard 363 * @return {boolean} True if the event was handled, triggering a keyboard
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 689
686 /** @return {!bookmarks.CommandManager} */ 690 /** @return {!bookmarks.CommandManager} */
687 CommandManager.getInstance = function() { 691 CommandManager.getInstance = function() {
688 return assert(CommandManager.instance_); 692 return assert(CommandManager.instance_);
689 }; 693 };
690 694
691 return { 695 return {
692 CommandManager: CommandManager, 696 CommandManager: CommandManager,
693 }; 697 };
694 }); 698 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698