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

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

Issue 2917003003: [MD Bookmarks] Support elision of bookmark names in the bookmark toast. (Closed)
Patch Set: fix multiline 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 break; 185 break;
186 case Command.COPY: 186 case Command.COPY:
187 var idList = Array.from(itemIds); 187 var idList = Array.from(itemIds);
188 chrome.bookmarkManagerPrivate.copy(idList, function() { 188 chrome.bookmarkManagerPrivate.copy(idList, function() {
189 bookmarks.ToastManager.getInstance().show( 189 bookmarks.ToastManager.getInstance().show(
190 loadTimeData.getString('toastUrlCopied'), false); 190 loadTimeData.getString('toastUrlCopied'), false);
191 }); 191 });
192 break; 192 break;
193 case Command.DELETE: 193 case Command.DELETE:
194 var idList = Array.from(this.minimizeDeletionSet_(itemIds)); 194 var idList = Array.from(this.minimizeDeletionSet_(itemIds));
195 var labelPromise; 195 var title = this.getState().nodes[idList[0]].title;
196 if (idList.length == 1) { 196 var labelPromise = cr.sendWithPromise(
197 // TODO(calamity): fold this separate label into 197 'getPluralString', 'toastItemsDeleted', idList.length);
198 // 'toastItemsDeleted'.
199 labelPromise = Promise.resolve(loadTimeData.getStringF(
200 'toastItemDeleted', this.getState().nodes[idList[0]].title));
201 } else {
202 labelPromise = cr.sendWithPromise(
203 'getPluralString', 'toastItemsDeleted', idList.length);
204 }
205 chrome.bookmarkManagerPrivate.removeTrees(idList, function() { 198 chrome.bookmarkManagerPrivate.removeTrees(idList, function() {
206 labelPromise.then(function(label) { 199 labelPromise.then(function(label) {
207 bookmarks.ToastManager.getInstance().show(label, true); 200 var pieces = loadTimeData.getSubstitutedStringPieces(label, title)
208 }); 201 .map(function(p) {
202 // Make the bookmark name collapsible.
203 p.collapsible = !!p.arg;
204 return p;
205 });
206 bookmarks.ToastManager.getInstance().showForStringPieces(
207 pieces, true);
208 }.bind(this));
209 }.bind(this)); 209 }.bind(this));
210 break; 210 break;
211 case Command.UNDO: 211 case Command.UNDO:
212 chrome.bookmarkManagerPrivate.undo(); 212 chrome.bookmarkManagerPrivate.undo();
213 bookmarks.ToastManager.getInstance().hide(); 213 bookmarks.ToastManager.getInstance().hide();
214 break; 214 break;
215 case Command.REDO: 215 case Command.REDO:
216 chrome.bookmarkManagerPrivate.redo(); 216 chrome.bookmarkManagerPrivate.redo();
217 break; 217 break;
218 case Command.OPEN_NEW_TAB: 218 case Command.OPEN_NEW_TAB:
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 457
458 /** @return {!bookmarks.CommandManager} */ 458 /** @return {!bookmarks.CommandManager} */
459 CommandManager.getInstance = function() { 459 CommandManager.getInstance = function() {
460 return assert(CommandManager.instance_); 460 return assert(CommandManager.instance_);
461 }; 461 };
462 462
463 return { 463 return {
464 CommandManager: CommandManager, 464 CommandManager: CommandManager,
465 }; 465 };
466 }); 466 });
OLDNEW
« no previous file with comments | « chrome/app/bookmarks_strings.grdp ('k') | chrome/browser/resources/md_bookmarks/toast_manager.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698