| 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/policy/device_policy_decoder_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/device_policy_decoder_chromeos.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, | 154 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, |
| 155 base::MakeUnique<base::FundamentalValue>(container.allow_new_users()), | 155 base::MakeUnique<base::FundamentalValue>(container.allow_new_users()), |
| 156 nullptr); | 156 nullptr); |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 | 159 |
| 160 if (policy.has_user_whitelist()) { | 160 if (policy.has_user_whitelist()) { |
| 161 const em::UserWhitelistProto& container(policy.user_whitelist()); | 161 const em::UserWhitelistProto& container(policy.user_whitelist()); |
| 162 std::unique_ptr<base::ListValue> whitelist(new base::ListValue); | 162 std::unique_ptr<base::ListValue> whitelist(new base::ListValue); |
| 163 for (const auto& entry : container.user_whitelist()) | 163 for (const auto& entry : container.user_whitelist()) |
| 164 whitelist->Append(new base::StringValue(entry)); | 164 whitelist->AppendString(entry); |
| 165 policies->Set(key::kDeviceUserWhitelist, POLICY_LEVEL_MANDATORY, | 165 policies->Set(key::kDeviceUserWhitelist, POLICY_LEVEL_MANDATORY, |
| 166 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, | 166 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, |
| 167 std::move(whitelist), nullptr); | 167 std::move(whitelist), nullptr); |
| 168 } | 168 } |
| 169 | 169 |
| 170 if (policy.has_ephemeral_users_enabled()) { | 170 if (policy.has_ephemeral_users_enabled()) { |
| 171 const em::EphemeralUsersEnabledProto& container( | 171 const em::EphemeralUsersEnabledProto& container( |
| 172 policy.ephemeral_users_enabled()); | 172 policy.ephemeral_users_enabled()); |
| 173 if (container.has_ephemeral_users_enabled()) { | 173 if (container.has_ephemeral_users_enabled()) { |
| 174 policies->Set(key::kDeviceEphemeralUsersEnabled, POLICY_LEVEL_MANDATORY, | 174 policies->Set(key::kDeviceEphemeralUsersEnabled, POLICY_LEVEL_MANDATORY, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 base::MakeUnique<base::FundamentalValue>(container.allow_bluetooth()), | 295 base::MakeUnique<base::FundamentalValue>(container.allow_bluetooth()), |
| 296 nullptr); | 296 nullptr); |
| 297 } | 297 } |
| 298 } | 298 } |
| 299 | 299 |
| 300 if (policy.has_login_video_capture_allowed_urls()) { | 300 if (policy.has_login_video_capture_allowed_urls()) { |
| 301 const em::LoginVideoCaptureAllowedUrlsProto& container( | 301 const em::LoginVideoCaptureAllowedUrlsProto& container( |
| 302 policy.login_video_capture_allowed_urls()); | 302 policy.login_video_capture_allowed_urls()); |
| 303 std::unique_ptr<base::ListValue> urls(new base::ListValue()); | 303 std::unique_ptr<base::ListValue> urls(new base::ListValue()); |
| 304 for (const auto& entry : container.urls()) { | 304 for (const auto& entry : container.urls()) { |
| 305 urls->Append(new base::StringValue(entry)); | 305 urls->AppendString(entry); |
| 306 } | 306 } |
| 307 policies->Set(key::kLoginVideoCaptureAllowedUrls, POLICY_LEVEL_MANDATORY, | 307 policies->Set(key::kLoginVideoCaptureAllowedUrls, POLICY_LEVEL_MANDATORY, |
| 308 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, std::move(urls), | 308 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, std::move(urls), |
| 309 nullptr); | 309 nullptr); |
| 310 } | 310 } |
| 311 | 311 |
| 312 if (policy.has_login_apps()) { | 312 if (policy.has_login_apps()) { |
| 313 const em::LoginAppsProto& login_apps_proto(policy.login_apps()); | 313 const em::LoginAppsProto& login_apps_proto(policy.login_apps()); |
| 314 std::unique_ptr<base::ListValue> login_apps(new base::ListValue); | 314 std::unique_ptr<base::ListValue> login_apps(new base::ListValue); |
| 315 for (const auto& login_app : login_apps_proto.login_apps()) | 315 for (const auto& login_app : login_apps_proto.login_apps()) |
| 316 login_apps->Append(new base::StringValue(login_app)); | 316 login_apps->AppendString(login_app); |
| 317 policies->Set(key::kLoginApps, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, | 317 policies->Set(key::kLoginApps, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
| 318 POLICY_SOURCE_CLOUD, std::move(login_apps), nullptr); | 318 POLICY_SOURCE_CLOUD, std::move(login_apps), nullptr); |
| 319 } | 319 } |
| 320 } | 320 } |
| 321 | 321 |
| 322 void DecodeNetworkPolicies(const em::ChromeDeviceSettingsProto& policy, | 322 void DecodeNetworkPolicies(const em::ChromeDeviceSettingsProto& policy, |
| 323 PolicyMap* policies) { | 323 PolicyMap* policies) { |
| 324 if (policy.has_data_roaming_enabled()) { | 324 if (policy.has_data_roaming_enabled()) { |
| 325 const em::DataRoamingEnabledProto& container(policy.data_roaming_enabled()); | 325 const em::DataRoamingEnabledProto& container(policy.data_roaming_enabled()); |
| 326 if (container.has_data_roaming_enabled()) { | 326 if (container.has_data_roaming_enabled()) { |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 // Decode the various groups of policies. | 814 // Decode the various groups of policies. |
| 815 DecodeLoginPolicies(policy, policies); | 815 DecodeLoginPolicies(policy, policies); |
| 816 DecodeNetworkPolicies(policy, policies); | 816 DecodeNetworkPolicies(policy, policies); |
| 817 DecodeReportingPolicies(policy, policies); | 817 DecodeReportingPolicies(policy, policies); |
| 818 DecodeAutoUpdatePolicies(policy, policies); | 818 DecodeAutoUpdatePolicies(policy, policies); |
| 819 DecodeAccessibilityPolicies(policy, policies); | 819 DecodeAccessibilityPolicies(policy, policies); |
| 820 DecodeGenericPolicies(policy, policies); | 820 DecodeGenericPolicies(policy, policies); |
| 821 } | 821 } |
| 822 | 822 |
| 823 } // namespace policy | 823 } // namespace policy |
| OLD | NEW |