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

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

Issue 215423002: [Hotword] Make ConfirmDialog subclass from SettingsDialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some more cleanup Created 6 years, 9 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
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 acf34e6db02ff13668b68e999f1b897bff62d7e1..85cc41085d41e05b5e2432075a833df87d68cb6c 100644
--- a/chrome/browser/resources/options/confirm_dialog.js
+++ b/chrome/browser/resources/options/confirm_dialog.js
@@ -3,7 +3,7 @@
// found in the LICENSE file.
cr.define('options', function() {
- /** @const */ var OptionsPage = options.OptionsPage;
+ /** @const */ var SettingsDialog = options.SettingsDialog;
/**
* A dialog that will pop up when the user attempts to set the value of the
@@ -22,13 +22,11 @@ cr.define('options', function() {
* confirmed the dialog before. This ensures that the user is presented
* with the dialog only once. If left |undefined| or |null|, the dialog
* will pop up every time the user attempts to set |pref| to |true|.
- * @extends {OptionsPage}
+ * @extends {SettingsDialog}
*/
function ConfirmDialog(name, title, pageDivName, okButton, cancelButton, pref,
metric, confirmed_pref) {
- OptionsPage.call(this, name, title, pageDivName);
- this.okButton = okButton;
- this.cancelButton = cancelButton;
+ SettingsDialog.call(this, name, title, pageDivName, okButton, cancelButton);
this.pref = pref;
this.metric = metric;
this.confirmed_pref = confirmed_pref;
@@ -37,7 +35,7 @@ cr.define('options', function() {
ConfirmDialog.prototype = {
// Set up the prototype chain
- __proto__: OptionsPage.prototype,
+ __proto__: SettingsDialog.prototype,
/**
* Handle changes to |pref|. Only uncommitted changes are relevant as these
@@ -68,6 +66,8 @@ cr.define('options', function() {
/** @override */
initializePage: function() {
+ SettingsDialog.prototype.initializePage.call(this);
+
this.okButton.onclick = this.handleConfirm.bind(this);
this.cancelButton.onclick = this.handleCancel.bind(this);
Preferences.getInstance().addEventListener(
@@ -82,23 +82,24 @@ cr.define('options', function() {
* Handle the confirm button by committing the |pref| change. If
* |confirmed_pref| has been specified, also remember that the dialog has
* been confirmed to avoid bringing it up in the future.
+ * @override
*/
handleConfirm: function() {
- OptionsPage.closeOverlay();
-
Preferences.getInstance().commitPref(this.pref, this.metric);
if (this.confirmed_pref)
Preferences.setBooleanPref(this.confirmed_pref, true, true);
+
+ SettingsDialog.prototype.handleConfirm.call(this);
Dan Beam 2014/03/27 21:06:43 ^ why is this at the bottom?
rpetterson 2014/03/27 21:26:00 Done. To answer your question, the thought was th
},
/**
* Handle the cancel button by rolling back the |pref| change without it
* ever taking effect.
+ * @override
*/
handleCancel: function() {
- OptionsPage.closeOverlay();
-
Preferences.getInstance().rollbackPref(this.pref);
+ SettingsDialog.prototype.handleCancel.call(this);
Dan Beam 2014/03/27 21:06:43 same
rpetterson 2014/03/27 21:26:00 Done.
},
/**

Powered by Google App Engine
This is Rietveld 408576698