Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / options / options_util.cc
blobea769932d88f3699b9810efbca774e67ec05e7e0
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/options/options_util.h"
7 #include "base/threading/thread_restrictions.h"
8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/metrics/metrics_service.h"
10 #include "chrome/installer/util/google_update_settings.h"
12 // static
13 bool OptionsUtil::ResolveMetricsReportingEnabled(bool enabled) {
14 // GoogleUpdateSettings touches the disk from the UI thread. MetricsService
15 // also calls GoogleUpdateSettings below. http://crbug/62626
16 base::ThreadRestrictions::ScopedAllowIO allow_io;
18 GoogleUpdateSettings::SetCollectStatsConsent(enabled);
19 bool update_pref = GoogleUpdateSettings::GetCollectStatsConsent();
21 if (enabled != update_pref)
22 DVLOG(1) << "OptionsUtil: Unable to set crash report status to " << enabled;
24 // Only change the pref if GoogleUpdateSettings::GetCollectStatsConsent
25 // succeeds.
26 enabled = update_pref;
28 MetricsService* metrics = g_browser_process->metrics_service();
29 if (metrics) {
30 if (enabled)
31 metrics->Start();
32 else
33 metrics->Stop();
36 return enabled;