| Index: ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js
|
| diff --git a/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js b/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js
|
| index 68c15d4ff6146d481f0c60d025cb8dfaa58dc179..491bbb53d601264a1059da22c8096280ae59a584 100644
|
| --- a/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js
|
| +++ b/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js
|
| @@ -19,6 +19,12 @@ var CrSearchFieldBehavior = {
|
| value: '',
|
| },
|
|
|
| + hasSearchText: {
|
| + type: Boolean,
|
| + reflectToAttribute: true,
|
| + value: false,
|
| + },
|
| +
|
| /** @private */
|
| lastValue_: {
|
| type: String,
|
| @@ -49,6 +55,8 @@ var CrSearchFieldBehavior = {
|
| setValue: function(value, opt_noEvent) {
|
| var searchInput = this.getSearchInput();
|
| searchInput.value = value;
|
| +
|
| + this.onSearchTermInput();
|
| this.onValueChanged_(value, !!opt_noEvent);
|
| },
|
|
|
| @@ -57,6 +65,15 @@ var CrSearchFieldBehavior = {
|
| },
|
|
|
| /**
|
| + * 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.
|
| + */
|
| + onSearchTermInput: function() {
|
| + this.hasSearchText = this.$.searchInput.value != '';
|
| + },
|
| +
|
| + /**
|
| * Updates the internal state of the search field based on a change that has
|
| * already happened.
|
| * @param {string} newValue
|
|
|