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

Side by Side Diff: chrome/browser/chromeos/login/users/chrome_user_manager.cc

Issue 420243002: Refactoring IsUserAllowedInSession and GetCachedValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/users/chrome_user_manager.h" 5 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <set> 8 #include <set>
9 9
10 #include "ash/multi_profile_uma.h" 10 #include "ash/multi_profile_uma.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 return user_manager::UserList(); 191 return user_manager::UserList();
192 } 192 }
193 193
194 user_manager::UserList result; 194 user_manager::UserList result;
195 const user_manager::UserList& users = GetUsers(); 195 const user_manager::UserList& users = GetUsers();
196 for (user_manager::UserList::const_iterator it = users.begin(); 196 for (user_manager::UserList::const_iterator it = users.begin();
197 it != users.end(); 197 it != users.end();
198 ++it) { 198 ++it) {
199 if ((*it)->GetType() == user_manager::USER_TYPE_REGULAR && 199 if ((*it)->GetType() == user_manager::USER_TYPE_REGULAR &&
200 !(*it)->is_logged_in()) { 200 !(*it)->is_logged_in()) {
201 MultiProfileUserController::UserAllowedInSessionResult check = 201 MultiProfileUserController::UserAllowedInSessionReason check;
202 multi_profile_user_controller_->IsUserAllowedInSession( 202 multi_profile_user_controller_->IsUserAllowedInSession((*it)->email(),
203 (*it)->email()); 203 &check);
204 if (check == 204 if (check ==
205 MultiProfileUserController::NOT_ALLOWED_PRIMARY_USER_POLICY_FORBIDS) { 205 MultiProfileUserController::NOT_ALLOWED_PRIMARY_USER_POLICY_FORBIDS) {
206 return user_manager::UserList(); 206 return user_manager::UserList();
207 } 207 }
208 208
209 // Users with a policy that prevents them being added to a session will be 209 // Users with a policy that prevents them being added to a session will be
210 // shown in login UI but will be grayed out. 210 // shown in login UI but will be grayed out.
211 // Same applies to owner account (see http://crbug.com/385034). 211 // Same applies to owner account (see http://crbug.com/385034).
212 if (check == MultiProfileUserController::ALLOWED || 212 if (check == MultiProfileUserController::ALLOWED ||
213 check == MultiProfileUserController::NOT_ALLOWED_POLICY_FORBIDS || 213 check == MultiProfileUserController::NOT_ALLOWED_POLICY_FORBIDS ||
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 if ((users + GetUsersAdmittedForMultiProfile().size()) > 1) 1007 if ((users + GetUsersAdmittedForMultiProfile().size()) > 1)
1008 ash::MultiProfileUMA::RecordUserCount(users); 1008 ash::MultiProfileUMA::RecordUserCount(users);
1009 } 1009 }
1010 1010
1011 base::debug::SetCrashKeyValue( 1011 base::debug::SetCrashKeyValue(
1012 crash_keys::kNumberOfUsers, 1012 crash_keys::kNumberOfUsers,
1013 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); 1013 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size()));
1014 } 1014 }
1015 1015
1016 } // namespace chromeos 1016 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698