| 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
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..aac426820c43e00e97956025673933bea7ae198f
|
| --- /dev/null
|
| +++ b/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js
|
| @@ -0,0 +1,51 @@
|
| +// 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.
|
| +
|
| +// TODO(tsergeant): Add tests for cr-toolbar-search-field.
|
| +Polymer({
|
| + is: 'cr-toolbar-search-field',
|
| +
|
| + behaviors: [CrSearchFieldBehavior],
|
| +
|
| + properties: {
|
| + narrow: {
|
| + type: Boolean,
|
| + reflectToAttribute: true,
|
| + },
|
| +
|
| + // Prompt text to display in the search field.
|
| + label: String,
|
| +
|
| + // Tooltip to display on the clear search button.
|
| + clearLabel: String,
|
| + },
|
| +
|
| + listeners: {
|
| + 'tap': 'showSearch_',
|
| + },
|
| +
|
| + /** @private */
|
| + onInputBlur_: function() {
|
| + if (!this.hasSearchText)
|
| + this.showingSearch = false;
|
| + },
|
| +
|
| + /**
|
| + * @param {Event} e
|
| + * @private
|
| + */
|
| + showSearch_: function(e) {
|
| + if (e.target != this.$.clearSearch)
|
| + this.showingSearch = true;
|
| + },
|
| +
|
| + /**
|
| + * @param {Event} e
|
| + * @private
|
| + */
|
| + hideSearch_: function(e) {
|
| + this.showingSearch = false;
|
| + e.stopPropagation();
|
| + }
|
| +});
|
|
|