Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 Polymer({ | |
| 6 is: 'cr-toolbar-search-field', | |
| 7 | |
| 8 behaviors: [CrSearchFieldBehavior], | |
| 9 | |
| 10 properties: { | |
| 11 narrow: { | |
| 12 type: Boolean, | |
| 13 reflectToAttribute: true, | |
| 14 }, | |
| 15 // Prompt text to display in the search field. | |
| 16 label: String, | |
| 17 // Tooltip to display on the clear search button. | |
| 18 clearLabel: String, | |
| 19 }, | |
| 20 | |
| 21 listeners: { | |
| 22 'tap': 'showSearch_', | |
| 23 'clearSearch.tap': 'hideSearch_', | |
| 24 'searchInput.blur': 'onInputBlur_' | |
| 25 }, | |
| 26 | |
| 27 /** @private */ | |
| 28 onInputBlur_: function() { | |
| 29 if (!this.hasSearchText_) | |
|
dpapad
2016/05/25 01:20:10
The underscore at the end of hasSearchText_ implie
tsergeant
2016/05/25 07:01:30
Done, made public.
| |
| 30 this.showingSearch = false; | |
| 31 }, | |
| 32 | |
| 33 /** | |
| 34 * @param {Event} e | |
| 35 * @private | |
| 36 */ | |
| 37 showSearch_: function(e) { | |
| 38 if (e.target != this.$.clearSearch) | |
| 39 this.showingSearch = true; | |
| 40 }, | |
| 41 | |
| 42 /** | |
| 43 * @param {Event} e | |
| 44 * @private | |
| 45 */ | |
| 46 hideSearch_: function(e) { | |
| 47 this.showingSearch = false; | |
| 48 e.stopPropagation(); | |
| 49 } | |
| 50 }); | |
| OLD | NEW |