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 var resetRequestOrigin = ''; | |
| 7 | 8 |
| 8 var AutomaticSettingsResetBanner = options.AutomaticSettingsResetBanner; | 9 var AutomaticSettingsResetBanner = options.AutomaticSettingsResetBanner; |
| 9 | 10 |
| 10 /** | 11 /** |
| 11 * ResetProfileSettingsOverlay class | 12 * ResetProfileSettingsOverlay class |
| 12 * Encapsulated handling of the 'Reset Profile Settings' overlay page. | 13 * Encapsulated handling of the 'Reset Profile Settings' overlay page. |
| 13 * @constructor | 14 * @constructor |
| 14 * @extends {cr.ui.pageManager.Page} | 15 * @extends {cr.ui.pageManager.Page} |
| 15 */ | 16 */ |
| 16 function ResetProfileSettingsOverlay() { | 17 function ResetProfileSettingsOverlay() { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 28 /** @override */ | 29 /** @override */ |
| 29 initializePage: function() { | 30 initializePage: function() { |
| 30 Page.prototype.initializePage.call(this); | 31 Page.prototype.initializePage.call(this); |
| 31 | 32 |
| 32 $('reset-profile-settings-dismiss').onclick = function(e) { | 33 $('reset-profile-settings-dismiss').onclick = function(e) { |
| 33 ResetProfileSettingsOverlay.dismiss(); | 34 ResetProfileSettingsOverlay.dismiss(); |
| 34 }; | 35 }; |
| 35 $('reset-profile-settings-commit').onclick = function(e) { | 36 $('reset-profile-settings-commit').onclick = function(e) { |
| 36 ResetProfileSettingsOverlay.setResettingState(true); | 37 ResetProfileSettingsOverlay.setResettingState(true); |
| 37 chrome.send('performResetProfileSettings', | 38 chrome.send('performResetProfileSettings', |
| 38 [$('send-settings').checked]); | 39 [$('send-settings').checked, resetRequestOrigin]); |
| 39 }; | 40 }; |
| 40 $('expand-feedback').onclick = function(e) { | 41 $('expand-feedback').onclick = function(e) { |
| 41 var feedbackTemplate = $('feedback-template'); | 42 var feedbackTemplate = $('feedback-template'); |
| 42 feedbackTemplate.hidden = !feedbackTemplate.hidden; | 43 feedbackTemplate.hidden = !feedbackTemplate.hidden; |
| 43 e.preventDefault(); | 44 e.preventDefault(); |
| 44 }; | 45 }; |
| 45 }, | 46 }, |
| 46 | 47 |
| 47 /** | 48 /** |
| 48 * @override | 49 * @override |
| 49 * @suppress {checkTypes} | 50 * @suppress {checkTypes} |
| 50 * TODO(vitalyp): remove the suppression. See the explanation in | 51 * TODO(vitalyp): remove the suppression. See the explanation in |
| 51 * chrome/browser/resources/options/automatic_settings_reset_banner.js. | 52 * chrome/browser/resources/options/automatic_settings_reset_banner.js. |
| 52 */ | 53 */ |
| 53 didShowPage: function() { | 54 didShowPage: function() { |
| 55 if (this.hash === '#userClick') { | |
| 56 // A '#userClick' hash indicates that the reset request came from the | |
| 57 // user clicking on the reset settings button. This hash is set by the | |
| 58 // browser_options page. | |
| 59 this.setResetRequestOrigin('userClick'); | |
| 60 this.setHash(''); | |
| 61 } else if (this.hash == '#CCT') { | |
| 62 // A '#CCT' hash indicates that the reset request came from the CCT by | |
| 63 // launching Chrome with startup URL | |
|
robertshield
2016/08/10 20:35:41
nit: with *the* startup URL
alito
2016/08/10 21:06:33
Done.
| |
| 64 // chrome://settings/resetProfileSettings#CCT. | |
| 65 this.setResetRequestOrigin('CCT'); | |
| 66 this.setHash(''); | |
| 67 } else { | |
| 68 this.setResetRequestOrigin(''); | |
| 69 } | |
| 70 | |
| 54 $('reset-profile-settings-title').textContent = | 71 $('reset-profile-settings-title').textContent = |
| 55 loadTimeData.getString('resetProfileSettingsOverlay'); | 72 loadTimeData.getString('resetProfileSettingsOverlay'); |
| 56 $('reset-profile-settings-explanation').textContent = | 73 $('reset-profile-settings-explanation').textContent = |
| 57 loadTimeData.getString('resetProfileSettingsExplanation'); | 74 loadTimeData.getString('resetProfileSettingsExplanation'); |
| 58 | 75 |
| 59 chrome.send('onShowResetProfileDialog'); | 76 chrome.send('onShowResetProfileDialog'); |
| 60 }, | 77 }, |
| 61 | 78 |
| 62 /** @override */ | 79 /** @override */ |
| 63 didClosePage: function() { | 80 didClosePage: function() { |
| 64 chrome.send('onHideResetProfileDialog'); | 81 chrome.send('onHideResetProfileDialog'); |
| 65 }, | 82 }, |
| 83 | |
| 84 /** | |
| 85 * Sets the reset request origin string. To be used also by subclasses, such | |
| 86 * as TriggeredResetProfileSettingsOverlay. | |
| 87 * @param {string} origin Origin of the reset request. | |
| 88 */ | |
| 89 setResetRequestOrigin: function(origin) { | |
| 90 resetRequestOrigin = origin; | |
| 91 } | |
| 66 }; | 92 }; |
| 67 | 93 |
| 68 /** | 94 /** |
| 69 * Enables/disables UI elements after/while Chrome is performing a reset. | 95 * Enables/disables UI elements after/while Chrome is performing a reset. |
| 70 * @param {boolean} state If true, UI elements are disabled. | 96 * @param {boolean} state If true, UI elements are disabled. |
| 71 */ | 97 */ |
| 72 ResetProfileSettingsOverlay.setResettingState = function(state) { | 98 ResetProfileSettingsOverlay.setResettingState = function(state) { |
| 73 $('reset-profile-settings-throbber').style.visibility = | 99 $('reset-profile-settings-throbber').style.visibility = |
| 74 state ? 'visible' : 'hidden'; | 100 state ? 'visible' : 'hidden'; |
| 75 $('reset-profile-settings-dismiss').disabled = state; | 101 $('reset-profile-settings-dismiss').disabled = state; |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 100 var input = new JsEvalContext(feedbackListData); | 126 var input = new JsEvalContext(feedbackListData); |
| 101 var output = $('feedback-template'); | 127 var output = $('feedback-template'); |
| 102 jstProcess(input, output); | 128 jstProcess(input, output); |
| 103 }; | 129 }; |
| 104 | 130 |
| 105 // Export | 131 // Export |
| 106 return { | 132 return { |
| 107 ResetProfileSettingsOverlay: ResetProfileSettingsOverlay | 133 ResetProfileSettingsOverlay: ResetProfileSettingsOverlay |
| 108 }; | 134 }; |
| 109 }); | 135 }); |
| OLD | NEW |