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(this, |
22 'hotwordConfim', // name | 22 'hotwordConfim', // name |
23 loadTimeData.getString('hotwordConfirmOverlayTabTitle'), | 23 loadTimeData.getString('hotwordConfirmOverlayTabTitle'), |
24 'hotword-confirm-overlay', // pageDivName | 24 'hotword-confirm-overlay', // pageDivName |
25 $('hotword-confirm-ok'), // okButton | 25 assertInstanceof($('hotword-confirm-ok'), HTMLButtonElement), |
26 $('hotword-confirm-cancel'), // cancelButton | 26 assertInstanceof($('hotword-confirm-cancel'), HTMLButtonElement), |
27 $('hotword-search-enable')['pref'], // pref | 27 $('hotword-search-enable')['pref'], // pref |
28 $('hotword-search-enable')['metric']); // metric | 28 $('hotword-search-enable')['metric']); // metric |
29 | 29 |
30 this.indicator = $('hotword-search-setting-indicator'); | 30 this.indicator = $('hotword-search-setting-indicator'); |
31 } | 31 } |
32 | 32 |
33 HotwordConfirmDialog.prototype = { | 33 HotwordConfirmDialog.prototype = { |
34 // TODO(dbeam): this class should probably derive SettingsDialog again as it | 34 // TODO(dbeam): this class should probably derive SettingsDialog again as it |
35 // evily duplicates much of ConfirmDialog's functionality, calls methods | 35 // evily duplicates much of ConfirmDialog's functionality, calls methods |
36 // on SettingsDialog.prototype, and shadows private method names. | 36 // on SettingsDialog.prototype, and shadows private method names. |
37 __proto__: ConfirmDialog.prototype, | 37 __proto__: ConfirmDialog.prototype, |
38 | 38 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 this.cancelButton.onclick = this.handleCancel.bind(this); | 72 this.cancelButton.onclick = this.handleCancel.bind(this); |
73 Preferences.getInstance().addEventListener( | 73 Preferences.getInstance().addEventListener( |
74 this.pref, this.onPrefChanged_.bind(this)); | 74 this.pref, this.onPrefChanged_.bind(this)); |
75 } | 75 } |
76 }; | 76 }; |
77 | 77 |
78 return { | 78 return { |
79 HotwordConfirmDialog: HotwordConfirmDialog | 79 HotwordConfirmDialog: HotwordConfirmDialog |
80 }; | 80 }; |
81 }); | 81 }); |
OLD | NEW |