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

Unified Diff: chrome/browser/resources/md_downloads/toolbar.js

Issue 2060023002: WebUI: cr-search-field: Remove delegation pattern, use simple event instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@search_box0
Patch Set: Address comments, fix compilation. Created 4 years, 6 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_downloads/toolbar.js
diff --git a/chrome/browser/resources/md_downloads/toolbar.js b/chrome/browser/resources/md_downloads/toolbar.js
index c23364b3a9fcb446d468ea8711be89a81473d5ce..898c1b90c0dea82dd74614af05a3351138305fae 100644
--- a/chrome/browser/resources/md_downloads/toolbar.js
+++ b/chrome/browser/resources/md_downloads/toolbar.js
@@ -9,10 +9,6 @@ cr.define('downloads', function() {
attached: function() {
// isRTL() only works after i18n_template.js runs to set <html dir>.
this.overflowAlign_ = isRTL() ? 'left' : 'right';
-
- /** @private {!SearchFieldDelegate} */
- this.searchFieldDelegate_ = new ToolbarSearchFieldDelegate(this);
- this.$['search-input'].setDelegate(this.searchFieldDelegate_);
},
properties: {
@@ -54,9 +50,13 @@ cr.define('downloads', function() {
this.updateClearAll_();
},
- /** @param {string} searchTerm */
- onSearchTermSearch: function(searchTerm) {
- downloads.ActionService.getInstance().search(searchTerm);
+ /**
+ * @param {!CustomEvent} event
+ * @private
+ */
+ onSearchChanged_: function(event) {
+ downloads.ActionService.getInstance().search(
+ /** @type {string} */ (event.detail));
this.updateClearAll_();
},
@@ -72,24 +72,6 @@ cr.define('downloads', function() {
},
});
- /**
- * @constructor
- * @implements {SearchFieldDelegate}
- */
- // TODO(devlin): This is a bit excessive, and it would be better to just have
- // Toolbar implement SearchFieldDelegate. But for now, we don't know how to
- // make that happen with closure compiler.
- function ToolbarSearchFieldDelegate(toolbar) {
- this.toolbar_ = toolbar;
- }
-
- ToolbarSearchFieldDelegate.prototype = {
- /** @override */
- onSearchTermSearch: function(searchTerm) {
- this.toolbar_.onSearchTermSearch(searchTerm);
- }
- };
-
return {Toolbar: Toolbar};
});

Powered by Google App Engine
This is Rietveld 408576698