| 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/ownership/owner_settings_service_chromeos.h" | 16 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" |
| 17 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 17 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 18 #include "chrome/browser/chromeos/policy/device_local_account.h" | 18 #include "chrome/browser/chromeos/policy/device_local_account.h" |
| 19 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 19 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
| 20 #include "chrome/browser/chromeos/policy/policy_util.h" |
| 20 #include "chrome/browser/chromeos/settings/cros_settings.h" | 21 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 21 #include "chrome/browser/chromeos/settings/device_settings_cache.h" | 22 #include "chrome/browser/chromeos/settings/device_settings_cache.h" |
| 22 #include "chrome/browser/metrics/metrics_reporting_state.h" | 23 #include "chrome/browser/metrics/metrics_reporting_state.h" |
| 23 #include "chrome/installer/util/google_update_settings.h" | 24 #include "chrome/installer/util/google_update_settings.h" |
| 24 #include "chromeos/chromeos_switches.h" | 25 #include "chromeos/chromeos_switches.h" |
| 25 #include "chromeos/dbus/cryptohome_client.h" | 26 #include "chromeos/dbus/cryptohome_client.h" |
| 26 #include "chromeos/dbus/dbus_thread_manager.h" | 27 #include "chromeos/dbus/dbus_thread_manager.h" |
| 27 #include "chromeos/settings/cros_settings_names.h" | 28 #include "chromeos/settings/cros_settings_names.h" |
| 28 #include "policy/proto/device_management_backend.pb.h" | 29 #include "policy/proto/device_management_backend.pb.h" |
| 29 | 30 |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 | 608 |
| 608 void DeviceSettingsProvider::UpdateValuesCache( | 609 void DeviceSettingsProvider::UpdateValuesCache( |
| 609 const em::PolicyData& policy_data, | 610 const em::PolicyData& policy_data, |
| 610 const em::ChromeDeviceSettingsProto& settings, | 611 const em::ChromeDeviceSettingsProto& settings, |
| 611 TrustedStatus trusted_status) { | 612 TrustedStatus trusted_status) { |
| 612 PrefValueMap new_values_cache; | 613 PrefValueMap new_values_cache; |
| 613 | 614 |
| 614 // If the device is not managed, or is consumer-managed, we set the device | 615 // If the device is not managed, or is consumer-managed, we set the device |
| 615 // owner value. | 616 // owner value. |
| 616 if (policy_data.has_username() && | 617 if (policy_data.has_username() && |
| 617 (!policy_data.has_request_token() || | 618 (policy::PolicyUtil::IsLocalOwned(policy_data) || |
| 618 policy_data.management_mode() == em::PolicyData::CONSUMER_MANAGED)) { | 619 policy::PolicyUtil::IsConsumerManaged(policy_data))) { |
| 619 new_values_cache.SetString(kDeviceOwner, policy_data.username()); | 620 new_values_cache.SetString(kDeviceOwner, policy_data.username()); |
| 620 } | 621 } |
| 621 | 622 |
| 622 if (policy_data.has_service_account_identity()) { | 623 if (policy_data.has_service_account_identity()) { |
| 623 new_values_cache.SetString(kServiceAccountIdentity, | 624 new_values_cache.SetString(kServiceAccountIdentity, |
| 624 policy_data.service_account_identity()); | 625 policy_data.service_account_identity()); |
| 625 } | 626 } |
| 626 | 627 |
| 627 DecodeLoginPolicies(settings, &new_values_cache); | 628 DecodeLoginPolicies(settings, &new_values_cache); |
| 628 DecodeKioskPolicies(settings, &new_values_cache); | 629 DecodeKioskPolicies(settings, &new_values_cache); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 void DeviceSettingsProvider::AttemptMigration() { | 816 void DeviceSettingsProvider::AttemptMigration() { |
| 816 if (device_settings_service_->HasPrivateOwnerKey()) { | 817 if (device_settings_service_->HasPrivateOwnerKey()) { |
| 817 PrefValueMap::const_iterator i; | 818 PrefValueMap::const_iterator i; |
| 818 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) | 819 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) |
| 819 DoSet(i->first, *i->second); | 820 DoSet(i->first, *i->second); |
| 820 migration_values_.Clear(); | 821 migration_values_.Clear(); |
| 821 } | 822 } |
| 822 } | 823 } |
| 823 | 824 |
| 824 } // namespace chromeos | 825 } // namespace chromeos |
| OLD | NEW |