OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ConfirmDialog = options.ConfirmDialog; | 6 /** @const */ var ConfirmDialog = options.ConfirmDialog; |
7 /** @const */ var SettingsDialog = options.SettingsDialog; | 7 /** @const */ var SettingsDialog = options.SettingsDialog; |
8 /** @const */ var PageManager = cr.ui.pageManager.PageManager; | 8 /** @const */ var PageManager = cr.ui.pageManager.PageManager; |
9 | 9 |
10 /** | 10 /** |
11 * A dialog that will pop up when the user attempts to set the value of the | 11 * A dialog that will pop up when the user attempts to set the value of the |
12 * Boolean |pref| to |true|, asking for confirmation. It will first check for | 12 * Boolean |pref| to |true|, asking for confirmation. It will first check for |
13 * any errors and if any exist, not display the dialog but toggle the | 13 * any errors and if any exist, not display the dialog but toggle the |
14 * indicator. Like its superclass, if the user clicks OK, the new value is | 14 * indicator. Like its superclass, if the user clicks OK, the new value is |
15 * committed to Chrome. If the user clicks Cancel or leaves the settings page, | 15 * committed to Chrome. If the user clicks Cancel or leaves the settings page, |
16 * the new value is discarded. | 16 * the new value is discarded. |
17 * @constructor | 17 * @constructor |
18 * @extends {options.ConfirmDialog} | 18 * @extends {options.ConfirmDialog} |
19 */ | 19 */ |
20 function HotwordConfirmDialog() { | 20 function HotwordConfirmDialog() { |
21 ConfirmDialog.call(this, | 21 ConfirmDialog.call( |
| 22 this, |
22 'hotwordConfim', // name | 23 'hotwordConfim', // name |
23 loadTimeData.getString('hotwordConfirmOverlayTabTitle'), | 24 loadTimeData.getString('hotwordConfirmOverlayTabTitle'), |
24 'hotword-confirm-overlay', // pageDivName | 25 'hotword-confirm-overlay', // pageDivName |
25 assertInstanceof($('hotword-confirm-ok'), HTMLButtonElement), | 26 assertInstanceof($('hotword-confirm-ok'), HTMLButtonElement), |
26 assertInstanceof($('hotword-confirm-cancel'), HTMLButtonElement), | 27 assertInstanceof($('hotword-confirm-cancel'), HTMLButtonElement), |
27 $('hotword-search-enable')['pref'], // pref | 28 $('hotword-search-enable')['pref'], // pref |
28 $('hotword-search-enable')['metric']); // metric | 29 $('hotword-search-enable')['metric']); // metric |
29 | 30 |
30 this.indicator = $('hotword-search-setting-indicator'); | 31 this.indicator = $('hotword-search-setting-indicator'); |
31 } | 32 } |
32 | 33 |
33 HotwordConfirmDialog.prototype = { | 34 HotwordConfirmDialog.prototype = { |
34 // TODO(dbeam): this class should probably derive SettingsDialog again as it | 35 // TODO(dbeam): this class should probably derive SettingsDialog again as it |
35 // evily duplicates much of ConfirmDialog's functionality, calls methods | 36 // evily duplicates much of ConfirmDialog's functionality, calls methods |
36 // on SettingsDialog.prototype, and shadows private method names. | 37 // on SettingsDialog.prototype, and shadows private method names. |
37 __proto__: ConfirmDialog.prototype, | 38 __proto__: ConfirmDialog.prototype, |
38 | 39 |
(...skipping 29 matching lines...) Expand all Loading... |
68 initializePage: function() { | 69 initializePage: function() { |
69 SettingsDialog.prototype.initializePage.call(this); | 70 SettingsDialog.prototype.initializePage.call(this); |
70 | 71 |
71 this.okButton.onclick = this.handleConfirm.bind(this); | 72 this.okButton.onclick = this.handleConfirm.bind(this); |
72 this.cancelButton.onclick = this.handleCancel.bind(this); | 73 this.cancelButton.onclick = this.handleCancel.bind(this); |
73 Preferences.getInstance().addEventListener( | 74 Preferences.getInstance().addEventListener( |
74 this.pref, this.onPrefChanged_.bind(this)); | 75 this.pref, this.onPrefChanged_.bind(this)); |
75 } | 76 } |
76 }; | 77 }; |
77 | 78 |
78 return { | 79 return {HotwordConfirmDialog: HotwordConfirmDialog}; |
79 HotwordConfirmDialog: HotwordConfirmDialog | |
80 }; | |
81 }); | 80 }); |
OLD | NEW |