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

Unified Diff: chrome/browser/resources/settings/controls/settings_boolean_control_behavior.js

Issue 2691223002: Revert of MD Settings: Fix the Network Prediction toggle box. (Closed)
Patch Set: Created 3 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 | « no previous file | chrome/browser/resources/settings/privacy_page/privacy_page.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/settings/controls/settings_boolean_control_behavior.js
diff --git a/chrome/browser/resources/settings/controls/settings_boolean_control_behavior.js b/chrome/browser/resources/settings/controls/settings_boolean_control_behavior.js
index 652e39f8727edacccebf888c182ecab9ca679b0b..d15e3eb48f89f815c66809f0a8a898369fbe38e8 100644
--- a/chrome/browser/resources/settings/controls/settings_boolean_control_behavior.js
+++ b/chrome/browser/resources/settings/controls/settings_boolean_control_behavior.js
@@ -55,17 +55,6 @@
type: String,
value: '',
},
-
- /**
- * For numeric prefs only, the integer value equivalent to the unchecked
- * state. This is the value sent to prefs if the user unchecks the control.
- * During initialization, the control is unchecked if and only if the pref
- * value is equal to the this value. (Values 2, 3, 4, etc. all are checked.)
- */
- numericUncheckedValue: {
- type: Number,
- value: 0,
- }
},
observers: [
@@ -79,13 +68,14 @@
/** Update the pref to the current |checked| value. */
sendPrefChange: function() {
+ /** @type {boolean} */ var newValue = this.getNewValue_(this.checked);
// Ensure that newValue is the correct type for the pref type, either
// a boolean or a number.
if (this.pref.type == chrome.settingsPrivate.PrefType.NUMBER) {
- this.set('pref.value', this.checked ? 1 : this.numericUncheckedValue);
+ this.set('pref.value', newValue ? 1 : 0);
return;
}
- this.set('pref.value', this.checked);
+ this.set('pref.value', newValue);
},
/**
@@ -113,11 +103,6 @@
* @private
*/
getNewValue_: function(value) {
- // For numeric prefs, the control is only false if the value is exactly
- // equal to the unchecked-equivalent value.
- if (this.pref.type == chrome.settingsPrivate.PrefType.NUMBER)
- value = value != this.numericUncheckedValue;
-
return this.inverted ? !value : !!value;
},
« no previous file with comments | « no previous file | chrome/browser/resources/settings/privacy_page/privacy_page.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698