| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/supervised_user/supervised_user_creation_policy_handler
.h" |
| 6 |
| 7 #include "base/values.h" |
| 8 #include "chrome/common/pref_names.h" |
| 9 #include "components/policy/core/common/policy_map.h" |
| 10 #include "components/policy/policy_constants.h" |
| 11 #include "components/prefs/pref_value_map.h" |
| 12 |
| 13 namespace policy { |
| 14 |
| 15 SupervisedUserCreationPolicyHandler::SupervisedUserCreationPolicyHandler() |
| 16 : TypeCheckingPolicyHandler(key::kSupervisedUserCreationEnabled, |
| 17 base::Value::Type::BOOLEAN) {} |
| 18 |
| 19 SupervisedUserCreationPolicyHandler::~SupervisedUserCreationPolicyHandler() {} |
| 20 |
| 21 void SupervisedUserCreationPolicyHandler::ApplyPolicySettings( |
| 22 const PolicyMap& policies, |
| 23 PrefValueMap* prefs) { |
| 24 // If force sign in is enabled, disable supervised user creation regardless. |
| 25 const base::Value* force_signin_value = |
| 26 policies.GetValue(key::kForceBrowserSignin); |
| 27 bool is_force_signin_enabled; |
| 28 if (force_signin_value && |
| 29 force_signin_value->GetAsBoolean(&is_force_signin_enabled) && |
| 30 is_force_signin_enabled) { |
| 31 prefs->SetBoolean(prefs::kSupervisedUserCreationAllowed, false); |
| 32 return; |
| 33 } |
| 34 |
| 35 const base::Value* creation_value = policies.GetValue(policy_name()); |
| 36 bool is_creation_enabled; |
| 37 if (creation_value && creation_value->GetAsBoolean(&is_creation_enabled)) { |
| 38 prefs->SetBoolean(prefs::kSupervisedUserCreationAllowed, |
| 39 is_creation_enabled); |
| 40 } |
| 41 } |
| 42 |
| 43 } // namespace policy |
| OLD | NEW |