Chromium Code Reviews| Index: chrome/browser/resources/md_history/app.js |
| diff --git a/chrome/browser/resources/md_history/app.js b/chrome/browser/resources/md_history/app.js |
| index a4f6370dd897f844bcf1fe1d3f866c0075467ba4..fad5e96f214b78f14f22cb3abd3fc95ae688ef26 100644 |
| --- a/chrome/browser/resources/md_history/app.js |
| +++ b/chrome/browser/resources/md_history/app.js |
| @@ -47,12 +47,20 @@ Polymer({ |
| // Route data for the current page. |
| routeData_: Object, |
| + |
| + // The query params for the page. |
| + queryParams_: Object, |
| }, |
| observers: [ |
| // routeData_.page <=> selectedPage |
| 'routeDataChanged_(routeData_.page)', |
| 'selectedPageChanged_(selectedPage_)', |
| + |
| + // queryParams_.q <=> queryState.searchTerm |
| + 'searchTermChanged_(queryState_.searchTerm)', |
| + 'searchQueryParamChanged_(queryParams_.q)', |
| + |
| ], |
| // TODO(calamity): Replace these event listeners with data bound properties. |
| @@ -71,6 +79,11 @@ Polymer({ |
| cr.ui.decorate('command', cr.ui.Command); |
| document.addEventListener('canExecute', this.onCanExecute_.bind(this)); |
| document.addEventListener('command', this.onCommand_.bind(this)); |
| + |
| + if (window.location.hash) { |
|
tsergeant
2016/07/19 03:32:20
Should have a comment here explaining this.
calamity
2016/07/19 04:35:33
Done.
|
| + window.location.href = window.location.href.split('#')[0] + '?' + |
| + window.location.hash.substr(1); |
| + } |
| }, |
| /** @private */ |
| @@ -129,6 +142,24 @@ Polymer({ |
| */ |
| onCanExecute_: function(e) { |
| e.canExecute = true; |
| + |
|
tsergeant
2016/07/19 03:32:20
Nit: Undo this
calamity
2016/07/19 04:35:33
Done.
|
| + }, |
| + |
| + /** |
| + * @param {string} searchTerm |
| + * @private |
| + */ |
| + searchTermChanged_: function(searchTerm) { |
| + this.set('queryParams_.q', searchTerm || null); |
| + this.$['history'].queryHistory(false); |
| + }, |
| + |
| + /** |
| + * @param {string} searchQuery |
| + * @private |
| + */ |
| + searchQueryParamChanged_: function(searchQuery) { |
| + this.$.toolbar.setSearchTerm(searchQuery || ''); |
| }, |
| /** |