Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 cr.define('options', function() { | 5 cr.define('options', function() { |
| 6 var Page = cr.ui.pageManager.Page; | 6 var Page = cr.ui.pageManager.Page; |
| 7 | 7 |
| 8 var AutomaticSettingsResetBanner = options.AutomaticSettingsResetBanner; | 8 var AutomaticSettingsResetBanner = options.AutomaticSettingsResetBanner; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 * @private | 39 * @private |
| 40 */ | 40 */ |
| 41 isTriggered_: false, | 41 isTriggered_: false, |
| 42 | 42 |
| 43 /** @override */ | 43 /** @override */ |
| 44 initializePage: function() { | 44 initializePage: function() { |
| 45 Page.prototype.initializePage.call(this); | 45 Page.prototype.initializePage.call(this); |
| 46 | 46 |
| 47 // Set the onclick handlers only once when initializing the regular reset | 47 // Set the onclick handlers only once when initializing the regular reset |
| 48 // profile settings overlay. | 48 // profile settings overlay. |
| 49 if (!this.isTriggered_) { | 49 if (!this.isTriggered_) { |
|
Dan Beam
2016/09/16 06:29:41
soooooo, it seems like it doesn't matter whether t
alito
2016/09/16 17:10:18
Done.
| |
| 50 $('reset-profile-settings-dismiss').onclick = function(e) { | 50 $('reset-profile-settings-dismiss').onclick = function(e) { |
| 51 ResetProfileSettingsOverlay.dismiss(); | 51 ResetProfileSettingsOverlay.dismiss(); |
| 52 }; | 52 }; |
| 53 $('reset-profile-settings-commit').onclick = function(e) { | 53 $('reset-profile-settings-commit').onclick = function(e) { |
| 54 ResetProfileSettingsOverlay.setResettingState(true); | 54 ResetProfileSettingsOverlay.setResettingState(true); |
| 55 chrome.send('performResetProfileSettings', | 55 chrome.send('performResetProfileSettings', |
| 56 [$('send-settings').checked]); | 56 [$('send-settings').checked, |
| 57 ResetProfileSettingsOverlay.resetRequestOrigin_]); | |
| 57 }; | 58 }; |
| 58 $('expand-feedback').onclick = function(e) { | 59 $('expand-feedback').onclick = function(e) { |
| 59 var feedbackTemplate = $('feedback-template'); | 60 var feedbackTemplate = $('feedback-template'); |
| 60 feedbackTemplate.hidden = !feedbackTemplate.hidden; | 61 feedbackTemplate.hidden = !feedbackTemplate.hidden; |
| 61 e.preventDefault(); | 62 e.preventDefault(); |
| 62 }; | 63 }; |
| 63 } | 64 } |
| 64 }, | 65 }, |
| 65 | 66 |
| 66 /** | 67 /** |
| 67 * @override | 68 * @override |
| 68 * @suppress {checkTypes} | 69 * @suppress {checkTypes} |
| 69 * TODO(vitalyp): remove the suppression. See the explanation in | 70 * TODO(vitalyp): remove the suppression. See the explanation in |
| 70 * chrome/browser/resources/options/automatic_settings_reset_banner.js. | 71 * chrome/browser/resources/options/automatic_settings_reset_banner.js. |
| 71 */ | 72 */ |
| 72 didShowPage: function() { | 73 didShowPage: function() { |
| 73 $('reset-profile-settings-title').textContent = | 74 $('reset-profile-settings-title').textContent = |
| 74 loadTimeData.getString(this.isTriggered_ ? | 75 loadTimeData.getString(this.isTriggered_ ? |
| 75 'triggeredResetProfileSettingsOverlay' : | 76 'triggeredResetProfileSettingsOverlay' : |
| 76 'resetProfileSettingsOverlay'); | 77 'resetProfileSettingsOverlay'); |
| 77 $('reset-profile-settings-explanation').textContent = | 78 $('reset-profile-settings-explanation').textContent = |
| 78 loadTimeData.getString(this.isTriggered_ ? | 79 loadTimeData.getString(this.isTriggered_ ? |
| 79 'triggeredResetProfileSettingsExplanation' : | 80 'triggeredResetProfileSettingsExplanation' : |
| 80 'resetProfileSettingsExplanation'); | 81 'resetProfileSettingsExplanation'); |
| 81 | 82 |
| 83 // Set ResetProfileSettingsOverlay.resetRequestOrigin_ to indicate where | |
| 84 // the reset request came from. | |
| 85 // | |
| 86 // For the non-triggered reset overlay, a '#userclick' hash indicates that | |
| 87 // the reset request came from the user clicking on the reset settings | |
| 88 // button and is set by the browser_options page. A '#cct' hash indicates | |
| 89 // that the reset request came from the CCT by launching Chrome with the | |
| 90 // startup URL chrome://settings/resetProfileSettings#cct. | |
| 91 var hash = this.hash.slice(1).toLowerCase(); | |
|
Dan Beam
2016/09/16 06:29:41
do we need this hash variable if this.isTriggered_
alito
2016/09/16 17:10:18
Made the triggered case simpler.
| |
| 92 ResetProfileSettingsOverlay.resetRequestOrigin_ = | |
| 93 this.isTriggered_ ? | |
| 94 'triggeredreset' : | |
| 95 (hash === 'cct' || hash === 'userclick' ? hash : ''); | |
| 96 this.setHash(''); | |
| 97 | |
| 82 chrome.send('onShowResetProfileDialog'); | 98 chrome.send('onShowResetProfileDialog'); |
| 83 }, | 99 }, |
| 84 | 100 |
| 85 /** @override */ | 101 /** @override */ |
| 86 didClosePage: function() { | 102 didClosePage: function() { |
| 87 chrome.send('onHideResetProfileDialog'); | 103 chrome.send('onHideResetProfileDialog'); |
| 88 }, | 104 }, |
| 89 }; | 105 }; |
| 90 | 106 |
| 91 /** | 107 /** |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 var input = new JsEvalContext(feedbackListData); | 139 var input = new JsEvalContext(feedbackListData); |
| 124 var output = $('feedback-template'); | 140 var output = $('feedback-template'); |
| 125 jstProcess(input, output); | 141 jstProcess(input, output); |
| 126 }; | 142 }; |
| 127 | 143 |
| 128 // Export | 144 // Export |
| 129 return { | 145 return { |
| 130 ResetProfileSettingsOverlay: ResetProfileSettingsOverlay | 146 ResetProfileSettingsOverlay: ResetProfileSettingsOverlay |
| 131 }; | 147 }; |
| 132 }); | 148 }); |
| OLD | NEW |