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 0a42880a26288cba1a169a632ea875a5391661ba..eda2364167770d1c27aa9a99c3e0674bb4e4848a 100644 |
--- a/chrome/browser/resources/options/browser_options.js |
+++ b/chrome/browser/resources/options/browser_options.js |
@@ -350,6 +350,34 @@ 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. |
+ $('metrics-reporting-reset-restart-starting-text').textContent = |
Evan Stade
2014/07/31 19:32:31
nit: you don't need IDs on all these elements (giv
luken
2014/08/01 00:53:57
Done.
|
+ restartTextFragments[0]; |
+ $('metrics-reporting-reset-restart-button').textContent = |
+ restartTextFragments[1]; |
+ $('metrics-reporting-reset-restart-button').onclick = function(event) { |
+ chrome.send('restartBrowser'); |
+ }; |
+ $('metrics-reporting-reset-restart-ending-text').textContent = |
+ restartTextFragments[2]; |
+ 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) { |