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" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 16 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
17 #include "chrome/browser/chromeos/policy/device_local_account.h" | 17 #include "chrome/browser/chromeos/policy/device_local_account.h" |
18 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 18 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
19 #include "chrome/browser/chromeos/settings/cros_settings.h" | 19 #include "chrome/browser/chromeos/settings/cros_settings.h" |
20 #include "chrome/browser/chromeos/settings/device_settings_cache.h" | 20 #include "chrome/browser/chromeos/settings/device_settings_cache.h" |
21 #include "chrome/browser/ui/options/options_util.h" | 21 #include "chrome/browser/metrics/metrics_reporting_state.h" |
22 #include "chrome/installer/util/google_update_settings.h" | 22 #include "chrome/installer/util/google_update_settings.h" |
23 #include "chromeos/chromeos_switches.h" | 23 #include "chromeos/chromeos_switches.h" |
24 #include "chromeos/dbus/cryptohome_client.h" | 24 #include "chromeos/dbus/cryptohome_client.h" |
25 #include "chromeos/dbus/dbus_thread_manager.h" | 25 #include "chromeos/dbus/dbus_thread_manager.h" |
26 #include "chromeos/settings/cros_settings_names.h" | 26 #include "chromeos/settings/cros_settings_names.h" |
27 #include "policy/proto/device_management_backend.pb.h" | 27 #include "policy/proto/device_management_backend.pb.h" |
28 | 28 |
29 using google::protobuf::RepeatedField; | 29 using google::protobuf::RepeatedField; |
30 using google::protobuf::RepeatedPtrField; | 30 using google::protobuf::RepeatedPtrField; |
31 | 31 |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 AttemptMigration(); | 832 AttemptMigration(); |
833 VLOG(1) << "No metrics policy set will revert to checking " | 833 VLOG(1) << "No metrics policy set will revert to checking " |
834 << "consent file which is " | 834 << "consent file which is " |
835 << (new_value ? "on." : "off."); | 835 << (new_value ? "on." : "off."); |
836 UMA_HISTOGRAM_COUNTS("DeviceSettings.MetricsMigrated", 1); | 836 UMA_HISTOGRAM_COUNTS("DeviceSettings.MetricsMigrated", 1); |
837 } | 837 } |
838 VLOG(1) << "Metrics policy is being set to : " << new_value | 838 VLOG(1) << "Metrics policy is being set to : " << new_value |
839 << "(use file : " << use_file << ")"; | 839 << "(use file : " << use_file << ")"; |
840 // 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 |
841 // consent file for the GUID anymore. | 841 // consent file for the GUID anymore. |
842 OptionsUtil::ResolveMetricsReportingEnabled(new_value); | 842 ResolveMetricsReportingEnabled(new_value); |
843 } | 843 } |
844 | 844 |
845 void DeviceSettingsProvider::ApplySideEffects( | 845 void DeviceSettingsProvider::ApplySideEffects( |
846 const em::ChromeDeviceSettingsProto& settings) { | 846 const em::ChromeDeviceSettingsProto& settings) { |
847 // First migrate metrics settings as needed. | 847 // First migrate metrics settings as needed. |
848 if (settings.has_metrics_enabled()) | 848 if (settings.has_metrics_enabled()) |
849 ApplyMetricsSetting(false, settings.metrics_enabled().metrics_enabled()); | 849 ApplyMetricsSetting(false, settings.metrics_enabled().metrics_enabled()); |
850 else | 850 else |
851 ApplyMetricsSetting(true, false); | 851 ApplyMetricsSetting(true, false); |
852 } | 852 } |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 void DeviceSettingsProvider::AttemptMigration() { | 995 void DeviceSettingsProvider::AttemptMigration() { |
996 if (device_settings_service_->HasPrivateOwnerKey()) { | 996 if (device_settings_service_->HasPrivateOwnerKey()) { |
997 PrefValueMap::const_iterator i; | 997 PrefValueMap::const_iterator i; |
998 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) | 998 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) |
999 DoSet(i->first, *i->second); | 999 DoSet(i->first, *i->second); |
1000 migration_values_.Clear(); | 1000 migration_values_.Clear(); |
1001 } | 1001 } |
1002 } | 1002 } |
1003 | 1003 |
1004 } // namespace chromeos | 1004 } // namespace chromeos |
OLD | NEW |