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

Unified Diff: ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.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: ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js
diff --git a/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js b/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js
index a19adc25e0885fddc4848de0badadf5d21236d6d..54374f59b77513455d182eed18fa3cde873b13a5 100644
--- a/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js
+++ b/ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js
@@ -2,16 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-/** @interface */
-var SearchFieldDelegate = function() {};
-
-SearchFieldDelegate.prototype = {
- /**
- * @param {string} value
- */
- onSearchTermSearch: assertNotReached,
-};
-
/**
* Implements an incremental search field which can be shown and hidden.
* Canonical implementation is <cr-search-field>.
@@ -64,11 +54,6 @@ var CrSearchFieldBehavior = {
this.hasSearchText = value != '';
},
- /** @param {SearchFieldDelegate} delegate */
- setDelegate: function(delegate) {
- this.delegate_ = delegate;
- },
-
showAndFocus: function() {
this.showingSearch = true;
this.focus_();
@@ -85,8 +70,7 @@ var CrSearchFieldBehavior = {
return;
this.hasSearchText = newValue != '';
- if (this.delegate_)
- this.delegate_.onSearchTermSearch(newValue);
+ this.fire('search-changed', newValue);
this.lastValue_ = newValue;
},

Powered by Google App Engine
This is Rietveld 408576698