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 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 AttemptMigration(); | 833 AttemptMigration(); |
834 VLOG(1) << "No metrics policy set will revert to checking " | 834 VLOG(1) << "No metrics policy set will revert to checking " |
835 << "consent file which is " | 835 << "consent file which is " |
836 << (new_value ? "on." : "off."); | 836 << (new_value ? "on." : "off."); |
837 UMA_HISTOGRAM_COUNTS("DeviceSettings.MetricsMigrated", 1); | 837 UMA_HISTOGRAM_COUNTS("DeviceSettings.MetricsMigrated", 1); |
838 } | 838 } |
839 VLOG(1) << "Metrics policy is being set to : " << new_value | 839 VLOG(1) << "Metrics policy is being set to : " << new_value |
840 << "(use file : " << use_file << ")"; | 840 << "(use file : " << use_file << ")"; |
841 // TODO(pastarmovj): Remove this once we don't need to regenerate the | 841 // TODO(pastarmovj): Remove this once we don't need to regenerate the |
842 // consent file for the GUID anymore. | 842 // consent file for the GUID anymore. |
843 OptionsUtil::ResolveMetricsReportingEnabled(new_value); | 843 ResolveMetricsReportingEnabled(new_value); |
844 } | 844 } |
845 | 845 |
846 void DeviceSettingsProvider::ApplySideEffects( | 846 void DeviceSettingsProvider::ApplySideEffects( |
847 const em::ChromeDeviceSettingsProto& settings) { | 847 const em::ChromeDeviceSettingsProto& settings) { |
848 // First migrate metrics settings as needed. | 848 // First migrate metrics settings as needed. |
849 if (settings.has_metrics_enabled()) | 849 if (settings.has_metrics_enabled()) |
850 ApplyMetricsSetting(false, settings.metrics_enabled().metrics_enabled()); | 850 ApplyMetricsSetting(false, settings.metrics_enabled().metrics_enabled()); |
851 else | 851 else |
852 ApplyMetricsSetting(true, false); | 852 ApplyMetricsSetting(true, false); |
853 } | 853 } |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 void DeviceSettingsProvider::AttemptMigration() { | 996 void DeviceSettingsProvider::AttemptMigration() { |
997 if (device_settings_service_->HasPrivateOwnerKey()) { | 997 if (device_settings_service_->HasPrivateOwnerKey()) { |
998 PrefValueMap::const_iterator i; | 998 PrefValueMap::const_iterator i; |
999 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) | 999 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) |
1000 DoSet(i->first, *i->second); | 1000 DoSet(i->first, *i->second); |
1001 migration_values_.Clear(); | 1001 migration_values_.Clear(); |
1002 } | 1002 } |
1003 } | 1003 } |
1004 | 1004 |
1005 } // namespace chromeos | 1005 } // namespace chromeos |
OLD | NEW |