| 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 40b790e308017c4d9c6806bd5fd327da9881e756..0507a7eb64f8248b12f35701e0d2a9ebfded7688 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,12 @@ Polymer({
|
| cr.ui.decorate('command', cr.ui.Command);
|
| document.addEventListener('canExecute', this.onCanExecute_.bind(this));
|
| document.addEventListener('command', this.onCommand_.bind(this));
|
| +
|
| + // Redirect legacy search URLs to URLs compatible with material history.
|
| + if (window.location.hash) {
|
| + window.location.href = window.location.href.split('#')[0] + '?' +
|
| + window.location.hash.substr(1);
|
| + }
|
| },
|
|
|
| /** @private */
|
| @@ -139,6 +153,23 @@ Polymer({
|
| },
|
|
|
| /**
|
| + * @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 || '');
|
| + },
|
| +
|
| + /**
|
| * @param {Event} e
|
| * @private
|
| */
|
|
|