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 * | 7 * |
8 * 'settings-reset-profile-dialog' is the dialog shown for clearing profile | 8 * 'settings-reset-profile-dialog' is the dialog shown for clearing profile |
9 * settings. A triggered variant of this dialog can be shown under certain | 9 * settings. A triggered variant of this dialog can be shown under certain |
10 * circumstances. See triggered_profile_resetter.h for when the triggered | 10 * circumstances. See triggered_profile_resetter.h for when the triggered |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 return loadTimeData.getStringF( | 65 return loadTimeData.getStringF( |
66 'triggeredResetPageTitle', this.triggeredResetToolName_); | 66 'triggeredResetPageTitle', this.triggeredResetToolName_); |
67 } | 67 } |
68 return loadTimeData.getStringF('resetPageTitle'); | 68 return loadTimeData.getStringF('resetPageTitle'); |
69 }, | 69 }, |
70 | 70 |
71 /** @override */ | 71 /** @override */ |
72 ready: function() { | 72 ready: function() { |
73 this.browserProxy_ = settings.ResetBrowserProxyImpl.getInstance(); | 73 this.browserProxy_ = settings.ResetBrowserProxyImpl.getInstance(); |
74 | 74 |
75 this.addEventListener('cancel', function() { | 75 this.addEventListener('cancel', () => { |
76 this.browserProxy_.onHideResetProfileDialog(); | 76 this.browserProxy_.onHideResetProfileDialog(); |
77 }.bind(this)); | 77 }); |
78 | 78 |
79 this.$$('paper-checkbox a') | 79 this.$$('paper-checkbox a') |
80 .addEventListener('tap', this.onShowReportedSettingsTap_.bind(this)); | 80 .addEventListener('tap', this.onShowReportedSettingsTap_.bind(this)); |
81 // Prevent toggling of the checkbox when hitting the "Enter" key on the | 81 // Prevent toggling of the checkbox when hitting the "Enter" key on the |
82 // link. | 82 // link. |
83 this.$$('paper-checkbox a').addEventListener('keydown', function(e) { | 83 this.$$('paper-checkbox a').addEventListener('keydown', function(e) { |
84 e.stopPropagation(); | 84 e.stopPropagation(); |
85 }); | 85 }); |
86 }, | 86 }, |
87 | 87 |
88 /** @private */ | 88 /** @private */ |
89 showDialog_: function() { | 89 showDialog_: function() { |
90 this.$.dialog.showModal(); | 90 this.$.dialog.showModal(); |
91 this.browserProxy_.onShowResetProfileDialog(); | 91 this.browserProxy_.onShowResetProfileDialog(); |
92 }, | 92 }, |
93 | 93 |
94 /** @override */ | 94 /** @override */ |
95 attached: function() { | 95 attached: function() { |
96 this.isTriggered_ = | 96 this.isTriggered_ = |
97 settings.getCurrentRoute() == settings.routes.TRIGGERED_RESET_DIALOG; | 97 settings.getCurrentRoute() == settings.routes.TRIGGERED_RESET_DIALOG; |
98 if (this.isTriggered_) { | 98 if (this.isTriggered_) { |
99 this.browserProxy_.getTriggeredResetToolName().then(function(name) { | 99 this.browserProxy_.getTriggeredResetToolName().then(name => { |
100 this.resetRequestOrigin_ = 'triggeredreset'; | 100 this.resetRequestOrigin_ = 'triggeredreset'; |
101 this.triggeredResetToolName_ = name; | 101 this.triggeredResetToolName_ = name; |
102 this.showDialog_(); | 102 this.showDialog_(); |
103 }.bind(this)); | 103 }); |
104 } else { | 104 } else { |
105 // For the non-triggered reset dialog, a '#cct' hash indicates that the | 105 // For the non-triggered reset dialog, a '#cct' hash indicates that the |
106 // reset request came from the Chrome Cleanup Tool by launching Chrome | 106 // reset request came from the Chrome Cleanup Tool by launching Chrome |
107 // with the startup URL chrome://settings/resetProfileSettings#cct. | 107 // with the startup URL chrome://settings/resetProfileSettings#cct. |
108 var origin = window.location.hash.slice(1).toLowerCase() == 'cct' ? | 108 var origin = window.location.hash.slice(1).toLowerCase() == 'cct' ? |
109 'cct' : | 109 'cct' : |
110 settings.getQueryParameters().get('origin'); | 110 settings.getQueryParameters().get('origin'); |
111 this.resetRequestOrigin_ = origin || ''; | 111 this.resetRequestOrigin_ = origin || ''; |
112 this.showDialog_(); | 112 this.showDialog_(); |
113 } | 113 } |
114 }, | 114 }, |
115 | 115 |
116 /** @private */ | 116 /** @private */ |
117 onCancelTap_: function() { | 117 onCancelTap_: function() { |
118 this.$.dialog.cancel(); | 118 this.$.dialog.cancel(); |
119 }, | 119 }, |
120 | 120 |
121 /** @private */ | 121 /** @private */ |
122 onResetTap_: function() { | 122 onResetTap_: function() { |
123 this.clearingInProgress_ = true; | 123 this.clearingInProgress_ = true; |
124 this.browserProxy_ | 124 this.browserProxy_ |
125 .performResetProfileSettings( | 125 .performResetProfileSettings( |
126 this.$.sendSettings.checked, this.resetRequestOrigin_) | 126 this.$.sendSettings.checked, this.resetRequestOrigin_) |
127 .then(function() { | 127 .then(() => { |
128 this.clearingInProgress_ = false; | 128 this.clearingInProgress_ = false; |
129 if (this.$.dialog.open) | 129 if (this.$.dialog.open) |
130 this.$.dialog.close(); | 130 this.$.dialog.close(); |
131 this.fire('reset-done'); | 131 this.fire('reset-done'); |
132 }.bind(this)); | 132 }); |
133 }, | 133 }, |
134 | 134 |
135 /** | 135 /** |
136 * Displays the settings that will be reported in a new tab. | 136 * Displays the settings that will be reported in a new tab. |
137 * @param {!Event} e | 137 * @param {!Event} e |
138 * @private | 138 * @private |
139 */ | 139 */ |
140 onShowReportedSettingsTap_: function(e) { | 140 onShowReportedSettingsTap_: function(e) { |
141 this.browserProxy_.showReportedSettings(); | 141 this.browserProxy_.showReportedSettings(); |
142 e.stopPropagation(); | 142 e.stopPropagation(); |
143 }, | 143 }, |
144 }); | 144 }); |
OLD | NEW |