Chromium Code Reviews| Index: chrome/browser/resources/md_bookmarks/toast_manager.js |
| diff --git a/chrome/browser/resources/md_bookmarks/toast_manager.js b/chrome/browser/resources/md_bookmarks/toast_manager.js |
| index dabd588565432ee81d5591809c244f1465691801..6cc20a43f64a596bdf0724821dd4b6574fa0c025 100644 |
| --- a/chrome/browser/resources/md_bookmarks/toast_manager.js |
| +++ b/chrome/browser/resources/md_bookmarks/toast_manager.js |
| @@ -51,9 +51,40 @@ cr.define('bookmarks', function() { |
| * @param {boolean} showUndo Whether the undo button should be shown. |
| */ |
| show: function(label, showUndo) { |
| - this.open_ = true; |
| - // TODO(calamity): Support collapsing of long bookmark names in label. |
| this.$.content.textContent = label; |
| + this.showInternal_(showUndo); |
| + }, |
| + |
| + /** |
| + * Shows the toast, making certain text fragments collapsible. |
| + * @param {!Array<!{value: string, collapsible: boolean}>} pieces |
| + * @param {boolean} showUndo Whether the undo button should be shown. |
| + */ |
| + showForStringPieces: function(pieces, showUndo) { |
| + this.$.toast.open = true; |
|
tsergeant
2017/06/05 03:33:54
This looks like it was leftover from a rebase
calamity
2017/06/06 05:36:02
Yeah, oops, the last CL has been wreaking havoc on
|
| + var content = this.$.content; |
| + content.textContent = ''; |
| + pieces.forEach(function(p) { |
| + if (p.value.length == 0) |
| + return; |
| + |
| + var span = document.createElement('span'); |
| + span.textContent = p.value; |
| + if (p.collapsible) |
| + span.classList.add('collapsible'); |
| + |
| + content.appendChild(span); |
| + }); |
| + |
| + this.showInternal_(showUndo); |
| + }, |
| + |
| + /** |
| + * @param {boolean} showUndo Whether the undo button should be shown. |
| + * @private |
| + */ |
| + showInternal_: function(showUndo) { |
| + this.open_ = true; |
| this.showUndo_ = showUndo; |
| if (!this.duration) |