| OLD | NEW |
| 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 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 NotifyObservers(notifications[i]); | 821 NotifyObservers(notifications[i]); |
| 822 } | 822 } |
| 823 | 823 |
| 824 void DeviceSettingsProvider::ApplyMetricsSetting(bool use_file, | 824 void DeviceSettingsProvider::ApplyMetricsSetting(bool use_file, |
| 825 bool new_value) { | 825 bool new_value) { |
| 826 // TODO(pastarmovj): Remove this once migration is not needed anymore. | 826 // TODO(pastarmovj): Remove this once migration is not needed anymore. |
| 827 // If the value is not set we should try to migrate legacy consent file. | 827 // If the value is not set we should try to migrate legacy consent file. |
| 828 if (use_file) { | 828 if (use_file) { |
| 829 new_value = HasOldMetricsFile(); | 829 new_value = HasOldMetricsFile(); |
| 830 // Make sure the values will get eventually written to the policy file. | 830 // Make sure the values will get eventually written to the policy file. |
| 831 migration_values_.SetValue(kStatsReportingPref, | 831 migration_values_.SetBoolean(kStatsReportingPref, new_value); |
| 832 base::Value::CreateBooleanValue(new_value)); | |
| 833 AttemptMigration(); | 832 AttemptMigration(); |
| 834 VLOG(1) << "No metrics policy set will revert to checking " | 833 VLOG(1) << "No metrics policy set will revert to checking " |
| 835 << "consent file which is " | 834 << "consent file which is " |
| 836 << (new_value ? "on." : "off."); | 835 << (new_value ? "on." : "off."); |
| 837 UMA_HISTOGRAM_COUNTS("DeviceSettings.MetricsMigrated", 1); | 836 UMA_HISTOGRAM_COUNTS("DeviceSettings.MetricsMigrated", 1); |
| 838 } | 837 } |
| 839 VLOG(1) << "Metrics policy is being set to : " << new_value | 838 VLOG(1) << "Metrics policy is being set to : " << new_value |
| 840 << "(use file : " << use_file << ")"; | 839 << "(use file : " << use_file << ")"; |
| 841 // TODO(pastarmovj): Remove this once we don't need to regenerate the | 840 // TODO(pastarmovj): Remove this once we don't need to regenerate the |
| 842 // consent file for the GUID anymore. | 841 // consent file for the GUID anymore. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 void DeviceSettingsProvider::AttemptMigration() { | 995 void DeviceSettingsProvider::AttemptMigration() { |
| 997 if (device_settings_service_->HasPrivateOwnerKey()) { | 996 if (device_settings_service_->HasPrivateOwnerKey()) { |
| 998 PrefValueMap::const_iterator i; | 997 PrefValueMap::const_iterator i; |
| 999 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) | 998 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) |
| 1000 DoSet(i->first, *i->second); | 999 DoSet(i->first, *i->second); |
| 1001 migration_values_.Clear(); | 1000 migration_values_.Clear(); |
| 1002 } | 1001 } |
| 1003 } | 1002 } |
| 1004 | 1003 |
| 1005 } // namespace chromeos | 1004 } // namespace chromeos |
| OLD | NEW |