Chromium Code Reviews| 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 showResetProfileDialog_: Boolean, | |
| 23 | |
| 22 allowPowerwash_: { | 24 allowPowerwash_: { |
| 23 type: Boolean, | 25 type: Boolean, |
| 24 value: cr.isChromeOS ? loadTimeData.getBoolean('allowPowerwash') : false | 26 value: cr.isChromeOS ? loadTimeData.getBoolean('allowPowerwash') : false |
| 25 }, | 27 }, |
| 26 }, | 28 }, |
| 27 | 29 |
| 28 /** @private */ | 30 /** @private */ |
| 29 onShowResetProfileDialog_: function() { | 31 onShowResetProfileDialog_: function() { |
| 30 this.showDialog_('settings-reset-profile-dialog'); | 32 this.showResetProfileDialog_ = true; |
| 33 this.async(function() { | |
| 34 this.$$('settings-reset-profile-dialog').open(); | |
|
Dan Beam
2016/09/15 21:15:40
wait, why is this better than the original code?
| |
| 35 }.bind(this)); | |
| 31 }, | 36 }, |
| 32 | 37 |
| 33 /** @private */ | 38 /** @private */ |
| 34 onShowPowerwashDialog_: function() { | 39 onShowPowerwashDialog_: function() { |
| 35 this.showDialog_('settings-powerwash-dialog'); | 40 this.showDialog_('settings-powerwash-dialog'); |
|
Dan Beam
2016/09/15 21:15:40
this is only used once now
dpapad
2016/09/20 00:52:36
Removed. Using the DOM to construct the dialog, in
| |
| 36 }, | 41 }, |
| 37 | 42 |
| 38 | 43 |
|
Dan Beam
2016/09/15 21:15:40
\n\n -> \n
dpapad
2016/09/20 00:52:36
Removed.
| |
| 39 /** | 44 /** |
| 40 * Creates and shows the specified dialog. | 45 * Creates and shows the specified dialog. |
| 41 * @param {string} dialogName | 46 * @param {string} dialogName |
| 42 * @private | 47 * @private |
| 43 */ | 48 */ |
| 44 showDialog_: function(dialogName) { | 49 showDialog_: function(dialogName) { |
| 45 var dialog = document.createElement(dialogName); | 50 var dialog = document.createElement(dialogName); |
| 46 this.shadowRoot.appendChild(dialog); | 51 this.shadowRoot.appendChild(dialog); |
| 47 dialog.open(); | 52 dialog.open(); |
| 48 | 53 |
| 49 dialog.addEventListener('close', function() { | 54 dialog.addEventListener('close', function() { |
| 50 dialog.remove(); | 55 dialog.remove(); |
| 51 }); | 56 }); |
| 52 }, | 57 }, |
| 53 }); | 58 }); |
| OLD | NEW |