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

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

Issue 2827573002: MD Bookmarks: Show toolbar overlay when multiple items are selected (Closed)
Patch Set: Review comments 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..3ebeb2d5dd6a6f0f1849ec932d1e714daf345ce6 100644
--- a/chrome/browser/resources/md_bookmarks/toolbar.js
+++ b/chrome/browser/resources/md_bookmarks/toolbar.js
@@ -20,12 +20,32 @@ Polymer({
type: String,
observer: 'onSidebarWidthChanged_',
},
+
+ showSelectionOverlay: {
+ type: Boolean,
+ computed: 'shouldShowSelectionOverlay_(selectedCount_)',
+ readOnly: true,
+ reflectToAttribute: true,
+ },
+
+ /** @private */
+ narrow_: {
+ type: Boolean,
+ 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 +78,7 @@ Polymer({
this.closeDropdownMenu_();
},
+ /** @private */
onAddFolderTap_: function() {
var dialog =
/** @type {BookmarksEditDialogElement} */ (this.$.addDialog.get());
@@ -78,6 +99,11 @@ Polymer({
},
/** @private */
+ onClearSelectionTap_: function() {
+ this.dispatch(bookmarks.actions.deselectItems());
+ },
+
+ /** @private */
closeDropdownMenu_: function() {
var menu = /** @type {!CrActionMenuElement} */ (this.$.dropdown);
menu.close();
@@ -93,6 +119,7 @@ Polymer({
this.dispatch(bookmarks.actions.setSearchTerm(searchTerm));
},
+ /** @private */
onSidebarWidthChanged_: function() {
this.style.setProperty('--sidebar-width', this.sidebarWidth);
},
@@ -109,4 +136,20 @@ Polymer({
hasSearchTerm_: function() {
return !!this.searchTerm_;
},
+
+ /**
+ * @return {boolean}
+ * @private
+ */
+ shouldShowSelectionOverlay_: function() {
+ return this.selectedCount_ > 1;
+ },
+
+ /**
+ * @return {string}
+ * @private
+ */
+ getItemsSelectedString_: function() {
+ return loadTimeData.getStringF('itemsSelected', this.selectedCount_);
+ },
});
« no previous file with comments | « chrome/browser/resources/md_bookmarks/toolbar.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