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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 std::unique_ptr<PolicyMap> chrome_policy_overrides; | 56 std::unique_ptr<PolicyMap> chrome_policy_overrides; |
57 if (type == DeviceLocalAccount::TYPE_PUBLIC_SESSION) { | 57 if (type == DeviceLocalAccount::TYPE_PUBLIC_SESSION) { |
58 chrome_policy_overrides.reset(new PolicyMap()); | 58 chrome_policy_overrides.reset(new PolicyMap()); |
59 | 59 |
60 // Exit the session when the lid is closed. The default behavior is to | 60 // Exit the session when the lid is closed. The default behavior is to |
61 // suspend while leaving the session running, which is not desirable for | 61 // suspend while leaving the session running, which is not desirable for |
62 // public sessions. | 62 // public sessions. |
63 chrome_policy_overrides->Set( | 63 chrome_policy_overrides->Set( |
64 key::kLidCloseAction, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, | 64 key::kLidCloseAction, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
65 POLICY_SOURCE_PUBLIC_SESSION_OVERRIDE, | 65 POLICY_SOURCE_PUBLIC_SESSION_OVERRIDE, |
66 base::MakeUnique<base::FundamentalValue>( | 66 base::MakeUnique<base::Value>( |
67 chromeos::PowerPolicyController::ACTION_STOP_SESSION), | 67 chromeos::PowerPolicyController::ACTION_STOP_SESSION), |
68 nullptr); | 68 nullptr); |
69 // Force the |ShelfAutoHideBehavior| policy to |Never|, ensuring that the | 69 // Force the |ShelfAutoHideBehavior| policy to |Never|, ensuring that the |
70 // ash shelf does not auto-hide. | 70 // ash shelf does not auto-hide. |
71 chrome_policy_overrides->Set( | 71 chrome_policy_overrides->Set( |
72 key::kShelfAutoHideBehavior, POLICY_LEVEL_MANDATORY, | 72 key::kShelfAutoHideBehavior, POLICY_LEVEL_MANDATORY, |
73 POLICY_SCOPE_MACHINE, POLICY_SOURCE_PUBLIC_SESSION_OVERRIDE, | 73 POLICY_SCOPE_MACHINE, POLICY_SOURCE_PUBLIC_SESSION_OVERRIDE, |
74 base::MakeUnique<base::StringValue>("Never"), nullptr); | 74 base::MakeUnique<base::StringValue>("Never"), nullptr); |
75 // Force the |ShowLogoutButtonInTray| policy to |true|, ensuring that a big, | 75 // Force the |ShowLogoutButtonInTray| policy to |true|, ensuring that a big, |
76 // red logout button is shown in the ash system tray. | 76 // red logout button is shown in the ash system tray. |
77 chrome_policy_overrides->Set( | 77 chrome_policy_overrides->Set(key::kShowLogoutButtonInTray, |
78 key::kShowLogoutButtonInTray, POLICY_LEVEL_MANDATORY, | 78 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
79 POLICY_SCOPE_MACHINE, POLICY_SOURCE_PUBLIC_SESSION_OVERRIDE, | 79 POLICY_SOURCE_PUBLIC_SESSION_OVERRIDE, |
80 base::MakeUnique<base::FundamentalValue>(true), nullptr); | 80 base::MakeUnique<base::Value>(true), nullptr); |
81 // Force the |FullscreenAllowed| policy to |false|, ensuring that the ash | 81 // Force the |FullscreenAllowed| policy to |false|, ensuring that the ash |
82 // shelf cannot be hidden by entering fullscreen mode. | 82 // shelf cannot be hidden by entering fullscreen mode. |
83 chrome_policy_overrides->Set( | 83 chrome_policy_overrides->Set(key::kFullscreenAllowed, |
84 key::kFullscreenAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, | 84 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
85 POLICY_SOURCE_PUBLIC_SESSION_OVERRIDE, | 85 POLICY_SOURCE_PUBLIC_SESSION_OVERRIDE, |
86 base::MakeUnique<base::FundamentalValue>(false), nullptr); | 86 base::MakeUnique<base::Value>(false), nullptr); |
87 } | 87 } |
88 | 88 |
89 std::unique_ptr<DeviceLocalAccountPolicyProvider> provider( | 89 std::unique_ptr<DeviceLocalAccountPolicyProvider> provider( |
90 new DeviceLocalAccountPolicyProvider(user_id, | 90 new DeviceLocalAccountPolicyProvider(user_id, |
91 device_local_account_policy_service, | 91 device_local_account_policy_service, |
92 std::move(chrome_policy_overrides))); | 92 std::move(chrome_policy_overrides))); |
93 // In case of restore-after-restart broker should already be initialized. | 93 // In case of restore-after-restart broker should already be initialized. |
94 if (force_immediate_load && provider->GetBroker()) | 94 if (force_immediate_load && provider->GetBroker()) |
95 provider->GetBroker()->LoadImmediately(); | 95 provider->GetBroker()->LoadImmediately(); |
96 return provider; | 96 return provider; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 const PolicyMap::Entry& entry = policy_override.second; | 175 const PolicyMap::Entry& entry = policy_override.second; |
176 chrome_policy.Set(policy_override.first, entry.level, entry.scope, | 176 chrome_policy.Set(policy_override.first, entry.level, entry.scope, |
177 entry.source, entry.value->CreateDeepCopy(), nullptr); | 177 entry.source, entry.value->CreateDeepCopy(), nullptr); |
178 } | 178 } |
179 } | 179 } |
180 | 180 |
181 UpdatePolicy(std::move(bundle)); | 181 UpdatePolicy(std::move(bundle)); |
182 } | 182 } |
183 | 183 |
184 } // namespace policy | 184 } // namespace policy |
OLD | NEW |