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

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: Fix commenting. Created 4 years, 11 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
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);
+ }
+};

Powered by Google App Engine
This is Rietveld 408576698