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

Unified Diff: chrome/browser/resources/md_bookmarks/toast_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 side-by-side diff with in-line comments
Download patch
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..c0e72fca69f5cdb3bd5bd1e69b07f2ce1f519e9b 100644
--- a/chrome/browser/resources/md_bookmarks/toast_manager.js
+++ b/chrome/browser/resources/md_bookmarks/toast_manager.js
@@ -51,9 +51,39 @@ 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) {
+ 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)
« no previous file with comments | « chrome/browser/resources/md_bookmarks/toast_manager.html ('k') | chrome/browser/ui/webui/md_bookmarks/md_bookmarks_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698