Chromium Code Reviews| Index: chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc |
| diff --git a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc |
| index 17f9b9b5065091e90e97e5a6cf4ba7e37ef46642..5ac98c878a6402cafd60e95f414e7efc37201829 100644 |
| --- a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc |
| +++ b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc |
| @@ -8,7 +8,6 @@ |
| #include "base/logging.h" |
| #include "base/values.h" |
| -#include "chrome/browser/chromeos/policy/app_pack_updater.h" |
| #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
| #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
| #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
| @@ -122,16 +121,31 @@ void DecodeLoginPolicies(const em::ChromeDeviceSettingsProto& policy, |
| const RepeatedPtrField<em::DeviceLocalAccountInfoProto>& accounts = |
| container.account(); |
| if (accounts.size() > 0) { |
| - ListValue* account_list = new ListValue(); |
| + 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.
|
| + new base::DictionaryValue()); |
| RepeatedPtrField<em::DeviceLocalAccountInfoProto>::const_iterator entry; |
| for (entry = accounts.begin(); entry != accounts.end(); ++entry) { |
| - if (entry->has_id()) |
| - account_list->AppendString(entry->id()); |
| + if (entry->id().empty() || account_dict->HasKey(entry->id())) |
| + continue; |
| + |
| + 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
|
| + new base::DictionaryValue()); |
| + if (entry->has_kiosk_app_id()) { |
| + entry_dict->SetStringWithoutPathExpansion( |
| + chromeos::kAccountsPrefDeviceLocalAccountsKeyKioskAppId, |
| + entry->kiosk_app_id()); |
| + } |
| + if (entry->has_kiosk_app_update_url()) { |
| + entry_dict->SetStringWithoutPathExpansion( |
| + chromeos::kAccountsPrefDeviceLocalAccountsKeyKioskAppUpdateURL, |
| + entry->kiosk_app_update_url()); |
| + } |
| + account_dict->Set(entry->id(), entry_dict.release()); |
| } |
| policies->Set(key::kDeviceLocalAccounts, |
| POLICY_LEVEL_MANDATORY, |
| POLICY_SCOPE_MACHINE, |
| - account_list); |
| + account_dict.release()); |
| } |
| if (container.has_auto_login_id()) { |
| policies->Set(key::kDeviceLocalAccountAutoLoginId, |
| @@ -145,6 +159,13 @@ void DecodeLoginPolicies(const em::ChromeDeviceSettingsProto& policy, |
| POLICY_SCOPE_MACHINE, |
| DecodeIntegerValue(container.auto_login_delay())); |
| } |
| + if (container.has_enable_auto_login_bailout()) { |
| + policies->Set(key::kDeviceLocalAccountAutoLoginBailoutEnabled, |
| + POLICY_LEVEL_MANDATORY, |
| + POLICY_SCOPE_MACHINE, |
| + Value::CreateBooleanValue( |
| + container.enable_auto_login_bailout())); |
| + } |
| } |
| } |
| @@ -198,8 +219,8 @@ void DecodeKioskPolicies(const em::ChromeDeviceSettingsProto& policy, |
| const em::AppPackEntryProto& entry(container.app_pack(i)); |
| if (entry.has_extension_id() && entry.has_update_url()) { |
| base::DictionaryValue* dict = new base::DictionaryValue(); |
| - dict->SetString(AppPackUpdater::kExtensionId, entry.extension_id()); |
| - dict->SetString(AppPackUpdater::kUpdateUrl, entry.update_url()); |
| + dict->SetString(chromeos::kAppPackKeyExtensionId, entry.extension_id()); |
| + dict->SetString(chromeos::kAppPackKeyUpdateUrl, entry.update_url()); |
| app_pack_list->Append(dict); |
| } |
| } |