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

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

Issue 1643693003: MD History: Implement search functionality. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@patch_to_be_uploaded
Patch Set: Rebase and address reviewer comments. Created 4 years, 10 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/history_list.js ('k') | chrome/browser/ui/webui/md_history_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 26c04afadc89bb6b02130e6f7ca2fae0d81e82d6..6bb4169c5c3caaaf39cb1d4752b2ceedb807ac9e 100644
--- a/chrome/browser/resources/md_history/history_toolbar.js
+++ b/chrome/browser/resources/md_history/history_toolbar.js
@@ -11,12 +11,20 @@ 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
+ },
+
+ // The search term associated with the current results shown. Also used to
+ // determine whether results need to be refreshed (i.e. if it changes).
+ searchTerm: {
+ type: String,
+ value: ''
}
},
@@ -29,6 +37,22 @@ 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() {
+ this.searchFieldDelegate_ = new ToolbarSearchFieldDelegate(this);
+ this.$['search-input'].setDelegate(this.searchFieldDelegate_);
+ });
+ },
+
onClearSelectionTap_: function() {
this.fire('unselect-all');
},
@@ -57,3 +81,19 @@ Polymer({
return count > 0 ? loadTimeData.getStringF('itemsSelected', count) : '';
}
});
+
+/**
+ * @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);
+ }
+};
« no previous file with comments | « chrome/browser/resources/md_history/history_list.js ('k') | chrome/browser/ui/webui/md_history_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698