| 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-profile-dialog' is the dialog shown for clearing profile | 7 * 'settings-reset-profile-dialog' is the dialog shown for clearing profile |
| 8 * settings. | 8 * settings. |
| 9 * | 9 * |
| 10 * @group Chrome Settings Elements | 10 * @group Chrome Settings Elements |
| 11 * @element settings-reset-profile-dialog | 11 * @element settings-reset-profile-dialog |
| 12 */ | 12 */ |
| 13 Polymer({ | 13 Polymer({ |
| 14 is: 'settings-reset-profile-dialog', | 14 is: 'settings-reset-profile-dialog', |
| 15 | 15 |
| 16 properties: { | 16 properties: { |
| 17 feedbackInfo_: String, | 17 feedbackInfo_: String, |
| 18 }, | 18 }, |
| 19 | 19 |
| 20 /** @override */ |
| 20 attached: function() { | 21 attached: function() { |
| 21 cr.define('SettingsResetPage', function() { | 22 cr.define('SettingsResetPage', function() { |
| 22 return { | 23 return { |
| 23 doneResetting: function() { | 24 doneResetting: function() { |
| 24 this.$.resetSpinner.active = false; | 25 this.$.resetSpinner.active = false; |
| 25 this.$.dialog.close(); | 26 this.$.dialog.close(); |
| 26 this.dispatchResetDoneEvent(); | 27 this.dispatchResetDoneEvent(); |
| 27 }.bind(this), | 28 }.bind(this), |
| 28 | 29 |
| 29 setFeedbackInfo: function(data) { | 30 setFeedbackInfo: function(data) { |
| 30 this.set('feedbackInfo_', data.feedbackInfo); | 31 this.set('feedbackInfo_', data.feedbackInfo); |
| 31 }.bind(this), | 32 }.bind(this), |
| 32 }; | 33 }; |
| 33 }.bind(this)); | 34 }.bind(this)); |
| 34 }, | 35 }, |
| 35 | 36 |
| 37 /** @override */ |
| 38 ready: function() { |
| 39 this.addEventListener('iron-overlay-canceled', function() { |
| 40 chrome.send('onHideResetProfileDialog'); |
| 41 }); |
| 42 }, |
| 43 |
| 36 dispatchResetDoneEvent: function() { | 44 dispatchResetDoneEvent: function() { |
| 37 this.dispatchEvent(new CustomEvent('reset-done')); | 45 this.dispatchEvent(new CustomEvent('reset-done')); |
| 38 }, | 46 }, |
| 39 | 47 |
| 40 open: function() { | 48 open: function() { |
| 41 this.$.dialog.open(); | 49 this.$.dialog.open(); |
| 42 chrome.send('onShowResetProfileDialog'); | 50 chrome.send('onShowResetProfileDialog'); |
| 43 }, | 51 }, |
| 44 | 52 |
| 45 /** @private */ | 53 /** @private */ |
| 46 onCancelTap_: function() { | 54 onCancelTap_: function() { |
| 47 this.$.dialog.close(); | 55 this.$.dialog.cancel(); |
| 48 chrome.send('onHideResetProfileDialog'); | |
| 49 }, | 56 }, |
| 50 | 57 |
| 51 /** @private */ | 58 /** @private */ |
| 52 onResetTap_: function() { | 59 onResetTap_: function() { |
| 53 this.$.resetSpinner.active = true; | 60 this.$.resetSpinner.active = true; |
| 54 chrome.send('performResetProfileSettings', [this.$.sendSettings.checked]); | 61 chrome.send('performResetProfileSettings', [this.$.sendSettings.checked]); |
| 55 }, | 62 }, |
| 56 | 63 |
| 57 /** @private */ | 64 /** @private */ |
| 58 onSendSettingsChange_: function() { | 65 onSendSettingsChange_: function() { |
| 59 // TODO(dpapad): Update how settings info is surfaced when final mocks | 66 // TODO(dpapad): Update how settings info is surfaced when final mocks |
| 60 // exist. | 67 // exist. |
| 61 this.$.settings.hidden = !this.$.sendSettings.checked; | 68 this.$.settings.hidden = !this.$.sendSettings.checked; |
| 62 this.$.dialog.center(); | 69 this.$.dialog.center(); |
| 63 }, | 70 }, |
| 64 }); | 71 }); |
| OLD | NEW |