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

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

Issue 2364703002: Add network throttling as an enterprise policy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add network bandwidth throttling as an 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 <memory>
8 #include <string> 9 #include <string>
10 #include <utility>
9 11
10 #include "base/callback.h" 12 #include "base/callback.h"
11 #include "base/json/json_reader.h" 13 #include "base/json/json_reader.h"
12 #include "base/logging.h" 14 #include "base/logging.h"
13 #include "base/macros.h" 15 #include "base/macros.h"
14 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
15 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
16 #include "base/values.h" 18 #include "base/values.h"
17 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/chromeos/policy/device_local_account.h" 20 #include "chrome/browser/chromeos/policy/device_local_account.h"
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 const em::DataRoamingEnabledProto& container(policy.data_roaming_enabled()); 327 const em::DataRoamingEnabledProto& container(policy.data_roaming_enabled());
326 if (container.has_data_roaming_enabled()) { 328 if (container.has_data_roaming_enabled()) {
327 policies->Set(key::kDeviceDataRoamingEnabled, POLICY_LEVEL_MANDATORY, 329 policies->Set(key::kDeviceDataRoamingEnabled, POLICY_LEVEL_MANDATORY,
328 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, 330 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD,
329 base::MakeUnique<base::FundamentalValue>( 331 base::MakeUnique<base::FundamentalValue>(
330 container.data_roaming_enabled()), 332 container.data_roaming_enabled()),
331 nullptr); 333 nullptr);
332 } 334 }
333 } 335 }
334 336
337 if (policy.has_network_throttling()) {
338 const em::NetworkThrottlingEnabledProto& container(
339 policy.network_throttling());
340 std::unique_ptr<base::DictionaryValue> throttling_status(
341 new base::DictionaryValue());
342 bool enabled = (container.has_enabled()) ? container.enabled() : false;
343 uint32_t upload_rate_kbits =
344 (container.has_upload_rate_kbits()) ? container.upload_rate_kbits() : 0;
345 uint32_t download_rate_kbits = (container.has_download_rate_kbits())
346 ? container.download_rate_kbits()
347 : 0;
348
349 throttling_status->SetBoolean("enabled", enabled);
350 throttling_status->SetInteger("upload_rate_kbits", upload_rate_kbits);
351 throttling_status->SetInteger("download_rate_kbits", download_rate_kbits);
352 policies->Set(key::kNetworkThrottlingEnabled, POLICY_LEVEL_MANDATORY,
353 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD,
354 std::move(throttling_status), nullptr);
355 }
356
335 if (policy.has_open_network_configuration() && 357 if (policy.has_open_network_configuration() &&
336 policy.open_network_configuration().has_open_network_configuration()) { 358 policy.open_network_configuration().has_open_network_configuration()) {
337 std::string config( 359 std::string config(
338 policy.open_network_configuration().open_network_configuration()); 360 policy.open_network_configuration().open_network_configuration());
339 policies->Set(key::kDeviceOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY, 361 policies->Set(key::kDeviceOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY,
340 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, 362 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD,
341 base::MakeUnique<base::StringValue>(config), nullptr); 363 base::MakeUnique<base::StringValue>(config), nullptr);
342 } 364 }
343 } 365 }
344 366
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 // Decode the various groups of policies. 836 // Decode the various groups of policies.
815 DecodeLoginPolicies(policy, policies); 837 DecodeLoginPolicies(policy, policies);
816 DecodeNetworkPolicies(policy, policies); 838 DecodeNetworkPolicies(policy, policies);
817 DecodeReportingPolicies(policy, policies); 839 DecodeReportingPolicies(policy, policies);
818 DecodeAutoUpdatePolicies(policy, policies); 840 DecodeAutoUpdatePolicies(policy, policies);
819 DecodeAccessibilityPolicies(policy, policies); 841 DecodeAccessibilityPolicies(policy, policies);
820 DecodeGenericPolicies(policy, policies); 842 DecodeGenericPolicies(policy, policies);
821 } 843 }
822 844
823 } // namespace policy 845 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698