| OLD | NEW |
| 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_local_account_policy_provider.h" | 5 #include "chrome/browser/chromeos/policy/device_local_account_policy_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/chromeos/policy/device_local_account.h" | 9 #include "chrome/browser/chromeos/policy/device_local_account.h" |
| 10 #include "chrome/browser/chromeos/policy/device_local_account_external_data_mana
ger.h" | 10 #include "chrome/browser/chromeos/policy/device_local_account_external_data_mana
ger.h" |
| 11 #include "chromeos/dbus/power_policy_controller.h" | 11 #include "chromeos/dbus/power_policy_controller.h" |
| 12 #include "components/policy/core/common/cloud/cloud_policy_core.h" | 12 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
| 13 #include "components/policy/core/common/cloud/cloud_policy_service.h" | 13 #include "components/policy/core/common/cloud/cloud_policy_service.h" |
| 14 #include "components/policy/core/common/cloud/component_cloud_policy_service.h" | 14 #include "components/policy/core/common/cloud/component_cloud_policy_service.h" |
| 15 #include "components/policy/core/common/policy_bundle.h" | 15 #include "components/policy/core/common/policy_bundle.h" |
| 16 #include "components/policy/core/common/policy_map.h" | 16 #include "components/policy/core/common/policy_map.h" |
| 17 #include "components/policy/core/common/policy_namespace.h" | 17 #include "components/policy/core/common/policy_namespace.h" |
| 18 #include "components/policy/core/common/policy_types.h" |
| 18 #include "policy/policy_constants.h" | 19 #include "policy/policy_constants.h" |
| 19 | 20 |
| 20 namespace policy { | 21 namespace policy { |
| 21 | 22 |
| 22 DeviceLocalAccountPolicyProvider::DeviceLocalAccountPolicyProvider( | 23 DeviceLocalAccountPolicyProvider::DeviceLocalAccountPolicyProvider( |
| 23 const std::string& user_id, | 24 const std::string& user_id, |
| 24 DeviceLocalAccountPolicyService* service, | 25 DeviceLocalAccountPolicyService* service, |
| 25 scoped_ptr<PolicyMap> chrome_policy_overrides) | 26 scoped_ptr<PolicyMap> chrome_policy_overrides) |
| 26 : user_id_(user_id), | 27 : user_id_(user_id), |
| 27 service_(service), | 28 service_(service), |
| (...skipping 24 matching lines...) Expand all Loading... |
| 52 if (type == DeviceLocalAccount::TYPE_PUBLIC_SESSION) { | 53 if (type == DeviceLocalAccount::TYPE_PUBLIC_SESSION) { |
| 53 chrome_policy_overrides.reset(new PolicyMap()); | 54 chrome_policy_overrides.reset(new PolicyMap()); |
| 54 | 55 |
| 55 // Exit the session when the lid is closed. The default behavior is to | 56 // Exit the session when the lid is closed. The default behavior is to |
| 56 // suspend while leaving the session running, which is not desirable for | 57 // suspend while leaving the session running, which is not desirable for |
| 57 // public sessions. | 58 // public sessions. |
| 58 chrome_policy_overrides->Set( | 59 chrome_policy_overrides->Set( |
| 59 key::kLidCloseAction, | 60 key::kLidCloseAction, |
| 60 POLICY_LEVEL_MANDATORY, | 61 POLICY_LEVEL_MANDATORY, |
| 61 POLICY_SCOPE_MACHINE, | 62 POLICY_SCOPE_MACHINE, |
| 63 POLICY_SOURCE_ENTERPRISE_OVERRIDE, |
| 62 new base::FundamentalValue( | 64 new base::FundamentalValue( |
| 63 chromeos::PowerPolicyController::ACTION_STOP_SESSION), | 65 chromeos::PowerPolicyController::ACTION_STOP_SESSION), |
| 64 NULL); | 66 NULL); |
| 65 // Force the |ShelfAutoHideBehavior| policy to |Never|, ensuring that the | 67 // Force the |ShelfAutoHideBehavior| policy to |Never|, ensuring that the |
| 66 // ash shelf does not auto-hide. | 68 // ash shelf does not auto-hide. |
| 67 chrome_policy_overrides->Set( | 69 chrome_policy_overrides->Set( |
| 68 key::kShelfAutoHideBehavior, | 70 key::kShelfAutoHideBehavior, |
| 69 POLICY_LEVEL_MANDATORY, | 71 POLICY_LEVEL_MANDATORY, |
| 70 POLICY_SCOPE_MACHINE, | 72 POLICY_SCOPE_MACHINE, |
| 73 POLICY_SOURCE_ENTERPRISE_OVERRIDE, |
| 71 new base::StringValue("Never"), | 74 new base::StringValue("Never"), |
| 72 NULL); | 75 NULL); |
| 73 // Force the |ShowLogoutButtonInTray| policy to |true|, ensuring that a big, | 76 // Force the |ShowLogoutButtonInTray| policy to |true|, ensuring that a big, |
| 74 // red logout button is shown in the ash system tray. | 77 // red logout button is shown in the ash system tray. |
| 75 chrome_policy_overrides->Set( | 78 chrome_policy_overrides->Set( |
| 76 key::kShowLogoutButtonInTray, | 79 key::kShowLogoutButtonInTray, |
| 77 POLICY_LEVEL_MANDATORY, | 80 POLICY_LEVEL_MANDATORY, |
| 78 POLICY_SCOPE_MACHINE, | 81 POLICY_SCOPE_MACHINE, |
| 82 POLICY_SOURCE_ENTERPRISE_OVERRIDE, |
| 79 new base::FundamentalValue(true), | 83 new base::FundamentalValue(true), |
| 80 NULL); | 84 NULL); |
| 81 // Force the |FullscreenAllowed| policy to |false|, ensuring that the ash | 85 // Force the |FullscreenAllowed| policy to |false|, ensuring that the ash |
| 82 // shelf cannot be hidden by entering fullscreen mode. | 86 // shelf cannot be hidden by entering fullscreen mode. |
| 83 chrome_policy_overrides->Set( | 87 chrome_policy_overrides->Set( |
| 84 key::kFullscreenAllowed, | 88 key::kFullscreenAllowed, |
| 85 POLICY_LEVEL_MANDATORY, | 89 POLICY_LEVEL_MANDATORY, |
| 86 POLICY_SCOPE_MACHINE, | 90 POLICY_SCOPE_MACHINE, |
| 91 POLICY_SOURCE_ENTERPRISE_OVERRIDE, |
| 87 new base::FundamentalValue(false), | 92 new base::FundamentalValue(false), |
| 88 NULL); | 93 NULL); |
| 89 } | 94 } |
| 90 | 95 |
| 91 scoped_ptr<DeviceLocalAccountPolicyProvider> provider( | 96 scoped_ptr<DeviceLocalAccountPolicyProvider> provider( |
| 92 new DeviceLocalAccountPolicyProvider(user_id, | 97 new DeviceLocalAccountPolicyProvider(user_id, |
| 93 device_local_account_policy_service, | 98 device_local_account_policy_service, |
| 94 chrome_policy_overrides.Pass())); | 99 chrome_policy_overrides.Pass())); |
| 95 return provider.Pass(); | 100 return provider.Pass(); |
| 96 } | 101 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 168 } |
| 164 | 169 |
| 165 // Apply overrides. | 170 // Apply overrides. |
| 166 if (chrome_policy_overrides_) { | 171 if (chrome_policy_overrides_) { |
| 167 PolicyMap& chrome_policy = | 172 PolicyMap& chrome_policy = |
| 168 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); | 173 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); |
| 169 for (PolicyMap::const_iterator it(chrome_policy_overrides_->begin()); | 174 for (PolicyMap::const_iterator it(chrome_policy_overrides_->begin()); |
| 170 it != chrome_policy_overrides_->end(); | 175 it != chrome_policy_overrides_->end(); |
| 171 ++it) { | 176 ++it) { |
| 172 const PolicyMap::Entry& entry = it->second; | 177 const PolicyMap::Entry& entry = it->second; |
| 173 chrome_policy.Set( | 178 chrome_policy.Set(it->first, |
| 174 it->first, entry.level, entry.scope, entry.value->DeepCopy(), NULL); | 179 entry.level, |
| 180 entry.scope, |
| 181 entry.source, |
| 182 entry.value->DeepCopy(), |
| 183 nullptr); |
| 175 } | 184 } |
| 176 } | 185 } |
| 177 | 186 |
| 178 UpdatePolicy(bundle.Pass()); | 187 UpdatePolicy(bundle.Pass()); |
| 179 } | 188 } |
| 180 | 189 |
| 181 } // namespace policy | 190 } // namespace policy |
| OLD | NEW |