Chromium Code Reviews| Index: ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js |
| diff --git a/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js b/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js |
| index 3de204caa0e8a73008efac0bb36d4b15b9a4fbfb..6ead1b1933ce8ab94d928ab4c6f2581d1dc867f8 100644 |
| --- a/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js |
| +++ b/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js |
| @@ -32,9 +32,6 @@ Polymer({ |
| spinnerActive: {type: Boolean, reflectToAttribute: true}, |
| /** @private */ |
| - hasSearchText_: {type: Boolean, reflectToAttribute: true}, |
| - |
| - /** @private */ |
| isSpinnerShown_: { |
| type: Boolean, |
| computed: 'computeIsSpinnerShown_(spinnerActive, showingSearch)' |
| @@ -54,17 +51,6 @@ Polymer({ |
| return this.$.searchInput; |
| }, |
| - /** |
| - * Sets the value of the search field. Overridden from CrSearchFieldBehavior. |
| - * @param {string} value |
| - * @param {boolean=} opt_noEvent Whether to prevent a 'search-changed' event |
| - * firing for this change. |
| - */ |
| - setValue: function(value, opt_noEvent) { |
| - CrSearchFieldBehavior.setValue.call(this, value, opt_noEvent); |
| - this.onSearchInput_(); |
| - }, |
| - |
| /** @return {boolean} */ |
| isSearchFocused: function() { |
| return this.searchFocused_; |
| @@ -75,6 +61,12 @@ Polymer({ |
| this.focus_(); |
| }, |
| + onSearchTermInput: function() { |
| + CrSearchFieldBehavior.onSearchTermInput.call(this); |
| + if (this.hasSearchText) |
|
dpapad
2017/01/18 02:52:26
Shouldn't we update the boolean either way?
this.
tsergeant
2017/01/18 04:14:05
Hmm, almost: we don't want to close the search fie
|
| + this.showingSearch = true; |
| + }, |
| + |
| /** @private */ |
| focus_: function() { |
| this.getSearchInput().focus(); |
| @@ -105,23 +97,10 @@ Polymer({ |
| /** @private */ |
| onInputBlur_: function() { |
| this.searchFocused_ = false; |
| - if (!this.hasSearchText_) |
| + if (!this.hasSearchText) |
| this.showingSearch = false; |
| }, |
| - /** |
| - * Update the state of the search field whenever the underlying input value |
| - * changes. Unlike onsearch or onkeypress, this is reliably called immediately |
| - * after any change, whether the result of user input or JS modification. |
| - * @private |
| - */ |
| - onSearchInput_: function() { |
| - var newValue = this.$.searchInput.value; |
| - this.hasSearchText_ = newValue != ''; |
| - if (newValue != '') |
| - this.showingSearch = true; |
| - }, |
| - |
| /** @private */ |
| onSearchTermKeydown_: function(e) { |
| if (e.key == 'Escape') |