OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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-app', | 6 is: 'history-app', |
7 | 7 |
8 properties: { | 8 properties: { |
9 // The id of the currently selected page. | 9 // The id of the currently selected page. |
10 selectedPage_: {type: String, value: 'history', observer: 'unselectAll'}, | 10 selectedPage_: {type: String, value: 'history', observer: 'unselectAll'}, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 e = /** @type {cr.ui.CanExecuteEvent} */(e); | 128 e = /** @type {cr.ui.CanExecuteEvent} */(e); |
129 switch (e.command.id) { | 129 switch (e.command.id) { |
130 case 'find-command': | 130 case 'find-command': |
131 e.canExecute = true; | 131 e.canExecute = true; |
132 break; | 132 break; |
133 case 'slash-command': | 133 case 'slash-command': |
134 e.canExecute = | 134 e.canExecute = |
135 !(this.$.toolbar.searchBar.showingSearch && | 135 !(this.$.toolbar.searchBar.showingSearch && |
136 this.$.toolbar.searchBar.isSearchFocused()); | 136 this.$.toolbar.searchBar.isSearchFocused()); |
137 break; | 137 break; |
| 138 case 'delete-command': |
| 139 e.canExecute = this.$.toolbar.count > 0; |
| 140 break; |
138 } | 141 } |
139 }, | 142 }, |
140 | 143 |
141 /** | 144 /** |
142 * @param {Event} e | 145 * @param {Event} e |
143 * @private | 146 * @private |
144 */ | 147 */ |
145 onCommand_: function(e) { | 148 onCommand_: function(e) { |
146 if (e.command.id == 'find-command' || e.command.id == 'slash-command') | 149 if (e.command.id == 'find-command' || e.command.id == 'slash-command') |
147 this.$.toolbar.showSearchField(); | 150 this.$.toolbar.showSearchField(); |
| 151 if (e.command.id == 'delete-command') |
| 152 this.deleteSelected(); |
148 }, | 153 }, |
149 | 154 |
150 /** | 155 /** |
151 * @param {!Array<!ForeignSession>} sessionList Array of objects describing | 156 * @param {!Array<!ForeignSession>} sessionList Array of objects describing |
152 * the sessions from other devices. | 157 * the sessions from other devices. |
153 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? | 158 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? |
154 */ | 159 */ |
155 setForeignSessions: function(sessionList, isTabSyncEnabled) { | 160 setForeignSessions: function(sessionList, isTabSyncEnabled) { |
156 if (!isTabSyncEnabled) | 161 if (!isTabSyncEnabled) |
157 return; | 162 return; |
(...skipping 26 matching lines...) Expand all Loading... |
184 * @param {boolean} incremental | 189 * @param {boolean} incremental |
185 * @param {string} searchTerm | 190 * @param {string} searchTerm |
186 * @return {boolean} Whether a loading spinner should be shown (implies the | 191 * @return {boolean} Whether a loading spinner should be shown (implies the |
187 * backend is querying a new search term). | 192 * backend is querying a new search term). |
188 * @private | 193 * @private |
189 */ | 194 */ |
190 shouldShowSpinner_: function(querying, incremental, searchTerm) { | 195 shouldShowSpinner_: function(querying, incremental, searchTerm) { |
191 return querying && !incremental && searchTerm != ''; | 196 return querying && !incremental && searchTerm != ''; |
192 }, | 197 }, |
193 }); | 198 }); |
OLD | NEW |