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

Side by Side Diff: chrome/browser/metrics/metrics_reporting_state.cc

Issue 502173002: Move more metrics classes to metrics namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit test compile. Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/metrics/metrics_reporting_state.h" 5 #include "chrome/browser/metrics/metrics_reporting_state.h"
6 6
7 #include "base/threading/thread_restrictions.h" 7 #include "base/threading/thread_restrictions.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/installer/util/google_update_settings.h" 9 #include "chrome/installer/util/google_update_settings.h"
10 #include "components/metrics/metrics_service.h" 10 #include "components/metrics/metrics_service.h"
11 11
12 bool ResolveMetricsReportingEnabled(bool enabled) { 12 bool ResolveMetricsReportingEnabled(bool enabled) {
13 // GoogleUpdateSettings touches the disk from the UI thread. MetricsService 13 // GoogleUpdateSettings touches the disk from the UI thread. MetricsService
14 // also calls GoogleUpdateSettings below. http://crbug/62626 14 // also calls GoogleUpdateSettings below. http://crbug/62626
15 base::ThreadRestrictions::ScopedAllowIO allow_io; 15 base::ThreadRestrictions::ScopedAllowIO allow_io;
16 16
17 GoogleUpdateSettings::SetCollectStatsConsent(enabled); 17 GoogleUpdateSettings::SetCollectStatsConsent(enabled);
18 bool update_pref = GoogleUpdateSettings::GetCollectStatsConsent(); 18 bool update_pref = GoogleUpdateSettings::GetCollectStatsConsent();
19 19
20 if (enabled != update_pref) 20 if (enabled != update_pref)
21 DVLOG(1) << "Unable to set crash report status to " << enabled; 21 DVLOG(1) << "Unable to set crash report status to " << enabled;
22 22
23 // Only change the pref if GoogleUpdateSettings::GetCollectStatsConsent 23 // Only change the pref if GoogleUpdateSettings::GetCollectStatsConsent
24 // succeeds. 24 // succeeds.
25 enabled = update_pref; 25 enabled = update_pref;
26 26
27 MetricsService* metrics = g_browser_process->metrics_service(); 27 metrics::MetricsService* metrics = g_browser_process->metrics_service();
28 if (metrics) { 28 if (metrics) {
29 if (enabled) 29 if (enabled)
30 metrics->Start(); 30 metrics->Start();
31 else 31 else
32 metrics->Stop(); 32 metrics->Stop();
33 } 33 }
34 34
35 return enabled; 35 return enabled;
36 } 36 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/extensions_metrics_provider_unittest.cc ('k') | chrome/browser/metrics/metrics_service_accessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698