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 if (this.$.toolbar.showingSearchField()) | |
Dan Beam
2016/07/15 03:07:40
don't you actually want whether the search field i
tsergeant
2016/07/15 04:06:21
Yeah, there can be cases where the field is showin
lshang
2016/07/15 05:02:09
Yep, good point!
I changed to regard forward slash
| |
128 e.canExecute = false; | |
129 else | |
130 e.canExecute = true; | |
Dan Beam
2016/07/15 03:07:40
e.canExecute = !this.$.toolbar.showingSearchField(
lshang
2016/07/15 05:02:09
Done.
| |
131 break; | |
132 } | |
122 }, | 133 }, |
123 | 134 |
124 /** | 135 /** |
125 * @param {Event} e | 136 * @param {Event} e |
126 * @private | 137 * @private |
127 */ | 138 */ |
128 onCommand_: function(e) { | 139 onCommand_: function(e) { |
129 if (e.command.id == 'find-command') | 140 if (e.command.id == 'find-command' || e.command.id == 'slash-command') |
130 this.$.toolbar.showSearchField(); | 141 this.$.toolbar.showSearchField(); |
131 }, | 142 }, |
132 | 143 |
133 /** | 144 /** |
134 * @param {!Array<!ForeignSession>} sessionList Array of objects describing | 145 * @param {!Array<!ForeignSession>} sessionList Array of objects describing |
135 * the sessions from other devices. | 146 * the sessions from other devices. |
136 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? | 147 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? |
137 */ | 148 */ |
138 setForeignSessions: function(sessionList, isTabSyncEnabled) { | 149 setForeignSessions: function(sessionList, isTabSyncEnabled) { |
139 if (!isTabSyncEnabled) | 150 if (!isTabSyncEnabled) |
(...skipping 27 matching lines...) Expand all Loading... | |
167 * @param {boolean} incremental | 178 * @param {boolean} incremental |
168 * @param {string} searchTerm | 179 * @param {string} searchTerm |
169 * @return {boolean} Whether a loading spinner should be shown (implies the | 180 * @return {boolean} Whether a loading spinner should be shown (implies the |
170 * backend is querying a new search term). | 181 * backend is querying a new search term). |
171 * @private | 182 * @private |
172 */ | 183 */ |
173 shouldShowSpinner_: function(querying, incremental, searchTerm) { | 184 shouldShowSpinner_: function(querying, incremental, searchTerm) { |
174 return querying && !incremental && searchTerm != ''; | 185 return querying && !incremental && searchTerm != ''; |
175 }, | 186 }, |
176 }); | 187 }); |
OLD | NEW |