| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 /** @private {!settings.ResetBrowserProxy} */ | 44 /** @private {!settings.ResetBrowserProxy} */ |
| 45 browserProxy_: null, | 45 browserProxy_: null, |
| 46 | 46 |
| 47 /** | 47 /** |
| 48 * @private | 48 * @private |
| 49 * @return {string} | 49 * @return {string} |
| 50 */ | 50 */ |
| 51 getExplanationText_: function() { | 51 getExplanationText_: function() { |
| 52 if (this.isTriggered_) { | 52 if (this.isTriggered_) { |
| 53 return loadTimeData.getStringF('triggeredResetPageExplanation', | 53 return loadTimeData.getStringF( |
| 54 this.triggeredResetToolName_); | 54 'triggeredResetPageExplanation', this.triggeredResetToolName_); |
| 55 } | 55 } |
| 56 return loadTimeData.getStringF('resetPageExplanation'); | 56 return loadTimeData.getStringF('resetPageExplanation'); |
| 57 }, | 57 }, |
| 58 | 58 |
| 59 /** | 59 /** |
| 60 * @private | 60 * @private |
| 61 * @return {string} | 61 * @return {string} |
| 62 */ | 62 */ |
| 63 getPageTitle_: function() { | 63 getPageTitle_: function() { |
| 64 if (this.isTriggered_) { | 64 if (this.isTriggered_) { |
| 65 return loadTimeData.getStringF('triggeredResetPageTitle', | 65 return loadTimeData.getStringF( |
| 66 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', function() { |
| 76 this.browserProxy_.onHideResetProfileDialog(); | 76 this.browserProxy_.onHideResetProfileDialog(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 91 this.browserProxy_.getTriggeredResetToolName().then(function(name) { | 91 this.browserProxy_.getTriggeredResetToolName().then(function(name) { |
| 92 this.resetRequestOrigin_ = 'triggeredreset'; | 92 this.resetRequestOrigin_ = 'triggeredreset'; |
| 93 this.triggeredResetToolName_ = name; | 93 this.triggeredResetToolName_ = name; |
| 94 this.showDialog_(); | 94 this.showDialog_(); |
| 95 }.bind(this)); | 95 }.bind(this)); |
| 96 } else { | 96 } else { |
| 97 // For the non-triggered reset dialog, a '#cct' hash indicates that the | 97 // For the non-triggered reset dialog, a '#cct' hash indicates that the |
| 98 // reset request came from the Chrome Cleanup Tool by launching Chrome | 98 // reset request came from the Chrome Cleanup Tool by launching Chrome |
| 99 // with the startup URL chrome://settings/resetProfileSettings#cct. | 99 // with the startup URL chrome://settings/resetProfileSettings#cct. |
| 100 var origin = window.location.hash.slice(1).toLowerCase() == 'cct' ? | 100 var origin = window.location.hash.slice(1).toLowerCase() == 'cct' ? |
| 101 'cct' : settings.getQueryParameters().get('origin'); | 101 'cct' : |
| 102 settings.getQueryParameters().get('origin'); |
| 102 this.resetRequestOrigin_ = origin || ''; | 103 this.resetRequestOrigin_ = origin || ''; |
| 103 this.showDialog_(); | 104 this.showDialog_(); |
| 104 } | 105 } |
| 105 }, | 106 }, |
| 106 | 107 |
| 107 /** @private */ | 108 /** @private */ |
| 108 onCancelTap_: function() { | 109 onCancelTap_: function() { |
| 109 this.$.dialog.cancel(); | 110 this.$.dialog.cancel(); |
| 110 }, | 111 }, |
| 111 | 112 |
| 112 /** @private */ | 113 /** @private */ |
| 113 onResetTap_: function() { | 114 onResetTap_: function() { |
| 114 this.clearingInProgress_ = true; | 115 this.clearingInProgress_ = true; |
| 115 this.browserProxy_.performResetProfileSettings( | 116 this.browserProxy_ |
| 116 this.$.sendSettings.checked, this.resetRequestOrigin_).then(function() { | 117 .performResetProfileSettings( |
| 117 this.clearingInProgress_ = false; | 118 this.$.sendSettings.checked, this.resetRequestOrigin_) |
| 118 if (this.$.dialog.open) | 119 .then(function() { |
| 119 this.$.dialog.close(); | 120 this.clearingInProgress_ = false; |
| 120 this.fire('reset-done'); | 121 if (this.$.dialog.open) |
| 121 }.bind(this)); | 122 this.$.dialog.close(); |
| 123 this.fire('reset-done'); |
| 124 }.bind(this)); |
| 122 }, | 125 }, |
| 123 | 126 |
| 124 /** | 127 /** |
| 125 * Displays the settings that will be reported in a new tab. | 128 * Displays the settings that will be reported in a new tab. |
| 126 * @private | 129 * @private |
| 127 */ | 130 */ |
| 128 onShowReportedSettingsTap_: function() { | 131 onShowReportedSettingsTap_: function() { |
| 129 this.browserProxy_.showReportedSettings(); | 132 this.browserProxy_.showReportedSettings(); |
| 130 }, | 133 }, |
| 131 }); | 134 }); |
| OLD | NEW |