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

Side by Side Diff: chrome/browser/chromeos/settings/device_settings_provider.cc

Issue 189163006: Remove --disable-local-accounts flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/settings/device_settings_provider.h" 5 #include "chrome/browser/chromeos/settings/device_settings_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h"
11 #include "base/logging.h" 10 #include "base/logging.h"
12 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
13 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
14 #include "base/threading/thread_restrictions.h" 13 #include "base/threading/thread_restrictions.h"
15 #include "base/values.h" 14 #include "base/values.h"
16 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 16 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
18 #include "chrome/browser/chromeos/policy/device_local_account.h" 17 #include "chrome/browser/chromeos/policy/device_local_account.h"
19 #include "chrome/browser/chromeos/settings/cros_settings.h" 18 #include "chrome/browser/chromeos/settings/cros_settings.h"
20 #include "chrome/browser/chromeos/settings/device_settings_cache.h" 19 #include "chrome/browser/chromeos/settings/device_settings_cache.h"
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 const em::UserWhitelistProto& whitelist_proto = policy.user_whitelist(); 480 const em::UserWhitelistProto& whitelist_proto = policy.user_whitelist();
482 const RepeatedPtrField<std::string>& whitelist = 481 const RepeatedPtrField<std::string>& whitelist =
483 whitelist_proto.user_whitelist(); 482 whitelist_proto.user_whitelist();
484 for (RepeatedPtrField<std::string>::const_iterator it = whitelist.begin(); 483 for (RepeatedPtrField<std::string>::const_iterator it = whitelist.begin();
485 it != whitelist.end(); ++it) { 484 it != whitelist.end(); ++it) {
486 list->Append(new base::StringValue(*it)); 485 list->Append(new base::StringValue(*it));
487 } 486 }
488 new_values_cache->SetValue(kAccountsPrefUsers, list); 487 new_values_cache->SetValue(kAccountsPrefUsers, list);
489 488
490 scoped_ptr<base::ListValue> account_list(new base::ListValue()); 489 scoped_ptr<base::ListValue> account_list(new base::ListValue());
491 CommandLine* command_line = CommandLine::ForCurrentProcess(); 490 const em::DeviceLocalAccountsProto device_local_accounts_proto =
492 if (!command_line->HasSwitch(switches::kDisableLocalAccounts)) { 491 policy.device_local_accounts();
493 const em::DeviceLocalAccountsProto device_local_accounts_proto = 492 const RepeatedPtrField<em::DeviceLocalAccountInfoProto>& accounts =
494 policy.device_local_accounts(); 493 device_local_accounts_proto.account();
495 const RepeatedPtrField<em::DeviceLocalAccountInfoProto>& accounts = 494 RepeatedPtrField<em::DeviceLocalAccountInfoProto>::const_iterator entry;
496 device_local_accounts_proto.account(); 495 for (entry = accounts.begin(); entry != accounts.end(); ++entry) {
497 RepeatedPtrField<em::DeviceLocalAccountInfoProto>::const_iterator entry; 496 scoped_ptr<base::DictionaryValue> entry_dict(new base::DictionaryValue());
498 for (entry = accounts.begin(); entry != accounts.end(); ++entry) { 497 if (entry->has_type()) {
499 scoped_ptr<base::DictionaryValue> entry_dict(new base::DictionaryValue()); 498 if (entry->has_account_id()) {
500 if (entry->has_type()) {
501 if (entry->has_account_id()) {
502 entry_dict->SetStringWithoutPathExpansion(
503 kAccountsPrefDeviceLocalAccountsKeyId, entry->account_id());
504 }
505 entry_dict->SetIntegerWithoutPathExpansion(
506 kAccountsPrefDeviceLocalAccountsKeyType, entry->type());
507 if (entry->kiosk_app().has_app_id()) {
508 entry_dict->SetStringWithoutPathExpansion(
509 kAccountsPrefDeviceLocalAccountsKeyKioskAppId,
510 entry->kiosk_app().app_id());
511 }
512 } else if (entry->has_deprecated_public_session_id()) {
513 // Deprecated public session specification.
514 entry_dict->SetStringWithoutPathExpansion( 499 entry_dict->SetStringWithoutPathExpansion(
515 kAccountsPrefDeviceLocalAccountsKeyId, 500 kAccountsPrefDeviceLocalAccountsKeyId, entry->account_id());
516 entry->deprecated_public_session_id());
517 entry_dict->SetIntegerWithoutPathExpansion(
518 kAccountsPrefDeviceLocalAccountsKeyType,
519 policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION);
520 } 501 }
521 account_list->Append(entry_dict.release()); 502 entry_dict->SetIntegerWithoutPathExpansion(
503 kAccountsPrefDeviceLocalAccountsKeyType, entry->type());
504 if (entry->kiosk_app().has_app_id()) {
505 entry_dict->SetStringWithoutPathExpansion(
506 kAccountsPrefDeviceLocalAccountsKeyKioskAppId,
507 entry->kiosk_app().app_id());
508 }
509 } else if (entry->has_deprecated_public_session_id()) {
510 // Deprecated public session specification.
511 entry_dict->SetStringWithoutPathExpansion(
512 kAccountsPrefDeviceLocalAccountsKeyId,
513 entry->deprecated_public_session_id());
514 entry_dict->SetIntegerWithoutPathExpansion(
515 kAccountsPrefDeviceLocalAccountsKeyType,
516 policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION);
522 } 517 }
518 account_list->Append(entry_dict.release());
523 } 519 }
524 new_values_cache->SetValue(kAccountsPrefDeviceLocalAccounts, 520 new_values_cache->SetValue(kAccountsPrefDeviceLocalAccounts,
525 account_list.release()); 521 account_list.release());
526 522
527 if (policy.has_device_local_accounts()) { 523 if (policy.has_device_local_accounts()) {
528 if (policy.device_local_accounts().has_auto_login_id()) { 524 if (policy.device_local_accounts().has_auto_login_id()) {
529 new_values_cache->SetString( 525 new_values_cache->SetString(
530 kAccountsPrefDeviceLocalAccountAutoLoginId, 526 kAccountsPrefDeviceLocalAccountAutoLoginId,
531 policy.device_local_accounts().auto_login_id()); 527 policy.device_local_accounts().auto_login_id());
532 } 528 }
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 void DeviceSettingsProvider::AttemptMigration() { 972 void DeviceSettingsProvider::AttemptMigration() {
977 if (device_settings_service_->HasPrivateOwnerKey()) { 973 if (device_settings_service_->HasPrivateOwnerKey()) {
978 PrefValueMap::const_iterator i; 974 PrefValueMap::const_iterator i;
979 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) 975 for (i = migration_values_.begin(); i != migration_values_.end(); ++i)
980 DoSet(i->first, *i->second); 976 DoSet(i->first, *i->second);
981 migration_values_.Clear(); 977 migration_values_.Clear();
982 } 978 }
983 } 979 }
984 980
985 } // namespace chromeos 981 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc ('k') | chromeos/chromeos_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698