Chromium Code Reviews| Index: chrome/browser/resources/options/confirm_dialog.js |
| diff --git a/chrome/browser/resources/options/confirm_dialog.js b/chrome/browser/resources/options/confirm_dialog.js |
| index bb9bd4e786caf94738210bf154e061e9d7b4f2c2..d9f3f4d9f5c8f2fe2710b2c8a6b37e840bb73dd0 100644 |
| --- a/chrome/browser/resources/options/confirm_dialog.js |
| +++ b/chrome/browser/resources/options/confirm_dialog.js |
| @@ -22,10 +22,13 @@ cr.define('options', function() { |
| * user has confirmed the dialog before. This ensures that the user is |
| * presented with the dialog only once. If left |undefined|, the dialog |
| * will pop up every time the user attempts to set |pref| to |true|. |
| + * @param {boolean=} opt_confirmValue The value to which changing should |
| + * trigger the confirmation dialog. Defaults to |true| if left |
| + * |undefined|. |
| * @extends {options.SettingsDialog} |
| */ |
| function ConfirmDialog(name, title, pageDivName, okButton, cancelButton, pref, |
| - metric, opt_confirmedPref) { |
| + metric, opt_confirmedPref, opt_confirmValue) { |
| SettingsDialog.call(this, name, title, pageDivName, okButton, cancelButton); |
| /** @protected */ |
| @@ -39,6 +42,10 @@ cr.define('options', function() { |
| /** @private */ |
| this.confirmed_ = false; |
| + |
| + /** @private */ |
| + this.confirmValue_ = opt_confirmValue == undefined || |
|
dpapad
2016/05/17 17:37:12
"null == undefined" VS "null === undefined" behavi
|
| + Boolean(opt_confirmValue); |
| } |
| ConfirmDialog.prototype = { |
| @@ -57,7 +64,7 @@ cr.define('options', function() { |
| if (!event.value.uncommitted) |
| return; |
| - if (event.value.value && !this.confirmed_) |
| + if (event.value.value == this.confirmValue_ && !this.confirmed_) |
| PageManager.showPageByName(this.name, false); |
| else |
| Preferences.getInstance().commitPref(this.pref, this.metric); |
| @@ -97,7 +104,8 @@ cr.define('options', function() { |
| Preferences.getInstance().commitPref(this.pref, this.metric); |
| if (this.confirmedPref_) |
| - Preferences.setBooleanPref(this.confirmedPref_, true, true); |
| + Preferences.setBooleanPref( |
| + this.confirmedPref_, this.confirmValue_, true); |
| }, |
| /** |