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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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()) { |
327 policies->Set(key::kDeviceDataRoamingEnabled, POLICY_LEVEL_MANDATORY, | 327 policies->Set(key::kDeviceDataRoamingEnabled, POLICY_LEVEL_MANDATORY, |
328 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, | 328 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, |
329 base::MakeUnique<base::FundamentalValue>( | 329 base::MakeUnique<base::FundamentalValue>( |
330 container.data_roaming_enabled()), | 330 container.data_roaming_enabled()), |
331 nullptr); | 331 nullptr); |
332 } | 332 } |
333 } | 333 } |
334 | 334 |
335 if (policy.has_network_throttling()) { | |
336 const em::NetworkThrottlingEnabledProto& container( | |
337 policy.network_throttling()); | |
338 std::unique_ptr<base::DictionaryValue> throttling_status( | |
339 new base::DictionaryValue()); | |
340 bool enabled = (container.has_enabled()) ? container.enabled() : false; | |
341 uint32_t upload_rate_kbits = | |
342 (container.has_upload_rate_kbits()) ? container.upload_rate_kbits() : 0; | |
343 uint32_t download_rate_kbits = (container.has_download_rate_kbits()) | |
344 ? container.download_rate_kbits() | |
345 : 0; | |
346 | |
347 throttling_status->SetBoolean("enabled", enabled); | |
348 throttling_status->SetInteger("upload_rate_kbits", upload_rate_kbits); | |
349 throttling_status->SetInteger("download_rate_kbits", download_rate_kbits); | |
350 policies->Set(key::kNetworkThrottlingEnabled, POLICY_LEVEL_MANDATORY, | |
351 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, | |
352 std::move(throttling_status), nullptr); | |
353 } | |
354 | |
355 if (policy.has_open_network_configuration() && | 335 if (policy.has_open_network_configuration() && |
356 policy.open_network_configuration().has_open_network_configuration()) { | 336 policy.open_network_configuration().has_open_network_configuration()) { |
357 std::string config( | 337 std::string config( |
358 policy.open_network_configuration().open_network_configuration()); | 338 policy.open_network_configuration().open_network_configuration()); |
359 policies->Set(key::kDeviceOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY, | 339 policies->Set(key::kDeviceOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY, |
360 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, | 340 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, |
361 base::MakeUnique<base::StringValue>(config), nullptr); | 341 base::MakeUnique<base::StringValue>(config), nullptr); |
362 } | 342 } |
363 } | 343 } |
364 | 344 |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 // Decode the various groups of policies. | 814 // Decode the various groups of policies. |
835 DecodeLoginPolicies(policy, policies); | 815 DecodeLoginPolicies(policy, policies); |
836 DecodeNetworkPolicies(policy, policies); | 816 DecodeNetworkPolicies(policy, policies); |
837 DecodeReportingPolicies(policy, policies); | 817 DecodeReportingPolicies(policy, policies); |
838 DecodeAutoUpdatePolicies(policy, policies); | 818 DecodeAutoUpdatePolicies(policy, policies); |
839 DecodeAccessibilityPolicies(policy, policies); | 819 DecodeAccessibilityPolicies(policy, policies); |
840 DecodeGenericPolicies(policy, policies); | 820 DecodeGenericPolicies(policy, policies); |
841 } | 821 } |
842 | 822 |
843 } // namespace policy | 823 } // namespace policy |
OLD | NEW |