Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc

Issue 2466693002: [Re-land] Add network throttling as enterprise policy (Closed)
Patch Set: [Draft only] Investigating memory leak issue in NetworkThrottlingObserverTest Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..51f42210821f9cb9f7957157a2c591bce1b8210e 100644
--- a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc
+++ b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc
@@ -332,6 +332,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(

Powered by Google App Engine
This is Rietveld 408576698