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

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 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 local_state->GetDictionary(kUserDisplayEmail); 844 local_state->GetDictionary(kUserDisplayEmail);
845 845
846 // Load regular users and locally managed users. 846 // Load regular users and locally managed users.
847 std::vector<std::string> regular_users; 847 std::vector<std::string> regular_users;
848 std::set<std::string> regular_users_set; 848 std::set<std::string> regular_users_set;
849 ParseUserList(*prefs_regular_users, std::set<std::string>(), "", 849 ParseUserList(*prefs_regular_users, std::set<std::string>(), "",
850 &regular_users, &regular_users_set); 850 &regular_users, &regular_users_set);
851 for (std::vector<std::string>::const_iterator it = regular_users.begin(); 851 for (std::vector<std::string>::const_iterator it = regular_users.begin();
852 it != regular_users.end(); ++it) { 852 it != regular_users.end(); ++it) {
853 User* user = NULL; 853 User* user = NULL;
854 if (gaia::ExtractDomainName(*it) == 854 const std::string domain = gaia::ExtractDomainName(*it);
855 UserManager::kLocallyManagedUserDomain) { 855 if (domain == UserManager::kLocallyManagedUserDomain) {
856 user = User::CreateLocallyManagedUser(*it); 856 user = User::CreateLocallyManagedUser(*it);
857 } else { 857 } else {
858 user = User::CreateRegularUser(*it); 858 user = User::CreateRegularUser(*it);
859 user->set_oauth_token_status(LoadUserOAuthStatus(*it)); 859 user->set_oauth_token_status(LoadUserOAuthStatus(*it));
860 } 860 }
861 users_.push_back(user); 861 users_.push_back(user);
862 862
863 string16 display_name; 863 string16 display_name;
864 if (prefs_display_names->GetStringWithoutPathExpansion(*it, 864 if (prefs_display_names->GetStringWithoutPathExpansion(*it,
865 &display_name)) { 865 &display_name)) {
(...skipping 28 matching lines...) Expand all
894 // Schedule a callback if device policy has not yet been verified. 894 // Schedule a callback if device policy has not yet been verified.
895 if (CrosSettingsProvider::TRUSTED != cros_settings_->PrepareTrustedValues( 895 if (CrosSettingsProvider::TRUSTED != cros_settings_->PrepareTrustedValues(
896 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies, 896 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies,
897 base::Unretained(this)))) { 897 base::Unretained(this)))) {
898 return; 898 return;
899 } 899 }
900 900
901 cros_settings_->GetBoolean(kAccountsPrefEphemeralUsersEnabled, 901 cros_settings_->GetBoolean(kAccountsPrefEphemeralUsersEnabled,
902 &ephemeral_users_enabled_); 902 &ephemeral_users_enabled_);
903 cros_settings_->GetString(kDeviceOwner, &owner_email_); 903 cros_settings_->GetString(kDeviceOwner, &owner_email_);
904 const base::ListValue* public_accounts; 904 base::ListValue public_accounts;
905 cros_settings_->GetList(kAccountsPrefDeviceLocalAccounts, &public_accounts); 905 ReadPublicAccounts(&public_accounts);
906 906
907 EnsureUsersLoaded(); 907 EnsureUsersLoaded();
908 908
909 bool changed = UpdateAndCleanUpPublicAccounts(*public_accounts); 909 bool changed = UpdateAndCleanUpPublicAccounts(public_accounts);
910 910
911 // If ephemeral users are enabled and we are on the login screen, take this 911 // If ephemeral users are enabled and we are on the login screen, take this
912 // opportunity to clean up by removing all regular users except the owner. 912 // opportunity to clean up by removing all regular users except the owner.
913 if (ephemeral_users_enabled_ && !IsUserLoggedIn()) { 913 if (ephemeral_users_enabled_ && !IsUserLoggedIn()) {
914 ListPrefUpdate prefs_users_update(g_browser_process->local_state(), 914 ListPrefUpdate prefs_users_update(g_browser_process->local_state(),
915 kRegularUsers); 915 kRegularUsers);
916 prefs_users_update->Clear(); 916 prefs_users_update->Clear();
917 for (UserList::iterator it = users_.begin(); it != users_.end(); ) { 917 for (UserList::iterator it = users_.begin(); it != users_.end(); ) {
918 const std::string user_email = (*it)->email(); 918 const std::string user_email = (*it)->email();
919 if ((*it)->GetType() == User::USER_TYPE_REGULAR && 919 if ((*it)->GetType() == User::USER_TYPE_REGULAR &&
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 else if (active_user_->GetType() == User::USER_TYPE_LOCALLY_MANAGED) 1444 else if (active_user_->GetType() == User::USER_TYPE_LOCALLY_MANAGED)
1445 login_user_type = LoginState::LOGGED_IN_USER_LOCALLY_MANAGED; 1445 login_user_type = LoginState::LOGGED_IN_USER_LOCALLY_MANAGED;
1446 else if (active_user_->GetType() == User::USER_TYPE_KIOSK_APP) 1446 else if (active_user_->GetType() == User::USER_TYPE_KIOSK_APP)
1447 login_user_type = LoginState::LOGGED_IN_USER_KIOSK_APP; 1447 login_user_type = LoginState::LOGGED_IN_USER_KIOSK_APP;
1448 else 1448 else
1449 login_user_type = LoginState::LOGGED_IN_USER_REGULAR; 1449 login_user_type = LoginState::LOGGED_IN_USER_REGULAR;
1450 1450
1451 LoginState::Get()->SetLoggedInState(logged_in_state, login_user_type); 1451 LoginState::Get()->SetLoggedInState(logged_in_state, login_user_type);
1452 } 1452 }
1453 1453
1454 void UserManagerImpl::ReadPublicAccounts(base::ListValue* public_accounts) {
1455 const base::ListValue* accounts = NULL;
1456 if (cros_settings_->GetList(kAccountsPrefDeviceLocalAccounts, &accounts)) {
1457 for (base::ListValue::const_iterator entry(accounts->begin());
1458 entry != accounts->end(); ++entry) {
1459 const base::DictionaryValue* entry_dict = NULL;
1460 if (!(*entry)->GetAsDictionary(&entry_dict)) {
1461 NOTREACHED();
1462 continue;
1463 }
1464
1465 int type = DEVICE_LOCAL_ACCOUNT_TYPE_PUBLIC_SESSION;
1466 entry_dict->GetIntegerWithoutPathExpansion(
1467 kAccountsPrefDeviceLocalAccountsKeyType, &type);
1468 switch (type) {
1469 case DEVICE_LOCAL_ACCOUNT_TYPE_PUBLIC_SESSION: {
1470 std::string id;
1471 if (entry_dict->GetStringWithoutPathExpansion(
1472 kAccountsPrefDeviceLocalAccountsKeyId, &id)) {
1473 public_accounts->AppendString(id);
1474 }
1475 break;
1476 }
1477 case DEVICE_LOCAL_ACCOUNT_TYPE_KIOSK_APP:
1478 // TODO(mnissler, nkostylev, bartfab): Process Kiosk Apps within the
1479 // standard login framework: http://crbug.com/234694
1480 break;
1481 }
1482 }
1483 }
1484 }
1485
1454 } // namespace chromeos 1486 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698