OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 Polymer({ | 5 Polymer({ |
6 is: 'history-toolbar', | 6 is: 'history-toolbar', |
7 properties: { | 7 properties: { |
8 // Number of history items currently selected. | 8 // Number of history items currently selected. |
9 // TODO(calamity): bind this to | 9 // TODO(calamity): bind this to |
10 // listContainer.selectedItem.selectedPaths.length. | 10 // listContainer.selectedItem.selectedPaths.length. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 /** @return {CrToolbarSearchFieldElement} */ | 89 /** @return {CrToolbarSearchFieldElement} */ |
90 get searchField() { | 90 get searchField() { |
91 return /** @type {CrToolbarElement} */ (this.$['main-toolbar']) | 91 return /** @type {CrToolbarElement} */ (this.$['main-toolbar']) |
92 .getSearchField(); | 92 .getSearchField(); |
93 }, | 93 }, |
94 | 94 |
95 showSearchField: function() { | 95 showSearchField: function() { |
96 this.searchField.showAndFocus(); | 96 this.searchField.showAndFocus(); |
97 }, | 97 }, |
98 | 98 |
| 99 deleteSelectedItems: function() { |
| 100 this.fire('delete-selected'); |
| 101 }, |
| 102 |
| 103 clearSelectedItems: function() { |
| 104 this.fire('unselect-all'); |
| 105 }, |
| 106 |
99 /** | 107 /** |
100 * Changes the toolbar background color depending on whether any history items | 108 * Changes the toolbar background color depending on whether any history items |
101 * are currently selected. | 109 * are currently selected. |
102 * @private | 110 * @private |
103 */ | 111 */ |
104 changeToolbarView_: function() { | 112 changeToolbarView_: function() { |
105 this.itemsSelected_ = this.count > 0; | 113 this.itemsSelected_ = this.count > 0; |
106 }, | 114 }, |
107 | 115 |
108 /** | 116 /** |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 /** | 170 /** |
163 * @param {!Event} e | 171 * @param {!Event} e |
164 * @private | 172 * @private |
165 */ | 173 */ |
166 onDocumentKeydown_: function(e) { | 174 onDocumentKeydown_: function(e) { |
167 if (e.key == 'Escape') | 175 if (e.key == 'Escape') |
168 this.syncNoticeVisible_ = false; | 176 this.syncNoticeVisible_ = false; |
169 }, | 177 }, |
170 | 178 |
171 /** @private */ | 179 /** @private */ |
172 onClearSelectionTap_: function() { | |
173 this.fire('unselect-all'); | |
174 }, | |
175 | |
176 /** @private */ | |
177 onDeleteTap_: function() { | |
178 this.fire('delete-selected'); | |
179 }, | |
180 | |
181 /** @private */ | |
182 numberOfItemsSelected_: function(count) { | 180 numberOfItemsSelected_: function(count) { |
183 return count > 0 ? loadTimeData.getStringF('itemsSelected', count) : ''; | 181 return count > 0 ? loadTimeData.getStringF('itemsSelected', count) : ''; |
184 }, | 182 }, |
185 }); | 183 }); |
OLD | NEW |