| 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/policy/device_policy_decoder_chromeos.h" | 5 #include "chrome/browser/policy/device_policy_decoder_chromeos.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
| 11 #include "chrome/browser/policy/app_pack_updater.h" | 12 #include "chrome/browser/policy/app_pack_updater.h" |
| 12 #include "chrome/browser/policy/enterprise_install_attributes.h" | 13 #include "chrome/browser/policy/enterprise_install_attributes.h" |
| 13 #include "chrome/browser/policy/policy_map.h" | 14 #include "chrome/browser/policy/policy_map.h" |
| 14 #include "chrome/browser/policy/proto/chrome_device_policy.pb.h" | 15 #include "chrome/browser/policy/proto/chrome_device_policy.pb.h" |
| 15 #include "chromeos/dbus/dbus_thread_manager.h" | 16 #include "chromeos/dbus/dbus_thread_manager.h" |
| 16 #include "chromeos/dbus/update_engine_client.h" | 17 #include "chromeos/dbus/update_engine_client.h" |
| 17 #include "policy/policy_constants.h" | 18 #include "policy/policy_constants.h" |
| 18 #include "third_party/cros_system_api/dbus/service_constants.h" | 19 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 19 | 20 |
| 20 using google::protobuf::RepeatedField; | 21 using google::protobuf::RepeatedField; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 const em::EphemeralUsersEnabledProto& container( | 108 const em::EphemeralUsersEnabledProto& container( |
| 108 policy.ephemeral_users_enabled()); | 109 policy.ephemeral_users_enabled()); |
| 109 if (container.has_ephemeral_users_enabled()) { | 110 if (container.has_ephemeral_users_enabled()) { |
| 110 policies->Set(key::kDeviceEphemeralUsersEnabled, | 111 policies->Set(key::kDeviceEphemeralUsersEnabled, |
| 111 POLICY_LEVEL_MANDATORY, | 112 POLICY_LEVEL_MANDATORY, |
| 112 POLICY_SCOPE_MACHINE, | 113 POLICY_SCOPE_MACHINE, |
| 113 Value::CreateBooleanValue( | 114 Value::CreateBooleanValue( |
| 114 container.ephemeral_users_enabled())); | 115 container.ephemeral_users_enabled())); |
| 115 } | 116 } |
| 116 } | 117 } |
| 118 |
| 119 if (policy.has_device_local_accounts()) { |
| 120 const RepeatedPtrField<em::DeviceLocalAccountInfoProto>& accounts = |
| 121 policy.device_local_accounts().account(); |
| 122 if (accounts.size() > 0) { |
| 123 ListValue* account_list = new ListValue(); |
| 124 RepeatedPtrField<em::DeviceLocalAccountInfoProto>::const_iterator entry; |
| 125 for (entry = accounts.begin(); entry != accounts.end(); ++entry) { |
| 126 if (entry->has_id()) |
| 127 account_list->AppendString(entry->id()); |
| 128 } |
| 129 policies->Set(key::kDeviceLocalAccounts, |
| 130 POLICY_LEVEL_MANDATORY, |
| 131 POLICY_SCOPE_MACHINE, |
| 132 account_list); |
| 133 } |
| 134 } |
| 117 } | 135 } |
| 118 | 136 |
| 119 void DecodeKioskPolicies(const em::ChromeDeviceSettingsProto& policy, | 137 void DecodeKioskPolicies(const em::ChromeDeviceSettingsProto& policy, |
| 120 PolicyMap* policies, | 138 PolicyMap* policies, |
| 121 EnterpriseInstallAttributes* install_attributes) { | 139 EnterpriseInstallAttributes* install_attributes) { |
| 122 // No policies if this is not KIOSK. | 140 // No policies if this is not KIOSK. |
| 123 if (install_attributes->GetMode() != DEVICE_MODE_KIOSK) | 141 if (install_attributes->GetMode() != DEVICE_MODE_KIOSK) |
| 124 return; | 142 return; |
| 125 | 143 |
| 126 if (policy.has_forced_logout_timeouts()) { | 144 if (policy.has_forced_logout_timeouts()) { |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 // Decode the various groups of policies. | 423 // Decode the various groups of policies. |
| 406 DecodeLoginPolicies(policy, policies); | 424 DecodeLoginPolicies(policy, policies); |
| 407 DecodeKioskPolicies(policy, policies, install_attributes); | 425 DecodeKioskPolicies(policy, policies, install_attributes); |
| 408 DecodeNetworkPolicies(policy, policies, install_attributes); | 426 DecodeNetworkPolicies(policy, policies, install_attributes); |
| 409 DecodeReportingPolicies(policy, policies); | 427 DecodeReportingPolicies(policy, policies); |
| 410 DecodeAutoUpdatePolicies(policy, policies); | 428 DecodeAutoUpdatePolicies(policy, policies); |
| 411 DecodeGenericPolicies(policy, policies); | 429 DecodeGenericPolicies(policy, policies); |
| 412 } | 430 } |
| 413 | 431 |
| 414 } // namespace policy | 432 } // namespace policy |
| OLD | NEW |