Chromium Code Reviews| Index: chrome/browser/resources/md_history/history_toolbar.js |
| diff --git a/chrome/browser/resources/md_history/history_toolbar.js b/chrome/browser/resources/md_history/history_toolbar.js |
| index 38b1c12e8c71d2c9fe514f087409b95dce27112b..69427f050c8326d9b7d6e48daa5fe4ee9f4e3a4a 100644 |
| --- a/chrome/browser/resources/md_history/history_toolbar.js |
| +++ b/chrome/browser/resources/md_history/history_toolbar.js |
| @@ -11,12 +11,18 @@ Polymer({ |
| value: 0, |
| observer: 'changeToolbarView_' |
| }, |
| + |
| // True if 1 or more history items are selected. When this value changes |
| // the background colour changes. |
| itemsSelected_: { |
| type: Boolean, |
| value: false, |
| reflectToAttribute: true |
| + }, |
| + |
| + searchTerm: { |
|
calamity
2016/02/05 02:30:10
Comment.
hsampson
2016/02/08 04:40:23
Done.
|
| + type: String, |
| + value: '' |
| } |
| }, |
| @@ -29,7 +35,39 @@ Polymer({ |
| this.itemsSelected_ = this.count != 0; |
| }, |
| + /** |
| + * If the search term has changed reload for the new search. |
| + */ |
| + onSearchTermSearch: function(searchTerm) { |
| + if (searchTerm != this.searchTerm) |
| + this.fire('refresh-results', {search: searchTerm}); |
| + this.searchTerm = searchTerm; |
| + }, |
| + |
| + attached: function() { |
| + this.async(function() { |
|
calamity
2016/02/05 02:30:10
Why async?
hsampson
2016/02/08 04:40:23
Because otherwise this function was being called b
tsergeant
2016/02/08 22:59:01
This -should- be fixed by removing the dom-ifs fro
hsampson
2016/02/09 02:17:51
If the async is removed and you refresh the page w
|
| + this.searchFieldDelegate_ = new ToolbarSearchFieldDelegate(this); |
| + this.$$('#search-input').setDelegate(this.searchFieldDelegate_); |
|
calamity
2016/02/05 02:30:10
I believe this can also become this.$['search-inpu
hsampson
2016/02/08 04:40:23
Done.
|
| + }); |
| + }, |
| + |
| onClearSelectionTap_: function() { |
| this.fire('unselect-all'); |
| } |
| }); |
| + |
| +/** |
| + * @constructor |
| + * @implements {SearchFieldDelegate} |
| + * @param {!Object} toolbar This history-toolbar. |
| + */ |
| +function ToolbarSearchFieldDelegate(toolbar) { |
| + this.toolbar_ = toolbar; |
| +} |
| + |
| +ToolbarSearchFieldDelegate.prototype = { |
| + /** @override */ |
| + onSearchTermSearch: function(searchTerm) { |
| + this.toolbar_.onSearchTermSearch(searchTerm); |
| + } |
| +}; |