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

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: 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 break; 181 break;
182 case Command.COPY: 182 case Command.COPY:
183 var idList = Array.from(itemIds); 183 var idList = Array.from(itemIds);
184 chrome.bookmarkManagerPrivate.copy(idList, function() { 184 chrome.bookmarkManagerPrivate.copy(idList, function() {
185 bookmarks.ToastManager.getInstance().show( 185 bookmarks.ToastManager.getInstance().show(
186 loadTimeData.getString('toastUrlCopied'), false); 186 loadTimeData.getString('toastUrlCopied'), false);
187 }); 187 });
188 break; 188 break;
189 case Command.DELETE: 189 case Command.DELETE:
190 var idList = Array.from(this.minimizeDeletionSet_(itemIds)); 190 var idList = Array.from(this.minimizeDeletionSet_(itemIds));
191 var labelPromise; 191 var title = this.getState().nodes[idList[0]].title;
192 if (idList.length == 1) { 192 var labelPromise = cr.sendWithPromise(
193 // TODO(calamity): fold this separate label into 193 'getPluralString', 'toastItemsDeleted', idList.length);
194 // 'toastItemsDeleted'.
195 labelPromise = Promise.resolve(loadTimeData.getStringF(
196 'toastItemDeleted', this.getState().nodes[idList[0]].title));
197 } else {
198 labelPromise = cr.sendWithPromise(
199 'getPluralString', 'toastItemsDeleted', idList.length);
200 }
201 chrome.bookmarkManagerPrivate.removeTrees(idList, function() { 194 chrome.bookmarkManagerPrivate.removeTrees(idList, function() {
202 labelPromise.then(function(label) { 195 labelPromise.then(function(label) {
203 bookmarks.ToastManager.getInstance().show(label, true); 196 var pieces = loadTimeData.getSubstitutedStringPieces(label, title)
204 }); 197 .map(function(p) {
198 // Make the bookmark name collapsible.
199 p.collapsible = !!p.arg;
200 return p;
201 })
202 bookmarks.ToastManager.getInstance().showForStringPieces(
203 pieces, true);
204 }.bind(this));
205 }.bind(this)); 205 }.bind(this));
206 break; 206 break;
207 case Command.UNDO: 207 case Command.UNDO:
208 chrome.bookmarkManagerPrivate.undo(); 208 chrome.bookmarkManagerPrivate.undo();
209 bookmarks.ToastManager.getInstance().hide(); 209 bookmarks.ToastManager.getInstance().hide();
210 break; 210 break;
211 case Command.REDO: 211 case Command.REDO:
212 chrome.bookmarkManagerPrivate.redo(); 212 chrome.bookmarkManagerPrivate.redo();
213 break; 213 break;
214 case Command.OPEN_NEW_TAB: 214 case Command.OPEN_NEW_TAB:
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 442
443 /** @return {!bookmarks.CommandManager} */ 443 /** @return {!bookmarks.CommandManager} */
444 CommandManager.getInstance = function() { 444 CommandManager.getInstance = function() {
445 return assert(CommandManager.instance_); 445 return assert(CommandManager.instance_);
446 }; 446 };
447 447
448 return { 448 return {
449 CommandManager: CommandManager, 449 CommandManager: CommandManager,
450 }; 450 };
451 }); 451 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698