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

Unified Diff: ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js

Issue 2449663002: MD Settings: Implement search URLs. (Closed)
Patch Set: Fix test. Created 4 years, 1 month 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/test/data/webui/settings/settings_ui_browsertest.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d87184144f6312a9d830bf2adeda1e446edddfc9..ae1af180ac78f314d7c2f8633d5976e905938263 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
@@ -51,12 +51,14 @@ var CrSearchFieldBehavior = {
/**
* Sets the value of the search field.
* @param {string} value
+ * @param {boolean=} opt_noEvent Whether to prevent a 'search-changed' event
+ * firing for this change.
*/
- setValue: function(value) {
+ setValue: function(value, opt_noEvent) {
// Use bindValue when setting the input value so that changes propagate
// correctly.
this.getSearchInput().bindValue = value;
- this.onValueChanged_(value);
+ this.onValueChanged_(value, !!opt_noEvent);
},
showAndFocus: function() {
@@ -70,21 +72,25 @@ var CrSearchFieldBehavior = {
},
onSearchTermSearch: function() {
- this.onValueChanged_(this.getValue());
+ this.onValueChanged_(this.getValue(), false);
},
/**
* Updates the internal state of the search field based on a change that has
* already happened.
* @param {string} newValue
+ * @param {boolean} noEvent Whether to prevent a 'search-changed' event firing
+ * for this change.
* @private
*/
- onValueChanged_: function(newValue) {
+ onValueChanged_: function(newValue, noEvent) {
if (newValue == this.lastValue_)
return;
this.lastValue_ = newValue;
- this.fire('search-changed', newValue);
+
+ if (!noEvent)
+ this.fire('search-changed', newValue);
},
onSearchTermKeydown: function(e) {
« no previous file with comments | « chrome/test/data/webui/settings/settings_ui_browsertest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698