| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 * Fired when the user presses 'More from this site'. | 111 * Fired when the user presses 'More from this site'. |
| 112 * @param {{detail: {domain: string}}} e | 112 * @param {{detail: {domain: string}}} e |
| 113 */ | 113 */ |
| 114 searchDomain_: function(e) { this.$.toolbar.setSearchTerm(e.detail.domain); }, | 114 searchDomain_: function(e) { this.$.toolbar.setSearchTerm(e.detail.domain); }, |
| 115 | 115 |
| 116 /** | 116 /** |
| 117 * @param {Event} e | 117 * @param {Event} e |
| 118 * @private | 118 * @private |
| 119 */ | 119 */ |
| 120 onCanExecute_: function(e) { | 120 onCanExecute_: function(e) { |
| 121 e.canExecute = true; | 121 e = /** @type {cr.ui.CanExecuteEvent} */(e); |
| 122 switch (e.command.id) { |
| 123 case 'find-command': |
| 124 e.canExecute = true; |
| 125 break; |
| 126 case 'slash-command': |
| 127 e.canExecute = |
| 128 !(this.$.toolbar.searchBar.showingSearch && |
| 129 this.$.toolbar.searchBar.isSearchFocused()); |
| 130 break; |
| 131 } |
| 122 }, | 132 }, |
| 123 | 133 |
| 124 /** | 134 /** |
| 125 * @param {Event} e | 135 * @param {Event} e |
| 126 * @private | 136 * @private |
| 127 */ | 137 */ |
| 128 onCommand_: function(e) { | 138 onCommand_: function(e) { |
| 129 if (e.command.id == 'find-command') | 139 if (e.command.id == 'find-command' || e.command.id == 'slash-command') |
| 130 this.$.toolbar.showSearchField(); | 140 this.$.toolbar.showSearchField(); |
| 131 }, | 141 }, |
| 132 | 142 |
| 133 /** | 143 /** |
| 134 * @param {!Array<!ForeignSession>} sessionList Array of objects describing | 144 * @param {!Array<!ForeignSession>} sessionList Array of objects describing |
| 135 * the sessions from other devices. | 145 * the sessions from other devices. |
| 136 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? | 146 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? |
| 137 */ | 147 */ |
| 138 setForeignSessions: function(sessionList, isTabSyncEnabled) { | 148 setForeignSessions: function(sessionList, isTabSyncEnabled) { |
| 139 if (!isTabSyncEnabled) | 149 if (!isTabSyncEnabled) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 167 * @param {boolean} incremental | 177 * @param {boolean} incremental |
| 168 * @param {string} searchTerm | 178 * @param {string} searchTerm |
| 169 * @return {boolean} Whether a loading spinner should be shown (implies the | 179 * @return {boolean} Whether a loading spinner should be shown (implies the |
| 170 * backend is querying a new search term). | 180 * backend is querying a new search term). |
| 171 * @private | 181 * @private |
| 172 */ | 182 */ |
| 173 shouldShowSpinner_: function(querying, incremental, searchTerm) { | 183 shouldShowSpinner_: function(querying, incremental, searchTerm) { |
| 174 return querying && !incremental && searchTerm != ''; | 184 return querying && !incremental && searchTerm != ''; |
| 175 }, | 185 }, |
| 176 }); | 186 }); |
| OLD | NEW |