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

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, 8 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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 local_state->GetDictionary(kUserDisplayEmail); 828 local_state->GetDictionary(kUserDisplayEmail);
829 829
830 // Load regular users and locally managed users. 830 // Load regular users and locally managed users.
831 std::vector<std::string> regular_users; 831 std::vector<std::string> regular_users;
832 std::set<std::string> regular_users_set; 832 std::set<std::string> regular_users_set;
833 ParseUserList(*prefs_regular_users, std::set<std::string>(), "", 833 ParseUserList(*prefs_regular_users, std::set<std::string>(), "",
834 &regular_users, &regular_users_set); 834 &regular_users, &regular_users_set);
835 for (std::vector<std::string>::const_iterator it = regular_users.begin(); 835 for (std::vector<std::string>::const_iterator it = regular_users.begin();
836 it != regular_users.end(); ++it) { 836 it != regular_users.end(); ++it) {
837 User* user = NULL; 837 User* user = NULL;
838 if (gaia::ExtractDomainName(*it) == 838 const std::string domain_name = gaia::ExtractDomainName(*it);
839 UserManager::kLocallyManagedUserDomain) { 839 if (domain_name == UserManager::kLocallyManagedUserDomain) {
bartfab (slow) 2013/04/23 15:59:40 Nit: Why |domain_name| here and |domain| 50 lines
Mattias Nissler (ping if slow) 2013/04/23 18:28:10 Ha, this is an edit artifact actually :) Fixed.
840 user = User::CreateLocallyManagedUser(*it); 840 user = User::CreateLocallyManagedUser(*it);
841 } else { 841 } else {
842 user = User::CreateRegularUser(*it); 842 user = User::CreateRegularUser(*it);
843 user->set_oauth_token_status(LoadUserOAuthStatus(*it)); 843 user->set_oauth_token_status(LoadUserOAuthStatus(*it));
844 } 844 }
845 users_.push_back(user); 845 users_.push_back(user);
846 846
847 string16 display_name; 847 string16 display_name;
848 if (prefs_display_names->GetStringWithoutPathExpansion(*it, 848 if (prefs_display_names->GetStringWithoutPathExpansion(*it,
849 &display_name)) { 849 &display_name)) {
(...skipping 28 matching lines...) Expand all
878 // Schedule a callback if device policy has not yet been verified. 878 // Schedule a callback if device policy has not yet been verified.
879 if (CrosSettingsProvider::TRUSTED != cros_settings_->PrepareTrustedValues( 879 if (CrosSettingsProvider::TRUSTED != cros_settings_->PrepareTrustedValues(
880 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies, 880 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies,
881 base::Unretained(this)))) { 881 base::Unretained(this)))) {
882 return; 882 return;
883 } 883 }
884 884
885 cros_settings_->GetBoolean(kAccountsPrefEphemeralUsersEnabled, 885 cros_settings_->GetBoolean(kAccountsPrefEphemeralUsersEnabled,
886 &ephemeral_users_enabled_); 886 &ephemeral_users_enabled_);
887 cros_settings_->GetString(kDeviceOwner, &owner_email_); 887 cros_settings_->GetString(kDeviceOwner, &owner_email_);
888 const base::ListValue* public_accounts; 888 const base::ListValue* device_local_accounts;
889 cros_settings_->GetList(kAccountsPrefDeviceLocalAccounts, &public_accounts); 889 base::ListValue public_accounts;
Nikita (slow) 2013/04/23 17:04:50 nit: Could this be extracted to a separate method?
Mattias Nissler (ping if slow) 2013/04/23 18:28:10 Done.
890 if (cros_settings_->GetList(kAccountsPrefDeviceLocalAccounts,
891 &device_local_accounts)) {
892 for (base::ListValue::const_iterator user(device_local_accounts->begin());
893 user != device_local_accounts->end(); ++user) {
894 std::string user_id;
895 if (!(*user)->GetAsString(&user_id))
bartfab (slow) 2013/04/23 15:59:40 Nit: Add NOTREACHED()?
Mattias Nissler (ping if slow) 2013/04/23 18:28:10 Done.
896 continue;
897 const std::string domain = gaia::ExtractDomainName(user_id);
898 if (domain == kKioskAppUserDomain) {
899 // TODO(mnissler, nkostylev, bartfab): Process Kiosk Apps within the
900 // standard user framework.
Nikita (slow) 2013/04/23 17:04:50 nit: Please file a bug.
Mattias Nissler (ping if slow) 2013/04/23 18:28:10 Done.
901 continue;
902 } else {
903 public_accounts.AppendString(user_id);
904 }
905 }
906 }
890 907
891 EnsureUsersLoaded(); 908 EnsureUsersLoaded();
892 909
893 bool changed = UpdateAndCleanUpPublicAccounts(*public_accounts); 910 bool changed = UpdateAndCleanUpPublicAccounts(public_accounts);
894 911
895 // If ephemeral users are enabled and we are on the login screen, take this 912 // If ephemeral users are enabled and we are on the login screen, take this
896 // opportunity to clean up by removing all regular users except the owner. 913 // opportunity to clean up by removing all regular users except the owner.
897 if (ephemeral_users_enabled_ && !IsUserLoggedIn()) { 914 if (ephemeral_users_enabled_ && !IsUserLoggedIn()) {
898 ListPrefUpdate prefs_users_update(g_browser_process->local_state(), 915 ListPrefUpdate prefs_users_update(g_browser_process->local_state(),
899 kRegularUsers); 916 kRegularUsers);
900 prefs_users_update->Clear(); 917 prefs_users_update->Clear();
901 for (UserList::iterator it = users_.begin(); it != users_.end(); ) { 918 for (UserList::iterator it = users_.begin(); it != users_.end(); ) {
902 const std::string user_email = (*it)->email(); 919 const std::string user_email = (*it)->email();
903 if ((*it)->GetType() == User::USER_TYPE_REGULAR && 920 if ((*it)->GetType() == User::USER_TYPE_REGULAR &&
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1420 login_user_type = LoginState::LOGGED_IN_USER_LOCALLY_MANAGED; 1437 login_user_type = LoginState::LOGGED_IN_USER_LOCALLY_MANAGED;
1421 else if (active_user_->GetType() == User::USER_TYPE_KIOSK_APP) 1438 else if (active_user_->GetType() == User::USER_TYPE_KIOSK_APP)
1422 login_user_type = LoginState::LOGGED_IN_USER_KIOSK_APP; 1439 login_user_type = LoginState::LOGGED_IN_USER_KIOSK_APP;
1423 else 1440 else
1424 login_user_type = LoginState::LOGGED_IN_USER_REGULAR; 1441 login_user_type = LoginState::LOGGED_IN_USER_REGULAR;
1425 1442
1426 LoginState::Get()->SetLoggedInState(logged_in_state, login_user_type); 1443 LoginState::Get()->SetLoggedInState(logged_in_state, login_user_type);
1427 } 1444 }
1428 1445
1429 } // namespace chromeos 1446 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698