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 Polymer({ | 10 Polymer({ |
11 is: 'settings-reset-profile-dialog', | 11 is: 'settings-reset-profile-dialog', |
12 | 12 |
13 behaviors: [WebUIListenerBehavior], | 13 behaviors: [WebUIListenerBehavior], |
14 | 14 |
| 15 properties: { |
| 16 // TODO(dpapad): Evaluate whether this needs to be synced across different |
| 17 // settings tabs. |
| 18 /** @private */ |
| 19 clearingInProgress_: { |
| 20 type: Boolean, |
| 21 value: false, |
| 22 }, |
| 23 }, |
| 24 |
15 /** @private {!settings.ResetBrowserProxy} */ | 25 /** @private {!settings.ResetBrowserProxy} */ |
16 browserProxy_: null, | 26 browserProxy_: null, |
17 | 27 |
18 /** @override */ | 28 /** @override */ |
19 ready: function() { | 29 ready: function() { |
20 this.browserProxy_ = settings.ResetBrowserProxyImpl.getInstance(); | 30 this.browserProxy_ = settings.ResetBrowserProxyImpl.getInstance(); |
21 | 31 |
22 this.addEventListener('iron-overlay-canceled', function() { | 32 this.addEventListener('iron-overlay-canceled', function() { |
23 this.browserProxy_.onHideResetProfileDialog(); | 33 this.browserProxy_.onHideResetProfileDialog(); |
24 }.bind(this)); | 34 }.bind(this)); |
25 }, | 35 }, |
26 | 36 |
27 open: function() { | 37 open: function() { |
28 this.$.dialog.open(); | 38 this.$.dialog.open(); |
29 this.browserProxy_.onShowResetProfileDialog(); | 39 this.browserProxy_.onShowResetProfileDialog(); |
30 }, | 40 }, |
31 | 41 |
32 /** @private */ | 42 /** @private */ |
33 onCancelTap_: function() { | 43 onCancelTap_: function() { |
34 this.$.dialog.cancel(); | 44 this.$.dialog.cancel(); |
35 }, | 45 }, |
36 | 46 |
37 /** @private */ | 47 /** @private */ |
38 onResetTap_: function() { | 48 onResetTap_: function() { |
39 this.$.resetSpinner.active = true; | 49 this.clearingInProgress_ = true; |
40 this.browserProxy_.performResetProfileSettings( | 50 this.browserProxy_.performResetProfileSettings( |
41 this.$.sendSettings.checked).then(function() { | 51 this.$.sendSettings.checked).then(function() { |
42 this.$.resetSpinner.active = false; | 52 this.clearingInProgress_ = false; |
43 this.$.dialog.close(); | 53 this.$.dialog.close(); |
44 this.dispatchEvent(new CustomEvent('reset-done')); | 54 this.dispatchEvent(new CustomEvent('reset-done')); |
45 }.bind(this)); | 55 }.bind(this)); |
46 }, | 56 }, |
47 | 57 |
48 /** | 58 /** |
49 * Displays the settings that will be reported in a new tab. | 59 * Displays the settings that will be reported in a new tab. |
50 * @private | 60 * @private |
51 */ | 61 */ |
52 onShowReportedSettingsTap_: function() { | 62 onShowReportedSettingsTap_: function() { |
53 this.browserProxy_.showReportedSettings(); | 63 this.browserProxy_.showReportedSettings(); |
54 }, | 64 }, |
55 }); | 65 }); |
OLD | NEW |