| Index: chrome/browser/chromeos/settings/device_settings_provider.cc
|
| diff --git a/chrome/browser/chromeos/settings/device_settings_provider.cc b/chrome/browser/chromeos/settings/device_settings_provider.cc
|
| index 8663455d75bbd12191dfe8d60584201349d69c3d..18275e746fcba4089880bf3715c910220c78e3ae 100644
|
| --- a/chrome/browser/chromeos/settings/device_settings_provider.cc
|
| +++ b/chrome/browser/chromeos/settings/device_settings_provider.cc
|
| @@ -18,7 +18,6 @@
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/chromeos/cros/cros_library.h"
|
| #include "chrome/browser/chromeos/cros/network_library.h"
|
| -#include "chrome/browser/chromeos/policy/app_pack_updater.h"
|
| #include "chrome/browser/chromeos/settings/cros_settings.h"
|
| #include "chrome/browser/chromeos/settings/cros_settings_names.h"
|
| #include "chrome/browser/chromeos/settings/device_settings_cache.h"
|
| @@ -42,6 +41,7 @@ const char* kKnownSettings[] = {
|
| kAccountsPrefAllowGuest,
|
| kAccountsPrefAllowNewUser,
|
| kAccountsPrefDeviceLocalAccounts,
|
| + kAccountsPrefDeviceLocalAccountAutoLoginBailoutEnabled,
|
| kAccountsPrefDeviceLocalAccountAutoLoginDelay,
|
| kAccountsPrefDeviceLocalAccountAutoLoginId,
|
| kAccountsPrefEphemeralUsersEnabled,
|
| @@ -226,15 +226,42 @@ void DeviceSettingsProvider::SetInPolicy() {
|
| } else if (prop == kAccountsPrefDeviceLocalAccounts) {
|
| em::DeviceLocalAccountsProto* device_local_accounts =
|
| device_settings_.mutable_device_local_accounts();
|
| - base::ListValue* accounts_list;
|
| + device_local_accounts->clear_account();
|
| + const base::ListValue* accounts_list = NULL;
|
| if (value->GetAsList(&accounts_list)) {
|
| for (base::ListValue::const_iterator entry(accounts_list->begin());
|
| entry != accounts_list->end(); ++entry) {
|
| - std::string id;
|
| - if ((*entry)->GetAsString(&id))
|
| - device_local_accounts->add_account()->set_id(id);
|
| - else
|
| + const base::DictionaryValue* entry_dict = NULL;
|
| + if ((*entry)->GetAsDictionary(&entry_dict)) {
|
| + em::DeviceLocalAccountInfoProto* account =
|
| + device_local_accounts->add_account();
|
| + std::string account_id;
|
| + if (entry_dict->GetStringWithoutPathExpansion(
|
| + kAccountsPrefDeviceLocalAccountsKeyId, &account_id)) {
|
| + account->set_account_id(account_id);
|
| + }
|
| + int type;
|
| + if (entry_dict->GetIntegerWithoutPathExpansion(
|
| + kAccountsPrefDeviceLocalAccountsKeyType, &type)) {
|
| + account->set_type(
|
| + static_cast<em::DeviceLocalAccountInfoProto::AccountType>(
|
| + type));
|
| + }
|
| + std::string kiosk_app_id;
|
| + if (entry_dict->GetStringWithoutPathExpansion(
|
| + kAccountsPrefDeviceLocalAccountsKeyKioskAppId,
|
| + &kiosk_app_id)) {
|
| + account->mutable_kiosk_app()->set_app_id(kiosk_app_id);
|
| + }
|
| + std::string kiosk_app_update_url;
|
| + if (entry_dict->GetStringWithoutPathExpansion(
|
| + kAccountsPrefDeviceLocalAccountsKeyKioskAppUpdateURL,
|
| + &kiosk_app_update_url)) {
|
| + account->mutable_kiosk_app()->set_update_url(kiosk_app_update_url);
|
| + }
|
| + } else {
|
| NOTREACHED();
|
| + }
|
| }
|
| } else {
|
| NOTREACHED();
|
| @@ -255,6 +282,14 @@ void DeviceSettingsProvider::SetInPolicy() {
|
| device_local_accounts->set_auto_login_delay(delay);
|
| else
|
| NOTREACHED();
|
| + } else if (prop == kAccountsPrefDeviceLocalAccountAutoLoginBailoutEnabled) {
|
| + em::DeviceLocalAccountsProto* device_local_accounts =
|
| + device_settings_.mutable_device_local_accounts();
|
| + bool enabled;
|
| + if (value->GetAsBoolean(&enabled))
|
| + device_local_accounts->set_enable_auto_login_bailout(enabled);
|
| + else
|
| + NOTREACHED();
|
| } else if (prop == kSignedDataRoamingEnabled) {
|
| em::DataRoamingEnabledProto* roam =
|
| device_settings_.mutable_data_roaming_enabled();
|
| @@ -433,7 +468,7 @@ void DeviceSettingsProvider::DecodeLoginPolicies(
|
| }
|
| new_values_cache->SetValue(kAccountsPrefUsers, list);
|
|
|
| - base::ListValue* account_list = new base::ListValue();
|
| + scoped_ptr<base::ListValue> account_list(new base::ListValue());
|
| CommandLine* command_line = CommandLine::ForCurrentProcess();
|
| if (!command_line->HasSwitch(switches::kDisableLocalAccounts)) {
|
| const em::DeviceLocalAccountsProto device_local_accounts_proto =
|
| @@ -442,22 +477,37 @@ void DeviceSettingsProvider::DecodeLoginPolicies(
|
| device_local_accounts_proto.account();
|
| RepeatedPtrField<em::DeviceLocalAccountInfoProto>::const_iterator entry;
|
| for (entry = accounts.begin(); entry != accounts.end(); ++entry) {
|
| - if (entry->has_id())
|
| - account_list->AppendString(entry->id());
|
| - }
|
| - }
|
| - new_values_cache->SetValue(kAccountsPrefDeviceLocalAccounts, account_list);
|
| -
|
| - if (policy.has_start_up_flags()) {
|
| - base::ListValue* list = new base::ListValue();
|
| - const em::StartUpFlagsProto& flags_proto = policy.start_up_flags();
|
| - const RepeatedPtrField<std::string>& flags = flags_proto.flags();
|
| - for (RepeatedPtrField<std::string>::const_iterator it = flags.begin();
|
| - it != flags.end(); ++it) {
|
| - list->Append(new base::StringValue(*it));
|
| + scoped_ptr<base::DictionaryValue> entry_dict(new base::DictionaryValue());
|
| + if (entry->has_type()) {
|
| + if (entry->has_account_id()) {
|
| + entry_dict->SetStringWithoutPathExpansion(
|
| + kAccountsPrefDeviceLocalAccountsKeyId, entry->account_id());
|
| + }
|
| + entry_dict->SetIntegerWithoutPathExpansion(
|
| + kAccountsPrefDeviceLocalAccountsKeyType, entry->type());
|
| + if (entry->kiosk_app().has_app_id()) {
|
| + entry_dict->SetStringWithoutPathExpansion(
|
| + kAccountsPrefDeviceLocalAccountsKeyKioskAppId,
|
| + entry->kiosk_app().app_id());
|
| + }
|
| + if (entry->kiosk_app().has_update_url()) {
|
| + entry_dict->SetStringWithoutPathExpansion(
|
| + kAccountsPrefDeviceLocalAccountsKeyKioskAppUpdateURL,
|
| + entry->kiosk_app().update_url());
|
| + }
|
| + } else if (entry->has_id()) {
|
| + // Deprecated public session specification.
|
| + entry_dict->SetStringWithoutPathExpansion(
|
| + kAccountsPrefDeviceLocalAccountsKeyId, entry->id());
|
| + entry_dict->SetIntegerWithoutPathExpansion(
|
| + kAccountsPrefDeviceLocalAccountsKeyType,
|
| + DEVICE_LOCAL_ACCOUNT_TYPE_PUBLIC_SESSION);
|
| + }
|
| + account_list->Append(entry_dict.release());
|
| }
|
| - new_values_cache->SetValue(kStartUpFlags, list);
|
| }
|
| + new_values_cache->SetValue(kAccountsPrefDeviceLocalAccounts,
|
| + account_list.release());
|
|
|
| if (policy.has_device_local_accounts()) {
|
| if (policy.device_local_accounts().has_auto_login_id()) {
|
| @@ -471,6 +521,21 @@ void DeviceSettingsProvider::DecodeLoginPolicies(
|
| policy.device_local_accounts().auto_login_delay());
|
| }
|
| }
|
| +
|
| + new_values_cache->SetBoolean(
|
| + kAccountsPrefDeviceLocalAccountAutoLoginBailoutEnabled,
|
| + policy.device_local_accounts().enable_auto_login_bailout());
|
| +
|
| + if (policy.has_start_up_flags()) {
|
| + base::ListValue* list = new base::ListValue();
|
| + const em::StartUpFlagsProto& flags_proto = policy.start_up_flags();
|
| + const RepeatedPtrField<std::string>& flags = flags_proto.flags();
|
| + for (RepeatedPtrField<std::string>::const_iterator it = flags.begin();
|
| + it != flags.end(); ++it) {
|
| + list->Append(new base::StringValue(*it));
|
| + }
|
| + new_values_cache->SetValue(kStartUpFlags, list);
|
| + }
|
| }
|
|
|
| void DeviceSettingsProvider::DecodeKioskPolicies(
|
| @@ -512,11 +577,13 @@ void DeviceSettingsProvider::DecodeKioskPolicies(
|
| it != app_pack.end(); ++it) {
|
| base::DictionaryValue* entry = new base::DictionaryValue;
|
| if (it->has_extension_id()) {
|
| - entry->SetString(policy::AppPackUpdater::kExtensionId,
|
| - it->extension_id());
|
| + entry->SetStringWithoutPathExpansion(kAppPackKeyExtensionId,
|
| + it->extension_id());
|
| + }
|
| + if (it->has_update_url()) {
|
| + entry->SetStringWithoutPathExpansion(kAppPackKeyUpdateUrl,
|
| + it->update_url());
|
| }
|
| - if (it->has_update_url())
|
| - entry->SetString(policy::AppPackUpdater::kUpdateUrl, it->update_url());
|
| list->Append(entry);
|
| }
|
| new_values_cache->SetValue(kAppPack, list);
|
|
|