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_); |
+ }, |
}); |