Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2842)

Unified Diff: chrome/browser/resources/options/advanced_options.js

Issue 3419020: dom-ui settings: properly implement the 'metrics reporting' checkbox.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Rebase to r60664. Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)
« no previous file with comments | « chrome/browser/resources/options/advanced_options.html ('k') | chrome/browser/resources/options/alert_overlay.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698