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

Side by Side Diff: chrome/browser/chromeos/login/user_manager_impl.cc

Issue 14306004: Put Kiosk App parameters into device settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 7 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/login/user_manager_impl.h" 5 #include "chrome/browser/chromeos/login/user_manager_impl.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 local_state->GetDictionary(kUserDisplayEmail); 850 local_state->GetDictionary(kUserDisplayEmail);
851 851
852 // Load regular users and locally managed users. 852 // Load regular users and locally managed users.
853 std::vector<std::string> regular_users; 853 std::vector<std::string> regular_users;
854 std::set<std::string> regular_users_set; 854 std::set<std::string> regular_users_set;
855 ParseUserList(*prefs_regular_users, std::set<std::string>(), "", 855 ParseUserList(*prefs_regular_users, std::set<std::string>(), "",
856 &regular_users, &regular_users_set); 856 &regular_users, &regular_users_set);
857 for (std::vector<std::string>::const_iterator it = regular_users.begin(); 857 for (std::vector<std::string>::const_iterator it = regular_users.begin();
858 it != regular_users.end(); ++it) { 858 it != regular_users.end(); ++it) {
859 User* user = NULL; 859 User* user = NULL;
860 if (gaia::ExtractDomainName(*it) == 860 const std::string domain = gaia::ExtractDomainName(*it);
861 UserManager::kLocallyManagedUserDomain) { 861 if (domain == UserManager::kLocallyManagedUserDomain) {
862 user = User::CreateLocallyManagedUser(*it); 862 user = User::CreateLocallyManagedUser(*it);
863 } else { 863 } else {
864 user = User::CreateRegularUser(*it); 864 user = User::CreateRegularUser(*it);
865 user->set_oauth_token_status(LoadUserOAuthStatus(*it)); 865 user->set_oauth_token_status(LoadUserOAuthStatus(*it));
866 } 866 }
867 users_.push_back(user); 867 users_.push_back(user);
868 868
869 string16 display_name; 869 string16 display_name;
870 if (prefs_display_names->GetStringWithoutPathExpansion(*it, 870 if (prefs_display_names->GetStringWithoutPathExpansion(*it,
871 &display_name)) { 871 &display_name)) {
(...skipping 28 matching lines...) Expand all
900 // Schedule a callback if device policy has not yet been verified. 900 // Schedule a callback if device policy has not yet been verified.
901 if (CrosSettingsProvider::TRUSTED != cros_settings_->PrepareTrustedValues( 901 if (CrosSettingsProvider::TRUSTED != cros_settings_->PrepareTrustedValues(
902 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies, 902 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies,
903 base::Unretained(this)))) { 903 base::Unretained(this)))) {
904 return; 904 return;
905 } 905 }
906 906
907 cros_settings_->GetBoolean(kAccountsPrefEphemeralUsersEnabled, 907 cros_settings_->GetBoolean(kAccountsPrefEphemeralUsersEnabled,
908 &ephemeral_users_enabled_); 908 &ephemeral_users_enabled_);
909 cros_settings_->GetString(kDeviceOwner, &owner_email_); 909 cros_settings_->GetString(kDeviceOwner, &owner_email_);
910 const base::ListValue* public_accounts; 910 base::ListValue public_accounts;
911 cros_settings_->GetList(kAccountsPrefDeviceLocalAccounts, &public_accounts); 911 ReadPublicAccounts(&public_accounts);
912 912
913 EnsureUsersLoaded(); 913 EnsureUsersLoaded();
914 914
915 bool changed = UpdateAndCleanUpPublicAccounts(*public_accounts); 915 bool changed = UpdateAndCleanUpPublicAccounts(public_accounts);
916 916
917 // If ephemeral users are enabled and we are on the login screen, take this 917 // If ephemeral users are enabled and we are on the login screen, take this
918 // opportunity to clean up by removing all regular users except the owner. 918 // opportunity to clean up by removing all regular users except the owner.
919 if (ephemeral_users_enabled_ && !IsUserLoggedIn()) { 919 if (ephemeral_users_enabled_ && !IsUserLoggedIn()) {
920 ListPrefUpdate prefs_users_update(g_browser_process->local_state(), 920 ListPrefUpdate prefs_users_update(g_browser_process->local_state(),
921 kRegularUsers); 921 kRegularUsers);
922 prefs_users_update->Clear(); 922 prefs_users_update->Clear();
923 for (UserList::iterator it = users_.begin(); it != users_.end(); ) { 923 for (UserList::iterator it = users_.begin(); it != users_.end(); ) {
924 const std::string user_email = (*it)->email(); 924 const std::string user_email = (*it)->email();
925 if ((*it)->GetType() == User::USER_TYPE_REGULAR && 925 if ((*it)->GetType() == User::USER_TYPE_REGULAR &&
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 else if (active_user_->GetType() == User::USER_TYPE_LOCALLY_MANAGED) 1450 else if (active_user_->GetType() == User::USER_TYPE_LOCALLY_MANAGED)
1451 login_user_type = LoginState::LOGGED_IN_USER_LOCALLY_MANAGED; 1451 login_user_type = LoginState::LOGGED_IN_USER_LOCALLY_MANAGED;
1452 else if (active_user_->GetType() == User::USER_TYPE_KIOSK_APP) 1452 else if (active_user_->GetType() == User::USER_TYPE_KIOSK_APP)
1453 login_user_type = LoginState::LOGGED_IN_USER_KIOSK_APP; 1453 login_user_type = LoginState::LOGGED_IN_USER_KIOSK_APP;
1454 else 1454 else
1455 login_user_type = LoginState::LOGGED_IN_USER_REGULAR; 1455 login_user_type = LoginState::LOGGED_IN_USER_REGULAR;
1456 1456
1457 LoginState::Get()->SetLoggedInState(logged_in_state, login_user_type); 1457 LoginState::Get()->SetLoggedInState(logged_in_state, login_user_type);
1458 } 1458 }
1459 1459
1460 void UserManagerImpl::ReadPublicAccounts(base::ListValue* public_accounts) {
1461 const base::ListValue* accounts = NULL;
1462 if (cros_settings_->GetList(kAccountsPrefDeviceLocalAccounts, &accounts)) {
1463 for (base::ListValue::const_iterator entry(accounts->begin());
1464 entry != accounts->end(); ++entry) {
1465 const base::DictionaryValue* entry_dict = NULL;
1466 if (!(*entry)->GetAsDictionary(&entry_dict)) {
1467 NOTREACHED();
1468 continue;
1469 }
1470
1471 int type = DEVICE_LOCAL_ACCOUNT_TYPE_PUBLIC_SESSION;
1472 entry_dict->GetIntegerWithoutPathExpansion(
1473 kAccountsPrefDeviceLocalAccountsKeyType, &type);
1474 switch (type) {
1475 case DEVICE_LOCAL_ACCOUNT_TYPE_PUBLIC_SESSION: {
1476 std::string id;
1477 if (entry_dict->GetStringWithoutPathExpansion(
1478 kAccountsPrefDeviceLocalAccountsKeyId, &id)) {
1479 public_accounts->AppendString(id);
1480 }
1481 break;
1482 }
1483 case DEVICE_LOCAL_ACCOUNT_TYPE_KIOSK_APP:
1484 // TODO(mnissler, nkostylev, bartfab): Process Kiosk Apps within the
1485 // standard login framework: http://crbug.com/234694
1486 break;
1487 }
1488 }
1489 }
1490 }
1491
1460 } // namespace chromeos 1492 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_manager_impl.h ('k') | chrome/browser/chromeos/policy/app_pack_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698