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

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

Issue 14306004: Put Kiosk App parameters into device settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Joao's comments. Created 7 years, 7 months 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 | Annotate | Revision Log
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 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/browser/chromeos/policy/app_pack_updater.h"
12 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" 11 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h"
13 #include "chrome/browser/chromeos/settings/cros_settings_names.h" 12 #include "chrome/browser/chromeos/settings/cros_settings_names.h"
14 #include "chrome/browser/policy/policy_map.h" 13 #include "chrome/browser/policy/policy_map.h"
15 #include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h" 14 #include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h"
16 #include "chromeos/dbus/dbus_thread_manager.h" 15 #include "chromeos/dbus/dbus_thread_manager.h"
17 #include "chromeos/dbus/update_engine_client.h" 16 #include "chromeos/dbus/update_engine_client.h"
18 #include "policy/policy_constants.h" 17 #include "policy/policy_constants.h"
19 #include "third_party/cros_system_api/dbus/service_constants.h" 18 #include "third_party/cros_system_api/dbus/service_constants.h"
20 19
21 using google::protobuf::RepeatedField; 20 using google::protobuf::RepeatedField;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 container.ephemeral_users_enabled())); 114 container.ephemeral_users_enabled()));
116 } 115 }
117 } 116 }
118 117
119 if (policy.has_device_local_accounts()) { 118 if (policy.has_device_local_accounts()) {
120 const em::DeviceLocalAccountsProto& container( 119 const em::DeviceLocalAccountsProto& container(
121 policy.device_local_accounts()); 120 policy.device_local_accounts());
122 const RepeatedPtrField<em::DeviceLocalAccountInfoProto>& accounts = 121 const RepeatedPtrField<em::DeviceLocalAccountInfoProto>& accounts =
123 container.account(); 122 container.account();
124 if (accounts.size() > 0) { 123 if (accounts.size() > 0) {
125 ListValue* account_list = new ListValue(); 124 scoped_ptr<base::ListValue> account_list(new base::ListValue());
126 RepeatedPtrField<em::DeviceLocalAccountInfoProto>::const_iterator entry; 125 RepeatedPtrField<em::DeviceLocalAccountInfoProto>::const_iterator entry;
127 for (entry = accounts.begin(); entry != accounts.end(); ++entry) { 126 for (entry = accounts.begin(); entry != accounts.end(); ++entry) {
128 if (entry->has_id()) 127 scoped_ptr<base::DictionaryValue> entry_dict(
129 account_list->AppendString(entry->id()); 128 new base::DictionaryValue());
129 if (entry->has_type()) {
130 if (entry->has_account_id()) {
131 entry_dict->SetStringWithoutPathExpansion(
132 chromeos::kAccountsPrefDeviceLocalAccountsKeyId,
133 entry->account_id());
134 }
135 entry_dict->SetIntegerWithoutPathExpansion(
136 chromeos::kAccountsPrefDeviceLocalAccountsKeyType, entry->type());
137 if (entry->has_kiosk_app_id()) {
138 entry_dict->SetStringWithoutPathExpansion(
139 chromeos::kAccountsPrefDeviceLocalAccountsKeyKioskAppId,
140 entry->kiosk_app_id());
141 }
142 if (entry->has_kiosk_app_update_url()) {
143 entry_dict->SetStringWithoutPathExpansion(
144 chromeos::kAccountsPrefDeviceLocalAccountsKeyKioskAppUpdateURL,
145 entry->kiosk_app_update_url());
146 }
147 } else {
148 // Deprecated public session specification.
149 entry_dict->SetStringWithoutPathExpansion(
150 chromeos::kAccountsPrefDeviceLocalAccountsKeyId,
151 entry->deprecated_public_session_id());
152 entry_dict->SetIntegerWithoutPathExpansion(
153 chromeos::kAccountsPrefDeviceLocalAccountsKeyType,
154 chromeos::DEVICE_LOCAL_ACCOUNT_TYPE_PUBLIC_SESSION);
155 }
156 account_list->Append(entry_dict.release());
130 } 157 }
131 policies->Set(key::kDeviceLocalAccounts, 158 policies->Set(key::kDeviceLocalAccounts,
132 POLICY_LEVEL_MANDATORY, 159 POLICY_LEVEL_MANDATORY,
133 POLICY_SCOPE_MACHINE, 160 POLICY_SCOPE_MACHINE,
134 account_list); 161 account_list.release());
135 } 162 }
136 if (container.has_auto_login_id()) { 163 if (container.has_auto_login_id()) {
137 policies->Set(key::kDeviceLocalAccountAutoLoginId, 164 policies->Set(key::kDeviceLocalAccountAutoLoginId,
138 POLICY_LEVEL_MANDATORY, 165 POLICY_LEVEL_MANDATORY,
139 POLICY_SCOPE_MACHINE, 166 POLICY_SCOPE_MACHINE,
140 Value::CreateStringValue(container.auto_login_id())); 167 Value::CreateStringValue(container.auto_login_id()));
141 } 168 }
142 if (container.has_auto_login_delay()) { 169 if (container.has_auto_login_delay()) {
143 policies->Set(key::kDeviceLocalAccountAutoLoginDelay, 170 policies->Set(key::kDeviceLocalAccountAutoLoginDelay,
144 POLICY_LEVEL_MANDATORY, 171 POLICY_LEVEL_MANDATORY,
145 POLICY_SCOPE_MACHINE, 172 POLICY_SCOPE_MACHINE,
146 DecodeIntegerValue(container.auto_login_delay())); 173 DecodeIntegerValue(container.auto_login_delay()));
147 } 174 }
175 if (container.has_enable_auto_login_bailout()) {
176 policies->Set(key::kDeviceLocalAccountAutoLoginBailoutEnabled,
177 POLICY_LEVEL_MANDATORY,
178 POLICY_SCOPE_MACHINE,
179 Value::CreateBooleanValue(
180 container.enable_auto_login_bailout()));
181 }
148 } 182 }
149 } 183 }
150 184
151 void DecodeKioskPolicies(const em::ChromeDeviceSettingsProto& policy, 185 void DecodeKioskPolicies(const em::ChromeDeviceSettingsProto& policy,
152 PolicyMap* policies, 186 PolicyMap* policies,
153 EnterpriseInstallAttributes* install_attributes) { 187 EnterpriseInstallAttributes* install_attributes) {
154 // No policies if this is not KIOSK. 188 // No policies if this is not KIOSK.
155 if (install_attributes->GetMode() != DEVICE_MODE_KIOSK) 189 if (install_attributes->GetMode() != DEVICE_MODE_KIOSK)
156 return; 190 return;
157 191
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 225 }
192 } 226 }
193 227
194 if (policy.has_app_pack()) { 228 if (policy.has_app_pack()) {
195 const em::AppPackProto& container(policy.app_pack()); 229 const em::AppPackProto& container(policy.app_pack());
196 base::ListValue* app_pack_list = new base::ListValue(); 230 base::ListValue* app_pack_list = new base::ListValue();
197 for (int i = 0; i < container.app_pack_size(); ++i) { 231 for (int i = 0; i < container.app_pack_size(); ++i) {
198 const em::AppPackEntryProto& entry(container.app_pack(i)); 232 const em::AppPackEntryProto& entry(container.app_pack(i));
199 if (entry.has_extension_id() && entry.has_update_url()) { 233 if (entry.has_extension_id() && entry.has_update_url()) {
200 base::DictionaryValue* dict = new base::DictionaryValue(); 234 base::DictionaryValue* dict = new base::DictionaryValue();
201 dict->SetString(AppPackUpdater::kExtensionId, entry.extension_id()); 235 dict->SetString(chromeos::kAppPackKeyExtensionId, entry.extension_id());
202 dict->SetString(AppPackUpdater::kUpdateUrl, entry.update_url()); 236 dict->SetString(chromeos::kAppPackKeyUpdateUrl, entry.update_url());
203 app_pack_list->Append(dict); 237 app_pack_list->Append(dict);
204 } 238 }
205 } 239 }
206 policies->Set(key::kDeviceAppPack, 240 policies->Set(key::kDeviceAppPack,
207 POLICY_LEVEL_MANDATORY, 241 POLICY_LEVEL_MANDATORY,
208 POLICY_SCOPE_MACHINE, 242 POLICY_SCOPE_MACHINE,
209 app_pack_list); 243 app_pack_list);
210 } 244 }
211 245
212 if (policy.has_pinned_apps()) { 246 if (policy.has_pinned_apps()) {
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 // Decode the various groups of policies. 527 // Decode the various groups of policies.
494 DecodeLoginPolicies(policy, policies); 528 DecodeLoginPolicies(policy, policies);
495 DecodeKioskPolicies(policy, policies, install_attributes); 529 DecodeKioskPolicies(policy, policies, install_attributes);
496 DecodeNetworkPolicies(policy, policies, install_attributes); 530 DecodeNetworkPolicies(policy, policies, install_attributes);
497 DecodeReportingPolicies(policy, policies); 531 DecodeReportingPolicies(policy, policies);
498 DecodeAutoUpdatePolicies(policy, policies); 532 DecodeAutoUpdatePolicies(policy, policies);
499 DecodeGenericPolicies(policy, policies); 533 DecodeGenericPolicies(policy, policies);
500 } 534 }
501 535
502 } // namespace policy 536 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698