| 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 14 matching lines...) Expand all Loading... |
| 25 value: false, | 25 value: false, |
| 26 }, | 26 }, |
| 27 | 27 |
| 28 /** @private */ | 28 /** @private */ |
| 29 triggeredResetToolName_: { | 29 triggeredResetToolName_: { |
| 30 type: String, | 30 type: String, |
| 31 value: '', | 31 value: '', |
| 32 }, | 32 }, |
| 33 | 33 |
| 34 /** @private */ | 34 /** @private */ |
| 35 resetRequestOrigin_: String, |
| 36 |
| 37 /** @private */ |
| 35 clearingInProgress_: { | 38 clearingInProgress_: { |
| 36 type: Boolean, | 39 type: Boolean, |
| 37 value: false, | 40 value: false, |
| 38 }, | 41 }, |
| 39 }, | 42 }, |
| 40 | 43 |
| 41 /** @private {!settings.ResetBrowserProxy} */ | 44 /** @private {!settings.ResetBrowserProxy} */ |
| 42 browserProxy_: null, | 45 browserProxy_: null, |
| 43 | 46 |
| 44 /** | 47 /** |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 this.$.dialog.showModal(); | 82 this.$.dialog.showModal(); |
| 80 this.browserProxy_.onShowResetProfileDialog(); | 83 this.browserProxy_.onShowResetProfileDialog(); |
| 81 }, | 84 }, |
| 82 | 85 |
| 83 /** @override */ | 86 /** @override */ |
| 84 attached: function() { | 87 attached: function() { |
| 85 this.isTriggered_ = | 88 this.isTriggered_ = |
| 86 settings.getCurrentRoute() == settings.Route.TRIGGERED_RESET_DIALOG; | 89 settings.getCurrentRoute() == settings.Route.TRIGGERED_RESET_DIALOG; |
| 87 if (this.isTriggered_) { | 90 if (this.isTriggered_) { |
| 88 this.browserProxy_.getTriggeredResetToolName().then(function(name) { | 91 this.browserProxy_.getTriggeredResetToolName().then(function(name) { |
| 92 this.resetRequestOrigin_ = 'triggeredreset'; |
| 89 this.triggeredResetToolName_ = name; | 93 this.triggeredResetToolName_ = name; |
| 90 this.showDialog_(); | 94 this.showDialog_(); |
| 91 }.bind(this)); | 95 }.bind(this)); |
| 92 } else { | 96 } else { |
| 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 |
| 99 // with the startup URL chrome://settings/resetProfileSettings#cct. |
| 100 var origin = window.location.hash.slice(1).toLowerCase() == 'cct' ? |
| 101 'cct' : settings.getQueryParameters().get('origin'); |
| 102 this.resetRequestOrigin_ = origin || ''; |
| 93 this.showDialog_(); | 103 this.showDialog_(); |
| 94 } | 104 } |
| 95 }, | 105 }, |
| 96 | 106 |
| 97 /** @private */ | 107 /** @private */ |
| 98 onCancelTap_: function() { | 108 onCancelTap_: function() { |
| 99 this.$.dialog.cancel(); | 109 this.$.dialog.cancel(); |
| 100 }, | 110 }, |
| 101 | 111 |
| 102 /** @private */ | 112 /** @private */ |
| 103 onResetTap_: function() { | 113 onResetTap_: function() { |
| 104 this.clearingInProgress_ = true; | 114 this.clearingInProgress_ = true; |
| 105 this.browserProxy_.performResetProfileSettings( | 115 this.browserProxy_.performResetProfileSettings( |
| 106 this.$.sendSettings.checked).then(function() { | 116 this.$.sendSettings.checked, this.resetRequestOrigin_).then(function() { |
| 107 this.clearingInProgress_ = false; | 117 this.clearingInProgress_ = false; |
| 108 if (this.$.dialog.open) | 118 if (this.$.dialog.open) |
| 109 this.$.dialog.close(); | 119 this.$.dialog.close(); |
| 110 this.fire('reset-done'); | 120 this.fire('reset-done'); |
| 111 }.bind(this)); | 121 }.bind(this)); |
| 112 }, | 122 }, |
| 113 | 123 |
| 114 /** | 124 /** |
| 115 * Displays the settings that will be reported in a new tab. | 125 * Displays the settings that will be reported in a new tab. |
| 116 * @private | 126 * @private |
| 117 */ | 127 */ |
| 118 onShowReportedSettingsTap_: function() { | 128 onShowReportedSettingsTap_: function() { |
| 119 this.browserProxy_.showReportedSettings(); | 129 this.browserProxy_.showReportedSettings(); |
| 120 }, | 130 }, |
| 121 }); | 131 }); |
| OLD | NEW |