| 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 2ec046977b9e4238e7cad7c2f9401010c80f8b7f..152eadfba702c57e0f46fbb158689a2f05ef8189 100644
|
| --- a/chrome/browser/resources/md_bookmarks/toolbar.js
|
| +++ b/chrome/browser/resources/md_bookmarks/toolbar.js
|
| @@ -23,7 +23,7 @@ Polymer({
|
|
|
| showSelectionOverlay: {
|
| type: Boolean,
|
| - computed: 'shouldShowSelectionOverlay_(selectedCount_)',
|
| + computed: 'shouldShowSelectionOverlay_(selectedItems_, globalCanEdit_)',
|
| readOnly: true,
|
| reflectToAttribute: true,
|
| },
|
| @@ -34,16 +34,35 @@ Polymer({
|
| reflectToAttribute: true,
|
| },
|
|
|
| + /** @private {!Set<string>} */
|
| + selectedItems_: Object,
|
| +
|
| + /** @private */
|
| + globalCanEdit_: Boolean,
|
| +
|
| + /** @private */
|
| + selectedFolder_: String,
|
| +
|
| /** @private */
|
| - selectedCount_: Number,
|
| + canChangeList_: {
|
| + type: Boolean,
|
| + computed:
|
| + 'computeCanChangeList_(selectedFolder_, searchTerm_, globalCanEdit_)',
|
| + }
|
| },
|
|
|
| attached: function() {
|
| this.watch('searchTerm_', function(state) {
|
| return state.search.term;
|
| });
|
| - this.watch('selectedCount_', function(state) {
|
| - return state.selection.items.size;
|
| + this.watch('selectedItems_', function(state) {
|
| + return state.selection.items;
|
| + });
|
| + this.watch('globalCanEdit_', function(state) {
|
| + return state.prefs.canEdit;
|
| + });
|
| + this.watch('selectedFolder_', function(state) {
|
| + return state.selectedFolder;
|
| });
|
| this.updateFromStore();
|
| },
|
| @@ -143,8 +162,10 @@ Polymer({
|
| * @return {boolean}
|
| * @private
|
| */
|
| - hasSearchTerm_: function() {
|
| - return !!this.searchTerm_;
|
| + computeCanChangeList_: function() {
|
| + return !this.searchTerm_ &&
|
| + bookmarks.util.canReorderChildren(
|
| + this.getState(), this.selectedFolder_);
|
| },
|
|
|
| /**
|
| @@ -152,7 +173,12 @@ Polymer({
|
| * @private
|
| */
|
| shouldShowSelectionOverlay_: function() {
|
| - return this.selectedCount_ > 1;
|
| + return this.selectedItems_.size > 1 && this.globalCanEdit_;
|
| + },
|
| +
|
| + canDeleteSelection_: function() {
|
| + return bookmarks.CommandManager.getInstance().canExecute(
|
| + Command.DELETE, this.selectedItems_);
|
| },
|
|
|
| /**
|
| @@ -160,6 +186,6 @@ Polymer({
|
| * @private
|
| */
|
| getItemsSelectedString_: function() {
|
| - return loadTimeData.getStringF('itemsSelected', this.selectedCount_);
|
| + return loadTimeData.getStringF('itemsSelected', this.selectedItems_.size);
|
| },
|
| });
|
|
|