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

Unified Diff: chrome/browser/chromeos/settings/device_settings_provider.cc

Issue 11358113: Add device policy definition for local accounts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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 5f28b168bb8c0ab570ee5d3590347793c4a6c48d..7bf22080923961665cdaee0109ed6f4281523651 100644
--- a/chrome/browser/chromeos/settings/device_settings_provider.cc
+++ b/chrome/browser/chromeos/settings/device_settings_provider.cc
@@ -40,6 +40,7 @@ const char* kKnownSettings[] = {
kAccountsPrefEphemeralUsersEnabled,
kAccountsPrefShowUserNamesOnSignIn,
kAccountsPrefUsers,
+ kAccountsPrefLocalAccounts,
kAppPack,
kDeviceOwner,
kIdleLogoutTimeout,
@@ -211,6 +212,30 @@ void DeviceSettingsProvider::SetInPolicy() {
show->set_show_user_names(show_value);
else
NOTREACHED();
+ } else if (prop == kAccountsPrefLocalAccounts) {
+ em::LocalAccountsProto * local_accounts =
pastarmovj 2012/11/06 12:42:15 one space too much.
Mattias Nissler (ping if slow) 2012/11/12 15:50:51 Done.
+ device_settings_.mutable_local_accounts();
+ base::ListValue* accounts_list;
+ if (value->GetAsList(&accounts_list)) {
+ for (base::ListValue::const_iterator entry(accounts_list->begin());
+ entry != accounts_list->end(); ++entry) {
+ base::DictionaryValue* entry_dict;
+ std::string id;
+ std::string name;
+ if (!(*entry)->GetAsDictionary(&entry_dict) ||
pastarmovj 2012/11/06 12:42:15 Isn't the logic inverted here? If not read then se
Mattias Nissler (ping if slow) 2012/11/12 15:50:51 Done.
+ !entry_dict->GetString(kLocalAccountId, &id) ||
+ !entry_dict->GetString(kLocalAccountName, &name)) {
+ em::LocalAccountDefinitionProto* proto_entry =
+ local_accounts->add_local_account();
+ proto_entry->set_id(id);
+ proto_entry->set_name(name);
+ } else {
+ NOTREACHED();
+ }
+ }
+ } else {
+ NOTREACHED();
+ }
} else if (prop == kSignedDataRoamingEnabled) {
em::DataRoamingEnabledProto* roam =
device_settings_.mutable_data_roaming_enabled();
@@ -361,6 +386,20 @@ void DeviceSettingsProvider::DecodeLoginPolicies(
list->Append(base::Value::CreateStringValue(*it));
}
new_values_cache->SetValue(kAccountsPrefUsers, list);
+
+ base::ListValue* account_list = new base::ListValue();
+ const RepeatedPtrField<em::LocalAccountDefinitionProto>& local_accounts =
+ policy.local_accounts().local_account();
+ RepeatedPtrField<em::LocalAccountDefinitionProto>::const_iterator entry;
+ for (entry = local_accounts.begin(); entry != local_accounts.end(); ++entry) {
+ if (entry->has_id() && entry->has_name()) {
+ base::DictionaryValue* account_dict = new base::DictionaryValue();
+ account_dict->SetString(kLocalAccountId, entry->id());
+ account_dict->SetString(kLocalAccountName, entry->name());
+ account_list->Append(account_dict);
+ }
+ }
+ new_values_cache->SetValue(kAccountsPrefLocalAccounts, account_list);
}
void DeviceSettingsProvider::DecodeKioskPolicies(

Powered by Google App Engine
This is Rietveld 408576698