OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 cr.define('options', function() { | 5 cr.define('options', function() { |
6 /** @const */ var SettingsDialog = options.SettingsDialog; | 6 /** @const */ var SettingsDialog = options.SettingsDialog; |
7 | 7 |
8 /** | 8 /** |
9 * A dialog that will pop up when the user attempts to set the value of the | 9 * A dialog that will pop up when the user attempts to set the value of the |
10 * Boolean |pref| to |true|, asking for confirmation. If the user clicks OK, | 10 * Boolean |pref| to |true|, asking for confirmation. If the user clicks OK, |
11 * the new value is committed to Chrome. If the user clicks Cancel or leaves | 11 * the new value is committed to Chrome. If the user clicks Cancel or leaves |
12 * the settings page, the new value is discarded. | 12 * the settings page, the new value is discarded. |
13 * @constructor | 13 * @constructor |
14 * @param {string} name See Page constructor. | 14 * @param {string} name See Page constructor. |
15 * @param {string} title See Page constructor. | 15 * @param {string} title See Page constructor. |
16 * @param {string} pageDivName See Page constructor. | 16 * @param {string} pageDivName See Page constructor. |
17 * @param {HTMLInputElement} okButton The confirmation button element. | 17 * @param {HTMLInputElement} okButton The confirmation button element. |
18 * @param {HTMLInputElement} cancelButton The cancellation button element. | 18 * @param {HTMLInputElement} cancelButton The cancellation button element. |
19 * @param {string} pref The pref that requires confirmation. | 19 * @param {string} pref The pref that requires confirmation. |
20 * @param {string} metric User metrics identifier. | 20 * @param {string} metric User metrics identifier. |
21 * @param {string} confirmed_pref A pref used to remember whether the user has | 21 * @param {string} confirmed_pref A pref used to remember whether the user has |
22 * confirmed the dialog before. This ensures that the user is presented | 22 * confirmed the dialog before. This ensures that the user is presented |
23 * with the dialog only once. If left |undefined| or |null|, the dialog | 23 * with the dialog only once. If left |undefined| or |null|, the dialog |
24 * will pop up every time the user attempts to set |pref| to |true|. | 24 * will pop up every time the user attempts to set |pref| to |true|. |
25 * @extends {SettingsDialog} | 25 * @extends {options.SettingsDialog} |
26 */ | 26 */ |
27 function ConfirmDialog(name, title, pageDivName, okButton, cancelButton, pref, | 27 function ConfirmDialog(name, title, pageDivName, okButton, cancelButton, pref, |
28 metric, confirmed_pref) { | 28 metric, confirmed_pref) { |
29 SettingsDialog.call(this, name, title, pageDivName, okButton, cancelButton); | 29 SettingsDialog.call(this, name, title, pageDivName, okButton, cancelButton); |
30 this.pref = pref; | 30 this.pref = pref; |
31 this.metric = metric; | 31 this.metric = metric; |
32 this.confirmed_pref = confirmed_pref; | 32 this.confirmed_pref = confirmed_pref; |
33 this.confirmed_ = false; | 33 this.confirmed_ = false; |
34 } | 34 } |
35 | 35 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 willHidePage: function() { | 110 willHidePage: function() { |
111 if (this.visible) | 111 if (this.visible) |
112 Preferences.getInstance().rollbackPref(this.pref); | 112 Preferences.getInstance().rollbackPref(this.pref); |
113 }, | 113 }, |
114 }; | 114 }; |
115 | 115 |
116 return { | 116 return { |
117 ConfirmDialog: ConfirmDialog | 117 ConfirmDialog: ConfirmDialog |
118 }; | 118 }; |
119 }); | 119 }); |
OLD | NEW |