Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: chrome/browser/resources/md_history/app.js

Issue 2068613002: [MD History] Add URL parameter for search. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@routing
Patch Set: remove_var Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/md_history/app.html ('k') | chrome/browser/resources/md_history/list_container.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
*/
« no previous file with comments | « chrome/browser/resources/md_history/app.html ('k') | chrome/browser/resources/md_history/list_container.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698