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

Unified Diff: chrome/browser/resources/md_bookmarks/toolbar.js

Issue 2827573002: MD Bookmarks: Show toolbar overlay when multiple items are selected (Closed)
Patch Set: Fix layout problem Created 3 years, 8 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/toolbar.js
diff --git a/chrome/browser/resources/md_bookmarks/toolbar.js b/chrome/browser/resources/md_bookmarks/toolbar.js
index 8dacb67e248dd00b08ce2c8bf839a8644b9c973e..53a8d93be4ec360564b89f278bc5b2ea0d9fb2b2 100644
--- a/chrome/browser/resources/md_bookmarks/toolbar.js
+++ b/chrome/browser/resources/md_bookmarks/toolbar.js
@@ -20,12 +20,26 @@ Polymer({
type: String,
observer: 'onSidebarWidthChanged_',
},
+
+ showSelectionOverlay: {
+ type: Boolean,
+ computed: 'shouldShowSelectionOverlay_(selectedCount_)',
+ readOnly: true,
+ reflectToAttribute: true,
+ },
+
+ /** @private */
+ selectedCount_: Number,
},
attached: function() {
this.watch('searchTerm_', function(state) {
return state.search.term;
});
+ this.watch('selectedCount_', function(state) {
+ return state.selection.items.size;
+ });
+ this.updateFromStore();
},
/** @return {CrToolbarSearchFieldElement} */
@@ -58,6 +72,7 @@ Polymer({
this.closeDropdownMenu_();
},
+ /** @private */
onAddFolderTap_: function() {
var dialog =
/** @type {BookmarksEditDialogElement} */ (this.$.addDialog.get());
@@ -78,6 +93,11 @@ Polymer({
},
/** @private */
+ onClearSelectionTap_: function() {
+ this.dispatch(bookmarks.actions.deselectItems());
+ },
+
+ /** @private */
closeDropdownMenu_: function() {
var menu = /** @type {!CrActionMenuElement} */ (this.$.dropdown);
menu.close();
@@ -93,6 +113,7 @@ Polymer({
this.dispatch(bookmarks.actions.setSearchTerm(searchTerm));
},
+ /** @private */
onSidebarWidthChanged_: function() {
this.style.setProperty('--sidebar-width', this.sidebarWidth);
},
@@ -109,4 +130,20 @@ Polymer({
hasSearchTerm_: function() {
return !!this.searchTerm_;
},
+
+ /**
+ * @return {boolean}
+ * @private
+ */
+ shouldShowSelectionOverlay_: function() {
+ return this.selectedCount_ > 1;
+ },
+
+ /**
+ * @return {string}
+ * @private
+ */
+ numberOfItemsSelected_: function() {
+ return loadTimeData.getStringF('itemsSelected', this.selectedCount_);
+ },
});

Powered by Google App Engine
This is Rietveld 408576698