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

Side by Side Diff: chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc

Issue 2466693002: [Re-land] Add network throttling as enterprise policy (Closed)
Patch Set: [Re-land] Add network throttling as enterprise policy 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 unified diff | Download patch
OLDNEW
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
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
335 if (policy.has_open_network_configuration() && 355 if (policy.has_open_network_configuration() &&
336 policy.open_network_configuration().has_open_network_configuration()) { 356 policy.open_network_configuration().has_open_network_configuration()) {
337 std::string config( 357 std::string config(
338 policy.open_network_configuration().open_network_configuration()); 358 policy.open_network_configuration().open_network_configuration());
339 policies->Set(key::kDeviceOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY, 359 policies->Set(key::kDeviceOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY,
340 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, 360 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD,
341 base::MakeUnique<base::StringValue>(config), nullptr); 361 base::MakeUnique<base::StringValue>(config), nullptr);
342 } 362 }
343 } 363 }
344 364
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 // Decode the various groups of policies. 834 // Decode the various groups of policies.
815 DecodeLoginPolicies(policy, policies); 835 DecodeLoginPolicies(policy, policies);
816 DecodeNetworkPolicies(policy, policies); 836 DecodeNetworkPolicies(policy, policies);
817 DecodeReportingPolicies(policy, policies); 837 DecodeReportingPolicies(policy, policies);
818 DecodeAutoUpdatePolicies(policy, policies); 838 DecodeAutoUpdatePolicies(policy, policies);
819 DecodeAccessibilityPolicies(policy, policies); 839 DecodeAccessibilityPolicies(policy, policies);
820 DecodeGenericPolicies(policy, policies); 840 DecodeGenericPolicies(policy, policies);
821 } 841 }
822 842
823 } // namespace policy 843 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698