| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * 'settings-reset-page' is the settings page containing reset | 7 * 'settings-reset-page' is the settings page containing reset |
| 8 * settings. | 8 * settings. |
| 9 * | 9 * |
| 10 * Example: | 10 * Example: |
| 11 * | 11 * |
| 12 * <iron-animated-pages> | 12 * <iron-animated-pages> |
| 13 * <settings-reset-page prefs="{{prefs}}"> | 13 * <settings-reset-page prefs="{{prefs}}"> |
| 14 * </settings-reset-page> | 14 * </settings-reset-page> |
| 15 * ... other pages ... | 15 * ... other pages ... |
| 16 * </iron-animated-pages> | 16 * </iron-animated-pages> |
| 17 */ | 17 */ |
| 18 Polymer({ | 18 Polymer({ |
| 19 is: 'settings-reset-page', | 19 is: 'settings-reset-page', |
| 20 | 20 |
| 21 properties: { | 21 properties: { |
| 22 <if expr="chromeos"> |
| 23 /** @private */ |
| 24 showPowerwashDialog_: Boolean, |
| 25 </if> |
| 26 |
| 27 /** @private */ |
| 22 allowPowerwash_: { | 28 allowPowerwash_: { |
| 23 type: Boolean, | 29 type: Boolean, |
| 24 value: cr.isChromeOS ? loadTimeData.getBoolean('allowPowerwash') : false | 30 value: cr.isChromeOS ? loadTimeData.getBoolean('allowPowerwash') : false |
| 25 }, | 31 }, |
| 26 }, | 32 }, |
| 27 | 33 |
| 28 /** @private */ | 34 /** @private */ |
| 29 onShowResetProfileDialog_: function() { | 35 onShowResetProfileDialog_: function() { |
| 30 this.showDialog_('settings-reset-profile-dialog'); | 36 this.$.resetProfileDialog.get().open(); |
| 37 }, |
| 38 |
| 39 <if expr="chromeos"> |
| 40 /** @private */ |
| 41 onShowPowerwashDialog_: function() { |
| 42 this.showPowerwashDialog_ = true; |
| 31 }, | 43 }, |
| 32 | 44 |
| 33 /** @private */ | 45 /** @private */ |
| 34 onShowPowerwashDialog_: function() { | 46 onPowerwashDialogClose_: function() { |
| 35 this.showDialog_('settings-powerwash-dialog'); | 47 this.showPowerwashDialog_ = false; |
| 36 }, | 48 }, |
| 37 | 49 </if> |
| 38 | |
| 39 /** | |
| 40 * Creates and shows the specified dialog. | |
| 41 * @param {string} dialogName | |
| 42 * @private | |
| 43 */ | |
| 44 showDialog_: function(dialogName) { | |
| 45 var dialog = document.createElement(dialogName); | |
| 46 this.shadowRoot.appendChild(dialog); | |
| 47 dialog.open(); | |
| 48 | |
| 49 dialog.addEventListener('close', function() { | |
| 50 dialog.remove(); | |
| 51 }); | |
| 52 }, | |
| 53 }); | 50 }); |
| OLD | NEW |