Chromium Code Reviews| 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * 'settings-subpage' shows a subpage beneath a subheader. The header contains | 7 * 'settings-subpage' shows a subpage beneath a subheader. The header contains |
| 8 * the subpage title and a back icon. The back icon fires an event which | 8 * the subpage title and a back icon. The back icon fires an event which |
| 9 * is caught by settings-animated-pages, so it requires no separate handling. | 9 * is caught by settings-animated-pages, so it requires no separate handling. |
| 10 */ | 10 */ |
| 11 | 11 |
| 12 Polymer({ | 12 Polymer({ |
| 13 is: 'settings-subpage', | 13 is: 'settings-subpage-search', |
| 14 | 14 |
| 15 behaviors: [ | 15 behaviors: [CrSearchFieldBehavior], |
| 16 // TODO(michaelpg): phase out NeonAnimatableBehavior. | |
| 17 Polymer.NeonAnimatableBehavior, | |
| 18 Polymer.IronResizableBehavior, | |
| 19 ], | |
| 20 | 16 |
| 21 properties: { | 17 /** @private */ |
| 22 pageTitle: String, | 18 onTapClear_: function() { |
| 19 this.$.searchInput.value = ''; | |
|
dpapad
2016/07/20 19:34:51
Can we avoid having to fire any events manually by
hcarmona
2016/07/20 21:06:07
Done.
| |
| 20 | |
| 21 // Fire events to update the UI. These are fired when the user changes the | |
| 22 // input, but not when value is set. | |
| 23 this.$.searchInput.fire('input'); | |
| 24 this.$.searchInput.fire('search'); | |
| 23 }, | 25 }, |
| 24 | 26 |
| 25 /** @private */ | 27 /** |
| 26 onTapBack_: function() { | 28 * @param {string} lastValue_ |
|
dpapad
2016/07/20 19:34:51
Nit: Parameter names don't usually have underscore
hcarmona
2016/07/20 21:06:07
On second look, this entire method is unnecessary,
| |
| 27 // Event is caught by settings-animated-pages. | 29 * @return {boolean} |
| 28 this.fire('subpage-back'); | 30 */ |
| 31 hasSearchTerm_: function(lastValue_) { | |
| 32 return !!lastValue_; | |
| 29 }, | 33 }, |
| 30 }); | 34 }); |
| OLD | NEW |