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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 e = /** @type {cr.ui.CanExecuteEvent} */(e); | 121 e = /** @type {cr.ui.CanExecuteEvent} */(e); |
122 switch (e.command.id) { | 122 switch (e.command.id) { |
123 case 'find-command': | 123 case 'find-command': |
124 e.canExecute = true; | 124 e.canExecute = true; |
125 break; | 125 break; |
126 case 'slash-command': | 126 case 'slash-command': |
127 e.canExecute = | 127 e.canExecute = |
128 !(this.$.toolbar.searchBar.showingSearch && | 128 !(this.$.toolbar.searchBar.showingSearch && |
129 this.$.toolbar.searchBar.isSearchFocused()); | 129 this.$.toolbar.searchBar.isSearchFocused()); |
130 break; | 130 break; |
131 case 'delete-command': | |
132 e.canExecute = this.$['history'].getHistoryList().numToBeDeleted() > 0; | |
tsergeant
2016/07/19 05:09:41
You could probably simplify this using `this.$.too
lshang
2016/07/20 01:19:09
Done.
| |
133 break; | |
131 } | 134 } |
132 }, | 135 }, |
133 | 136 |
134 /** | 137 /** |
135 * @param {Event} e | 138 * @param {Event} e |
136 * @private | 139 * @private |
137 */ | 140 */ |
138 onCommand_: function(e) { | 141 onCommand_: function(e) { |
139 if (e.command.id == 'find-command' || e.command.id == 'slash-command') | 142 if (e.command.id == 'find-command' || e.command.id == 'slash-command') |
140 this.$.toolbar.showSearchField(); | 143 this.$.toolbar.showSearchField(); |
144 if (e.command.id == 'delete-command') | |
145 this.deleteSelected(); | |
141 }, | 146 }, |
142 | 147 |
143 /** | 148 /** |
144 * @param {!Array<!ForeignSession>} sessionList Array of objects describing | 149 * @param {!Array<!ForeignSession>} sessionList Array of objects describing |
145 * the sessions from other devices. | 150 * the sessions from other devices. |
146 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? | 151 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? |
147 */ | 152 */ |
148 setForeignSessions: function(sessionList, isTabSyncEnabled) { | 153 setForeignSessions: function(sessionList, isTabSyncEnabled) { |
149 if (!isTabSyncEnabled) | 154 if (!isTabSyncEnabled) |
150 return; | 155 return; |
(...skipping 26 matching lines...) Expand all Loading... | |
177 * @param {boolean} incremental | 182 * @param {boolean} incremental |
178 * @param {string} searchTerm | 183 * @param {string} searchTerm |
179 * @return {boolean} Whether a loading spinner should be shown (implies the | 184 * @return {boolean} Whether a loading spinner should be shown (implies the |
180 * backend is querying a new search term). | 185 * backend is querying a new search term). |
181 * @private | 186 * @private |
182 */ | 187 */ |
183 shouldShowSpinner_: function(querying, incremental, searchTerm) { | 188 shouldShowSpinner_: function(querying, incremental, searchTerm) { |
184 return querying && !incremental && searchTerm != ''; | 189 return querying && !incremental && searchTerm != ''; |
185 }, | 190 }, |
186 }); | 191 }); |
OLD | NEW |