Chromium Code Reviews| 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.js b/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js |
| similarity index 88% |
| copy from ui/webui/resources/cr_elements/cr_search_field/cr_search_field.js |
| copy to ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js |
| index a507fc34f663939c5889c21c3a7455d533265b6d..ef29dd97a48ae558524f36974a08cf7a58b93223 100644 |
| --- a/ui/webui/resources/cr_elements/cr_search_field/cr_search_field.js |
| +++ b/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js |
| @@ -1,4 +1,4 @@ |
| -// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| @@ -12,9 +12,10 @@ SearchFieldDelegate.prototype = { |
| onSearchTermSearch: assertNotReached, |
| }; |
| -var SearchField = Polymer({ |
| - is: 'cr-search-field', |
| - |
| +/** |
| + * @polymerBehavior |
|
calamity
2016/05/16 04:27:34
Can we get a comment about what this Behavior is s
tsergeant
2016/05/17 03:24:38
Done.
|
| + */ |
| +var CrSearchFieldBehavior = { |
| properties: { |
| label: { |
| type: String, |
| @@ -30,7 +31,12 @@ var SearchField = Polymer({ |
| type: Boolean, |
| value: false, |
| observer: 'showingSearchChanged_', |
| + reflectToAttribute: true |
| }, |
| + |
| + hasSearchText_: { |
| + type: Boolean, |
| + } |
| }, |
| /** |
| @@ -50,6 +56,7 @@ var SearchField = Polymer({ |
| var searchInput = this.getSearchInput_(); |
| if (searchInput) |
| searchInput.value = value; |
| + this.hasSearchText_ = this.getValue() != ''; |
| }, |
| /** @param {SearchFieldDelegate} delegate */ |
| @@ -92,6 +99,7 @@ var SearchField = Polymer({ |
| onSearchTermSearch_: function() { |
| if (this.delegate_) |
| this.delegate_.onSearchTermSearch(this.getValue()); |
| + this.hasSearchText_ = this.getValue() != ''; |
|
calamity
2016/05/16 04:27:34
You may want to put this above the delegate call i
tsergeant
2016/05/17 03:24:38
Done.
|
| }, |
| /** @private */ |
| @@ -118,5 +126,5 @@ var SearchField = Polymer({ |
| /** @private */ |
| toggleShowingSearch_: function() { |
| this.showingSearch_ = !this.showingSearch_; |
| - }, |
| -}); |
| + } |
| +}; |