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

Side by Side Diff: chrome/browser/chromeos/settings/device_settings_provider.cc

Issue 506663003: Consolidates accessing and setting the UMA pref to be within metrics code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/chromeos/settings/device_settings_provider.h" 5 #include "chrome/browser/chromeos/settings/device_settings_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 AttemptMigration(); 841 AttemptMigration();
842 VLOG(1) << "No metrics policy set will revert to checking " 842 VLOG(1) << "No metrics policy set will revert to checking "
843 << "consent file which is " 843 << "consent file which is "
844 << (new_value ? "on." : "off."); 844 << (new_value ? "on." : "off.");
845 UMA_HISTOGRAM_COUNTS("DeviceSettings.MetricsMigrated", 1); 845 UMA_HISTOGRAM_COUNTS("DeviceSettings.MetricsMigrated", 1);
846 } 846 }
847 VLOG(1) << "Metrics policy is being set to : " << new_value 847 VLOG(1) << "Metrics policy is being set to : " << new_value
848 << "(use file : " << use_file << ")"; 848 << "(use file : " << use_file << ")";
849 // TODO(pastarmovj): Remove this once we don't need to regenerate the 849 // TODO(pastarmovj): Remove this once we don't need to regenerate the
850 // consent file for the GUID anymore. 850 // consent file for the GUID anymore.
851 ResolveMetricsReportingEnabled(new_value); 851 base::Callback<void(bool)> callback_fn;
852 InitiateMetricsReportingChange(callback_fn, new_value);
852 } 853 }
853 854
854 void DeviceSettingsProvider::ApplySideEffects( 855 void DeviceSettingsProvider::ApplySideEffects(
855 const em::ChromeDeviceSettingsProto& settings) { 856 const em::ChromeDeviceSettingsProto& settings) {
856 // First migrate metrics settings as needed. 857 // First migrate metrics settings as needed.
857 if (settings.has_metrics_enabled()) 858 if (settings.has_metrics_enabled())
858 ApplyMetricsSetting(false, settings.metrics_enabled().metrics_enabled()); 859 ApplyMetricsSetting(false, settings.metrics_enabled().metrics_enabled());
859 else 860 else
860 ApplyMetricsSetting(true, false); 861 ApplyMetricsSetting(true, false);
861 } 862 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 void DeviceSettingsProvider::AttemptMigration() { 1005 void DeviceSettingsProvider::AttemptMigration() {
1005 if (device_settings_service_->HasPrivateOwnerKey()) { 1006 if (device_settings_service_->HasPrivateOwnerKey()) {
1006 PrefValueMap::const_iterator i; 1007 PrefValueMap::const_iterator i;
1007 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) 1008 for (i = migration_values_.begin(); i != migration_values_.end(); ++i)
1008 DoSet(i->first, *i->second); 1009 DoSet(i->first, *i->second);
1009 migration_values_.Clear(); 1010 migration_values_.Clear();
1010 } 1011 }
1011 } 1012 }
1012 1013
1013 } // namespace chromeos 1014 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698