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

Side by Side Diff: chrome/browser/ui/options/options_util.cc

Issue 9703115: Add DeviceSettingProvider unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed copyright header. Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/device_settings_provider_unittest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 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/ui/options/options_util.h" 5 #include "chrome/browser/ui/options/options_util.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/browser/metrics/metrics_service.h" 9 #include "chrome/browser/metrics/metrics_service.h"
10 #include "chrome/installer/util/google_update_settings.h" 10 #include "chrome/installer/util/google_update_settings.h"
11 11
12 // static 12 // static
13 bool OptionsUtil::ResolveMetricsReportingEnabled(bool enabled) { 13 bool OptionsUtil::ResolveMetricsReportingEnabled(bool enabled) {
14 // GoogleUpdateSettings touches the disk from the UI thread. MetricsService 14 // GoogleUpdateSettings touches the disk from the UI thread. MetricsService
15 // also calls GoogleUpdateSettings below. http://crbug/62626 15 // also calls GoogleUpdateSettings below. http://crbug/62626
16 base::ThreadRestrictions::ScopedAllowIO allow_io; 16 base::ThreadRestrictions::ScopedAllowIO allow_io;
17 17
18 GoogleUpdateSettings::SetCollectStatsConsent(enabled); 18 GoogleUpdateSettings::SetCollectStatsConsent(enabled);
19 bool update_pref = GoogleUpdateSettings::GetCollectStatsConsent(); 19 bool update_pref = GoogleUpdateSettings::GetCollectStatsConsent();
20 20
21 if (enabled != update_pref) 21 if (enabled != update_pref)
22 DVLOG(1) << "OptionsUtil: Unable to set crash report status to " << enabled; 22 DVLOG(1) << "OptionsUtil: Unable to set crash report status to " << enabled;
23 23
24 // Only change the pref if GoogleUpdateSettings::GetCollectStatsConsent 24 // Only change the pref if GoogleUpdateSettings::GetCollectStatsConsent
25 // succeeds. 25 // succeeds.
26 enabled = update_pref; 26 enabled = update_pref;
27 27
28 MetricsService* metrics = g_browser_process->metrics_service(); 28 MetricsService* metrics = g_browser_process->metrics_service();
29 DCHECK(metrics);
30 if (metrics) { 29 if (metrics) {
31 if (enabled) 30 if (enabled)
32 metrics->Start(); 31 metrics->Start();
33 else 32 else
34 metrics->Stop(); 33 metrics->Stop();
35 } 34 }
36 35
37 return enabled; 36 return enabled;
38 } 37 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/device_settings_provider_unittest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698