Chromium Code Reviews| Index: chrome/browser/resources/options/browser_options.js |
| diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js |
| index 8969cb2663e3cd8ce635b851de1e7c5138fd196f..fa970bbeaa515e70565a1e379eccf98c93351ca4 100644 |
| --- a/chrome/browser/resources/options/browser_options.js |
| +++ b/chrome/browser/resources/options/browser_options.js |
| @@ -348,6 +348,41 @@ cr.define('options', function() { |
| [String(event.currentTarget.checked)]); |
| }; |
| } |
| + if ($('metricsReportingEnabled') && !cr.isChromeOS) { |
| + // The localized string has the | symbol on each side of the text that |
| + // needs to be made into a button to restart Chrome. We parse the text |
| + // and build the button from that. |
| + var restartTextFragments = |
| + loadTimeData.getString('metricsReportingResetRestart').split('|'); |
| + // Assume structure is something like "starting text |link text| ending |
| + // text" where both starting text and ending text may or may not be |
| + // present, but the split should always be in three pieces. |
| + var startingTextSpan = document.createElement('span'); |
| + startingTextSpan.textContent = restartTextFragments[0]; |
| + $('metrics-reporting-reset-restart').appendChild(startingTextSpan); |
| + var restartButton = document.createElement('button'); |
| + restartButton.setAttribute('id', |
| + 'metrics-reporting-reset-restart-button'); |
| + restartButton.setAttribute('class', |
|
Evan Stade
2014/07/31 15:04:37
restartButton.id = ...
restartButton.className = .
luken
2014/07/31 18:58:36
I moved it to HTML, but in order to battle rogue w
|
| + 'link-button standalone-link-button'); |
| + restartButton.textContent = restartTextFragments[1]; |
| + restartButton.onclick = function(event) { |
| + chrome.send('restartBrowser'); |
| + }; |
| + $('metrics-reporting-reset-restart').appendChild(restartButton); |
| + var endingTextSpan = document.createElement('span'); |
| + endingTextSpan.textContent = restartTextFragments[2]; |
| + $('metrics-reporting-reset-restart').appendChild(endingTextSpan); |
| + var updateMetricsRestartButton = function() { |
| + $('metrics-reporting-reset-restart').hidden = |
| + loadTimeData.getBoolean('metricsReportingEnabledAtStart') == |
| + $('metricsReportingEnabled').checked; |
| + }; |
| + Preferences.getInstance().addEventListener( |
| + $('metricsReportingEnabled').getAttribute('pref'), |
| + updateMetricsRestartButton); |
| + updateMetricsRestartButton(); |
| + } |
| // Bluetooth (CrOS only). |
| if (cr.isChromeOS) { |