Index: chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc |
diff --git a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc |
index 0fefc22f34b9547d1019bfef504c86a1f880732b..8fde9e5288290818b26d05d248f374dcb8d83454 100644 |
--- a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc |
+++ b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc |
@@ -5,7 +5,9 @@ |
#include "chrome/browser/chromeos/policy/device_policy_decoder_chromeos.h" |
#include <limits> |
+#include <memory> |
#include <string> |
+#include <utility> |
#include "base/callback.h" |
#include "base/json/json_reader.h" |
@@ -332,6 +334,26 @@ void DecodeNetworkPolicies(const em::ChromeDeviceSettingsProto& policy, |
} |
} |
+ if (policy.has_network_throttling()) { |
+ const em::NetworkThrottlingEnabledProto& container( |
+ policy.network_throttling()); |
+ std::unique_ptr<base::DictionaryValue> throttling_status( |
+ new base::DictionaryValue()); |
+ bool enabled = (container.has_enabled()) ? container.enabled() : false; |
+ uint32_t upload_rate_kbits = |
+ (container.has_upload_rate_kbits()) ? container.upload_rate_kbits() : 0; |
+ uint32_t download_rate_kbits = (container.has_download_rate_kbits()) |
+ ? container.download_rate_kbits() |
+ : 0; |
+ |
+ throttling_status->SetBoolean("enabled", enabled); |
+ throttling_status->SetInteger("upload_rate_kbits", upload_rate_kbits); |
+ throttling_status->SetInteger("download_rate_kbits", download_rate_kbits); |
+ policies->Set(key::kNetworkThrottlingEnabled, POLICY_LEVEL_MANDATORY, |
+ POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, |
+ std::move(throttling_status), nullptr); |
+ } |
+ |
if (policy.has_open_network_configuration() && |
policy.open_network_configuration().has_open_network_configuration()) { |
std::string config( |