| 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 * @group Chrome Settings Elements | 18 * @group Chrome Settings Elements |
| 19 * @element settings-reset-page | 19 * @element settings-reset-page |
| 20 */ | 20 */ |
| 21 Polymer({ | 21 Polymer({ |
| 22 is: 'settings-reset-page', | 22 is: 'settings-reset-page', |
| 23 | 23 |
| 24 properties: { | |
| 25 feedbackInfo_: String, | |
| 26 }, | |
| 27 | |
| 28 attached: function() { | |
| 29 cr.define('SettingsResetPage', function() { | |
| 30 return { | |
| 31 doneResetting: function() { | |
| 32 this.$.resetSpinner.active = false; | |
| 33 this.$.resetDialog.close(); | |
| 34 }.bind(this), | |
| 35 | |
| 36 setFeedbackInfo: function(data) { | |
| 37 this.set('feedbackInfo_', data.feedbackInfo); | |
| 38 this.async(function() { | |
| 39 this.$.resetDialog.center(); | |
| 40 }); | |
| 41 }.bind(this), | |
| 42 }; | |
| 43 }.bind(this)); | |
| 44 }, | |
| 45 | 24 |
| 46 /** @private */ | 25 /** @private */ |
| 47 onShowDialog_: function() { | 26 onShowDialog_: function() { |
| 48 this.$.resetDialog.open(); | 27 var dialog = document.createElement('settings-reset-profile-dialog'); |
| 49 chrome.send('onShowResetProfileDialog'); | 28 this.shadowRoot.appendChild(dialog); |
| 29 dialog.open(); |
| 30 |
| 31 dialog.addEventListener('iron-overlay-closed', function(event) { |
| 32 dialog.remove(); |
| 33 }); |
| 50 }, | 34 }, |
| 51 | |
| 52 /** @private */ | |
| 53 onCancelTap_: function() { | |
| 54 this.$.resetDialog.close(); | |
| 55 chrome.send('onHideResetProfileDialog'); | |
| 56 }, | |
| 57 | |
| 58 /** @private */ | |
| 59 onResetTap_: function() { | |
| 60 this.$.resetSpinner.active = true; | |
| 61 chrome.send('performResetProfileSettings', [this.$.sendSettings.checked]); | |
| 62 }, | |
| 63 | |
| 64 /** @private */ | |
| 65 onLearnMoreTap_: function() { | |
| 66 window.open(loadTimeData.getString('resetPageLearnMoreUrl')); | |
| 67 }, | |
| 68 | |
| 69 /** @private */ | |
| 70 onSendSettingsChange_: function() { | |
| 71 // TODO(dpapad): Update how settings info is surfaced when final mocks | |
| 72 // exist. | |
| 73 this.$.settings.hidden = !this.$.sendSettings.checked; | |
| 74 this.$.resetDialog.center(); | |
| 75 } | |
| 76 }); | 35 }); |
| OLD | NEW |