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

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: Make kiosk app ID a separate field in policy. Created 7 years, 8 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/policy/proto/chrome_device_policy.pb.h" 12 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
14 #include "chrome/browser/chromeos/settings/cros_settings_names.h" 13 #include "chrome/browser/chromeos/settings/cros_settings_names.h"
15 #include "chrome/browser/policy/policy_map.h" 14 #include "chrome/browser/policy/policy_map.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::DictionaryValue> account_dict(
bartfab (slow) 2013/04/25 11:17:28 1/ Nit: #include "base/memory/scoped_ptr.h" 2/ W
Mattias Nissler (ping if slow) 2013/04/26 09:10:05 1/ Done. 2/ Habit to avoid memory leaks.
125 new base::DictionaryValue());
126 RepeatedPtrField<em::DeviceLocalAccountInfoProto>::const_iterator entry; 126 RepeatedPtrField<em::DeviceLocalAccountInfoProto>::const_iterator entry;
127 for (entry = accounts.begin(); entry != accounts.end(); ++entry) { 127 for (entry = accounts.begin(); entry != accounts.end(); ++entry) {
128 if (entry->has_id()) 128 if (entry->id().empty() || account_dict->HasKey(entry->id()))
129 account_list->AppendString(entry->id()); 129 continue;
130
131 scoped_ptr<base::DictionaryValue> entry_dict(
bartfab (slow) 2013/04/25 11:17:28 Why use a scoped_ptr if you will pass ownership un
Mattias Nissler (ping if slow) 2013/04/26 09:10:05 See above
132 new base::DictionaryValue());
133 if (entry->has_kiosk_app_id()) {
134 entry_dict->SetStringWithoutPathExpansion(
135 chromeos::kAccountsPrefDeviceLocalAccountsKeyKioskAppId,
136 entry->kiosk_app_id());
137 }
138 if (entry->has_kiosk_app_update_url()) {
139 entry_dict->SetStringWithoutPathExpansion(
140 chromeos::kAccountsPrefDeviceLocalAccountsKeyKioskAppUpdateURL,
141 entry->kiosk_app_update_url());
142 }
143 account_dict->Set(entry->id(), entry_dict.release());
130 } 144 }
131 policies->Set(key::kDeviceLocalAccounts, 145 policies->Set(key::kDeviceLocalAccounts,
132 POLICY_LEVEL_MANDATORY, 146 POLICY_LEVEL_MANDATORY,
133 POLICY_SCOPE_MACHINE, 147 POLICY_SCOPE_MACHINE,
134 account_list); 148 account_dict.release());
135 } 149 }
136 if (container.has_auto_login_id()) { 150 if (container.has_auto_login_id()) {
137 policies->Set(key::kDeviceLocalAccountAutoLoginId, 151 policies->Set(key::kDeviceLocalAccountAutoLoginId,
138 POLICY_LEVEL_MANDATORY, 152 POLICY_LEVEL_MANDATORY,
139 POLICY_SCOPE_MACHINE, 153 POLICY_SCOPE_MACHINE,
140 Value::CreateStringValue(container.auto_login_id())); 154 Value::CreateStringValue(container.auto_login_id()));
141 } 155 }
142 if (container.has_auto_login_delay()) { 156 if (container.has_auto_login_delay()) {
143 policies->Set(key::kDeviceLocalAccountAutoLoginDelay, 157 policies->Set(key::kDeviceLocalAccountAutoLoginDelay,
144 POLICY_LEVEL_MANDATORY, 158 POLICY_LEVEL_MANDATORY,
145 POLICY_SCOPE_MACHINE, 159 POLICY_SCOPE_MACHINE,
146 DecodeIntegerValue(container.auto_login_delay())); 160 DecodeIntegerValue(container.auto_login_delay()));
147 } 161 }
162 if (container.has_enable_auto_login_bailout()) {
163 policies->Set(key::kDeviceLocalAccountAutoLoginBailoutEnabled,
164 POLICY_LEVEL_MANDATORY,
165 POLICY_SCOPE_MACHINE,
166 Value::CreateBooleanValue(
167 container.enable_auto_login_bailout()));
168 }
148 } 169 }
149 } 170 }
150 171
151 void DecodeKioskPolicies(const em::ChromeDeviceSettingsProto& policy, 172 void DecodeKioskPolicies(const em::ChromeDeviceSettingsProto& policy,
152 PolicyMap* policies, 173 PolicyMap* policies,
153 EnterpriseInstallAttributes* install_attributes) { 174 EnterpriseInstallAttributes* install_attributes) {
154 // No policies if this is not KIOSK. 175 // No policies if this is not KIOSK.
155 if (install_attributes->GetMode() != DEVICE_MODE_KIOSK) 176 if (install_attributes->GetMode() != DEVICE_MODE_KIOSK)
156 return; 177 return;
157 178
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 212 }
192 } 213 }
193 214
194 if (policy.has_app_pack()) { 215 if (policy.has_app_pack()) {
195 const em::AppPackProto& container(policy.app_pack()); 216 const em::AppPackProto& container(policy.app_pack());
196 base::ListValue* app_pack_list = new base::ListValue(); 217 base::ListValue* app_pack_list = new base::ListValue();
197 for (int i = 0; i < container.app_pack_size(); ++i) { 218 for (int i = 0; i < container.app_pack_size(); ++i) {
198 const em::AppPackEntryProto& entry(container.app_pack(i)); 219 const em::AppPackEntryProto& entry(container.app_pack(i));
199 if (entry.has_extension_id() && entry.has_update_url()) { 220 if (entry.has_extension_id() && entry.has_update_url()) {
200 base::DictionaryValue* dict = new base::DictionaryValue(); 221 base::DictionaryValue* dict = new base::DictionaryValue();
201 dict->SetString(AppPackUpdater::kExtensionId, entry.extension_id()); 222 dict->SetString(chromeos::kAppPackKeyExtensionId, entry.extension_id());
202 dict->SetString(AppPackUpdater::kUpdateUrl, entry.update_url()); 223 dict->SetString(chromeos::kAppPackKeyUpdateUrl, entry.update_url());
203 app_pack_list->Append(dict); 224 app_pack_list->Append(dict);
204 } 225 }
205 } 226 }
206 policies->Set(key::kDeviceAppPack, 227 policies->Set(key::kDeviceAppPack,
207 POLICY_LEVEL_MANDATORY, 228 POLICY_LEVEL_MANDATORY,
208 POLICY_SCOPE_MACHINE, 229 POLICY_SCOPE_MACHINE,
209 app_pack_list); 230 app_pack_list);
210 } 231 }
211 232
212 if (policy.has_pinned_apps()) { 233 if (policy.has_pinned_apps()) {
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 // Decode the various groups of policies. 514 // Decode the various groups of policies.
494 DecodeLoginPolicies(policy, policies); 515 DecodeLoginPolicies(policy, policies);
495 DecodeKioskPolicies(policy, policies, install_attributes); 516 DecodeKioskPolicies(policy, policies, install_attributes);
496 DecodeNetworkPolicies(policy, policies, install_attributes); 517 DecodeNetworkPolicies(policy, policies, install_attributes);
497 DecodeReportingPolicies(policy, policies); 518 DecodeReportingPolicies(policy, policies);
498 DecodeAutoUpdatePolicies(policy, policies); 519 DecodeAutoUpdatePolicies(policy, policies);
499 DecodeGenericPolicies(policy, policies); 520 DecodeGenericPolicies(policy, policies);
500 } 521 }
501 522
502 } // namespace policy 523 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698