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

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

Issue 2937553002: Create Mojo Struct for user information used in login/lock screen. (Closed)
Patch Set: reuse enum defined in mojom file. Created 3 years, 6 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/multi_profile_user_controller.h" 5 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // No user is allowed if the primary user policy forbids it. 121 // No user is allowed if the primary user policy forbids it.
122 const std::string behavior = profile->GetPrefs()->GetString( 122 const std::string behavior = profile->GetPrefs()->GetString(
123 prefs::kMultiProfileUserBehavior); 123 prefs::kMultiProfileUserBehavior);
124 if (behavior == kBehaviorNotAllowed) 124 if (behavior == kBehaviorNotAllowed)
125 return NOT_ALLOWED_PRIMARY_USER_POLICY_FORBIDS; 125 return NOT_ALLOWED_PRIMARY_USER_POLICY_FORBIDS;
126 126
127 return ALLOWED; 127 return ALLOWED;
128 } 128 }
129 129
130 // static 130 // static
131 MultiProfileUserController::MultiProfileUserBehavior 131 MultiProfileUserBehavior MultiProfileUserController::UserBehaviorStringToEnum(
132 MultiProfileUserController::UserBehaviorStringToEnum(
133 const std::string& behavior) { 132 const std::string& behavior) {
134 if (behavior == kBehaviorPrimaryOnly) 133 if (behavior == kBehaviorPrimaryOnly)
135 return MultiProfileUserBehavior::kPrimaryOnly; 134 return MultiProfileUserBehavior::PRIMARY_ONLY;
136 if (behavior == kBehaviorNotAllowed) 135 if (behavior == kBehaviorNotAllowed)
137 return MultiProfileUserBehavior::kNotAllowed; 136 return MultiProfileUserBehavior::NOT_ALLOWED;
138 if (behavior == kBehaviorOwnerPrimaryOnly) 137 if (behavior == kBehaviorOwnerPrimaryOnly)
139 return MultiProfileUserBehavior::kOwnerPrimaryOnly; 138 return MultiProfileUserBehavior::OWNER_PRIMARY_ONLY;
140 139
141 return MultiProfileUserBehavior::kUnrestriced; 140 return MultiProfileUserBehavior::UNRESTRICTED;
142 } 141 }
143 142
144 bool MultiProfileUserController::IsUserAllowedInSession( 143 bool MultiProfileUserController::IsUserAllowedInSession(
145 const std::string& user_email, 144 const std::string& user_email,
146 MultiProfileUserController::UserAllowedInSessionReason* reason) const { 145 MultiProfileUserController::UserAllowedInSessionReason* reason) const {
147 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); 146 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
148 CHECK(user_manager); 147 CHECK(user_manager);
149 148
150 const user_manager::User* primary_user = user_manager->GetPrimaryUser(); 149 const user_manager::User* primary_user = user_manager->GetPrimaryUser();
151 std::string primary_user_email; 150 std::string primary_user_email;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } else { 247 } else {
249 const std::string behavior = 248 const std::string behavior =
250 prefs->GetString(prefs::kMultiProfileUserBehavior); 249 prefs->GetString(prefs::kMultiProfileUserBehavior);
251 SetCachedValue(user_email, behavior); 250 SetCachedValue(user_email, behavior);
252 } 251 }
253 252
254 CheckSessionUsers(); 253 CheckSessionUsers();
255 } 254 }
256 255
257 } // namespace chromeos 256 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698