Index: chrome/browser/resources/options/advanced_options.js |
=================================================================== |
--- chrome/browser/resources/options/advanced_options.js (revision 60664) |
+++ chrome/browser/resources/options/advanced_options.js (working copy) |
@@ -21,7 +21,9 @@ |
// Inherit AdvancedOptions from OptionsPage. |
__proto__: options.OptionsPage.prototype, |
- // Initialize AdvancedOptions page. |
+ /** |
+ * Initializes the page. |
+ */ |
initializePage: function() { |
// Call base class implementation to starts preference initialization. |
OptionsPage.prototype.initializePage.call(this); |
@@ -37,6 +39,14 @@ |
OptionsPage.showOverlay('clearBrowserDataOverlay'); |
chrome.send('coreOptionsUserMetricsAction', ['Options_ClearData']); |
}; |
+ // 'metricsReportingEnabled' element is only present on Chrome branded |
+ // builds. |
+ if ($('metricsReportingEnabled')) { |
+ $('metricsReportingEnabled').onclick = function(event) { |
+ chrome.send('metricsReportingCheckboxAction', |
+ [String(event.target.checked)]); |
+ }; |
+ } |
$('autoOpenFileTypesResetToDefault').onclick = function(event) { |
chrome.send('autoOpenFileTypesAction'); |
}; |
@@ -89,6 +99,16 @@ |
chrome.send('showGearsSettings'); |
}; |
} |
+ }, |
+ |
+ /** |
+ * Show a 'restart required' alert. |
+ * @private |
+ */ |
+ showRestartRequiredAlert_: function() { |
+ AlertOverlay.show(undefined, |
+ localStrings.getString('optionsRestartRequired'), |
+ undefined, '', undefined); |
} |
}; |
@@ -96,6 +116,16 @@ |
// Chrome callbacks |
// |
+ // Set the checked state of the metrics reporting checkbox. |
+ AdvancedOptions.SetMetricsReportingCheckboxState = function(checked, |
+ disabled, user_changed) { |
+ $('metricsReportingEnabled').checked = checked; |
+ $('metricsReportingEnabled').disabled = disabled; |
+ |
+ if (user_changed) |
+ AdvancedOptions.getInstance().showRestartRequiredAlert_(); |
+ } |
+ |
// Set the download path. |
AdvancedOptions.SetDownloadLocationPath = function(path) { |
if (!cr.isChromeOS) |