summaryrefslogtreecommitdiffstats
path: root/chrome/browser/options_util.cc
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-15 22:09:55 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-15 22:09:55 +0000
commite301150ae6bcc8e3d3d660b81ad35be1278d3bf6 (patch)
treeb02bd3fce3687a9585989c12684cbaeb0146c5c9 /chrome/browser/options_util.cc
parentb59ff376c5d5b950774fcbe65727611d51832b75 (diff)
downloadchromium_src-e301150ae6bcc8e3d3d660b81ad35be1278d3bf6.zip
chromium_src-e301150ae6bcc8e3d3d660b81ad35be1278d3bf6.tar.gz
chromium_src-e301150ae6bcc8e3d3d660b81ad35be1278d3bf6.tar.bz2
Move the ResolveMetricsReportingEnabled logic to OptionsUtil, make gtk options use it.
Only show the reporting checkbox in Google Chrome builds. Show the restart required message box when changing the reporting setting. BUG=11507 TEST=on Chromium build, option should not show up. On Google Chrome build in should show up, and enable both crash reporting and metrics settings. Review URL: http://codereview.chromium.org/149665 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20796 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/options_util.cc')
-rw-r--r--chrome/browser/options_util.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/chrome/browser/options_util.cc b/chrome/browser/options_util.cc
index eb19af0..98f3031 100644
--- a/chrome/browser/options_util.cc
+++ b/chrome/browser/options_util.cc
@@ -6,8 +6,10 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profile.h"
+#include "chrome/browser/metrics/metrics_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
+#include "chrome/installer/util/google_update_settings.h"
// static
void OptionsUtil::ResetToDefaults(Profile* profile) {
@@ -63,3 +65,31 @@ void OptionsUtil::ResetToDefaults(Profile* profile) {
for (size_t i = 0; i < arraysize(kLocalStatePrefs); ++i)
local_state->ClearPref(kLocalStatePrefs[i]);
}
+
+// static
+bool OptionsUtil::ResolveMetricsReportingEnabled(bool enabled) {
+ GoogleUpdateSettings::SetCollectStatsConsent(enabled);
+ bool update_pref = GoogleUpdateSettings::GetCollectStatsConsent();
+
+ if (enabled != update_pref) {
+ DLOG(INFO) <<
+ "OptionsUtil: Unable to set crash report status to " <<
+ enabled;
+ }
+
+ // Only change the pref if GoogleUpdateSettings::GetCollectStatsConsent
+ // succeeds.
+ enabled = update_pref;
+
+ MetricsService* metrics = g_browser_process->metrics_service();
+ DCHECK(metrics);
+ if (metrics) {
+ metrics->SetUserPermitsUpload(enabled);
+ if (enabled)
+ metrics->Start();
+ else
+ metrics->Stop();
+ }
+
+ return enabled;
+}