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

Unified Diff: chrome/browser/resources/options/confirm_dialog.js

Issue 1984603002: Allow ConfirmDialog to confirm disabling options. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated true/false/undefined logic Created 4 years, 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c70c338b7ae47f7414948b7e63dd85235d121385 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,9 @@ cr.define('options', function() {
/** @private */
this.confirmed_ = false;
+
+ /** @private */
+ this.confirmValue_ = opt_confirmValue === false ? false : true;
}
ConfirmDialog.prototype = {
@@ -57,7 +63,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 +103,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);
},
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698