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

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: 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..8c547eee989e58afec8440565024f3d21ef028f2 100644
--- a/chrome/browser/resources/options/confirm_dialog.js
+++ b/chrome/browser/resources/options/confirm_dialog.js
@@ -22,10 +22,12 @@ 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
dpapad 2016/05/16 17:09:53 The naming of this param suggests that it is optio
dspaid 2016/05/16 23:33:22 Done.
+ * trigger the confirmation dialog. Defaults to |true| if left |undefined|.
stevenjb 2016/05/16 16:19:48 indent
dspaid 2016/05/16 23:33:22 Done.
* @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 +41,10 @@ cr.define('options', function() {
/** @private */
this.confirmed_ = false;
+
+ /** @private */
+ this.confirmValue_ = opt_confirmValue === undefined ||
dpapad 2016/05/16 17:09:53 This logic is fragile. In almost all JS APIs I hav
dspaid 2016/05/16 23:33:22 Good point. changing === to == should also do the
+ Boolean(opt_confirmValue);
}
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);
dpapad 2016/05/16 17:09:53 Underscore missing! This is not referring to the m
dspaid 2016/05/16 23:33:22 Done. Oddly enough the compiler didn't seem to com
},
/**
« 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