Chromium Code Reviews| 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" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 } | 49 } |
| 50 | 50 |
| 51 scoped_ptr<PolicyMap> chrome_policy_overrides; | 51 scoped_ptr<PolicyMap> chrome_policy_overrides; |
| 52 if (type == DeviceLocalAccount::TYPE_PUBLIC_SESSION) { | 52 if (type == DeviceLocalAccount::TYPE_PUBLIC_SESSION) { |
| 53 chrome_policy_overrides.reset(new PolicyMap()); | 53 chrome_policy_overrides.reset(new PolicyMap()); |
| 54 | 54 |
| 55 // Exit the session when the lid is closed. The default behavior is to | 55 // 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 | 56 // suspend while leaving the session running, which is not desirable for |
| 57 // public sessions. | 57 // public sessions. |
| 58 chrome_policy_overrides->Set( | 58 chrome_policy_overrides->Set( |
| 59 key::kLidCloseAction, | 59 key::kLidCloseAction, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
|
Thiemo Nagel
2015/09/01 17:40:35
Please try to avoid reformatting existing code.
fhorschig
2015/09/04 06:53:53
Done.
| |
| 60 POLICY_LEVEL_MANDATORY, | |
| 61 POLICY_SCOPE_MACHINE, | |
| 62 new base::FundamentalValue( | 60 new base::FundamentalValue( |
| 63 chromeos::PowerPolicyController::ACTION_STOP_SESSION), | 61 chromeos::PowerPolicyController::ACTION_STOP_SESSION), |
| 64 NULL); | 62 NULL, POLICY_SOURCE_PLATFORM); |
|
Thiemo Nagel
2015/09/01 17:40:35
I'd consider defining a different source for this
fhorschig
2015/09/04 06:53:53
Done. Enforced policies are now of type ENFORCED.
| |
| 65 // Force the |ShelfAutoHideBehavior| policy to |Never|, ensuring that the | 63 // Force the |ShelfAutoHideBehavior| policy to |Never|, ensuring that the |
| 66 // ash shelf does not auto-hide. | 64 // ash shelf does not auto-hide. |
| 67 chrome_policy_overrides->Set( | 65 chrome_policy_overrides->Set(key::kShelfAutoHideBehavior, |
| 68 key::kShelfAutoHideBehavior, | 66 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
| 69 POLICY_LEVEL_MANDATORY, | 67 new base::StringValue("Never"), NULL, |
| 70 POLICY_SCOPE_MACHINE, | 68 POLICY_SOURCE_PLATFORM); |
|
Thiemo Nagel
2015/09/01 17:40:35
see above
fhorschig
2015/09/04 06:53:53
Done.
| |
| 71 new base::StringValue("Never"), | |
| 72 NULL); | |
| 73 // Force the |ShowLogoutButtonInTray| policy to |true|, ensuring that a big, | 69 // Force the |ShowLogoutButtonInTray| policy to |true|, ensuring that a big, |
| 74 // red logout button is shown in the ash system tray. | 70 // red logout button is shown in the ash system tray. |
| 75 chrome_policy_overrides->Set( | 71 chrome_policy_overrides->Set(key::kShowLogoutButtonInTray, |
| 76 key::kShowLogoutButtonInTray, | 72 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
| 77 POLICY_LEVEL_MANDATORY, | 73 new base::FundamentalValue(true), NULL, |
| 78 POLICY_SCOPE_MACHINE, | 74 POLICY_SOURCE_PLATFORM); |
|
Thiemo Nagel
2015/09/01 17:40:35
see above
fhorschig
2015/09/04 06:53:53
Done.
| |
| 79 new base::FundamentalValue(true), | |
| 80 NULL); | |
| 81 // Force the |FullscreenAllowed| policy to |false|, ensuring that the ash | 75 // Force the |FullscreenAllowed| policy to |false|, ensuring that the ash |
| 82 // shelf cannot be hidden by entering fullscreen mode. | 76 // shelf cannot be hidden by entering fullscreen mode. |
| 83 chrome_policy_overrides->Set( | 77 chrome_policy_overrides->Set( |
| 84 key::kFullscreenAllowed, | 78 key::kFullscreenAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
| 85 POLICY_LEVEL_MANDATORY, | 79 new base::FundamentalValue(false), NULL, POLICY_SOURCE_PLATFORM); |
|
Thiemo Nagel
2015/09/01 17:40:35
see above
fhorschig
2015/09/04 06:53:53
Done.
| |
| 86 POLICY_SCOPE_MACHINE, | |
| 87 new base::FundamentalValue(false), | |
| 88 NULL); | |
| 89 } | 80 } |
| 90 | 81 |
| 91 scoped_ptr<DeviceLocalAccountPolicyProvider> provider( | 82 scoped_ptr<DeviceLocalAccountPolicyProvider> provider( |
| 92 new DeviceLocalAccountPolicyProvider(user_id, | 83 new DeviceLocalAccountPolicyProvider(user_id, |
| 93 device_local_account_policy_service, | 84 device_local_account_policy_service, |
| 94 chrome_policy_overrides.Pass())); | 85 chrome_policy_overrides.Pass())); |
| 95 return provider.Pass(); | 86 return provider.Pass(); |
| 96 } | 87 } |
| 97 | 88 |
| 98 bool DeviceLocalAccountPolicyProvider::IsInitializationComplete( | 89 bool DeviceLocalAccountPolicyProvider::IsInitializationComplete( |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 111 if (broker && broker->core()->service()) { | 102 if (broker && broker->core()->service()) { |
| 112 waiting_for_policy_refresh_ = true; | 103 waiting_for_policy_refresh_ = true; |
| 113 broker->core()->service()->RefreshPolicy( | 104 broker->core()->service()->RefreshPolicy( |
| 114 base::Bind(&DeviceLocalAccountPolicyProvider::ReportPolicyRefresh, | 105 base::Bind(&DeviceLocalAccountPolicyProvider::ReportPolicyRefresh, |
| 115 weak_factory_.GetWeakPtr())); | 106 weak_factory_.GetWeakPtr())); |
| 116 } else { | 107 } else { |
| 117 UpdateFromBroker(); | 108 UpdateFromBroker(); |
| 118 } | 109 } |
| 119 } | 110 } |
| 120 | 111 |
| 112 PolicySource DeviceLocalAccountPolicyProvider::source() const { | |
|
Thiemo Nagel
2015/09/01 17:40:35
Remove.
fhorschig
2015/09/04 06:53:52
Done.
| |
| 113 return POLICY_SOURCE_PLATFORM; | |
| 114 } | |
| 115 | |
| 121 void DeviceLocalAccountPolicyProvider::OnPolicyUpdated( | 116 void DeviceLocalAccountPolicyProvider::OnPolicyUpdated( |
| 122 const std::string& user_id) { | 117 const std::string& user_id) { |
| 123 if (user_id == user_id_) | 118 if (user_id == user_id_) |
| 124 UpdateFromBroker(); | 119 UpdateFromBroker(); |
| 125 } | 120 } |
| 126 | 121 |
| 127 void DeviceLocalAccountPolicyProvider::OnDeviceLocalAccountsChanged() { | 122 void DeviceLocalAccountPolicyProvider::OnDeviceLocalAccountsChanged() { |
| 128 UpdateFromBroker(); | 123 UpdateFromBroker(); |
| 129 } | 124 } |
| 130 | 125 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 } | 158 } |
| 164 | 159 |
| 165 // Apply overrides. | 160 // Apply overrides. |
| 166 if (chrome_policy_overrides_) { | 161 if (chrome_policy_overrides_) { |
| 167 PolicyMap& chrome_policy = | 162 PolicyMap& chrome_policy = |
| 168 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); | 163 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); |
| 169 for (PolicyMap::const_iterator it(chrome_policy_overrides_->begin()); | 164 for (PolicyMap::const_iterator it(chrome_policy_overrides_->begin()); |
| 170 it != chrome_policy_overrides_->end(); | 165 it != chrome_policy_overrides_->end(); |
| 171 ++it) { | 166 ++it) { |
| 172 const PolicyMap::Entry& entry = it->second; | 167 const PolicyMap::Entry& entry = it->second; |
| 173 chrome_policy.Set( | 168 chrome_policy.Set(it->first, entry.level, entry.scope, |
| 174 it->first, entry.level, entry.scope, entry.value->DeepCopy(), NULL); | 169 entry.value->DeepCopy(), NULL, POLICY_SOURCE_PLATFORM); |
| 175 } | 170 } |
| 176 } | 171 } |
| 177 | 172 |
| 178 UpdatePolicy(bundle.Pass()); | 173 UpdatePolicy(bundle.Pass()); |
| 179 } | 174 } |
| 180 | 175 |
| 181 } // namespace policy | 176 } // namespace policy |
| OLD | NEW |