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

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

Issue 2946463002: Convert multi-profile user behavior string to enum and send it to UI. (Closed)
Patch Set: 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
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
131 MultiProfileUserController::MultiProfileUserBehavior
132 MultiProfileUserController::UserBehaviorStringToEnum(
133 const std::string& behavior) {
134 if (behavior == kBehaviorPrimaryOnly)
135 return MultiProfileUserBehavior::kPrimaryOnly;
136 if (behavior == kBehaviorNotAllowed)
137 return MultiProfileUserBehavior::kNotAllowed;
138 if (behavior == kBehaviorOwnerPrimaryOnly)
139 return MultiProfileUserBehavior::kOwnerPrimaryOnly;
140
141 return MultiProfileUserBehavior::kUnrestriced;
142 }
143
130 bool MultiProfileUserController::IsUserAllowedInSession( 144 bool MultiProfileUserController::IsUserAllowedInSession(
131 const std::string& user_email, 145 const std::string& user_email,
132 MultiProfileUserController::UserAllowedInSessionReason* reason) const { 146 MultiProfileUserController::UserAllowedInSessionReason* reason) const {
133 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); 147 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
134 CHECK(user_manager); 148 CHECK(user_manager);
135 149
136 const user_manager::User* primary_user = user_manager->GetPrimaryUser(); 150 const user_manager::User* primary_user = user_manager->GetPrimaryUser();
137 std::string primary_user_email; 151 std::string primary_user_email;
138 if (primary_user) 152 if (primary_user)
139 primary_user_email = primary_user->GetAccountId().GetUserEmail(); 153 primary_user_email = primary_user->GetAccountId().GetUserEmail();
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 } else { 248 } else {
235 const std::string behavior = 249 const std::string behavior =
236 prefs->GetString(prefs::kMultiProfileUserBehavior); 250 prefs->GetString(prefs::kMultiProfileUserBehavior);
237 SetCachedValue(user_email, behavior); 251 SetCachedValue(user_email, behavior);
238 } 252 }
239 253
240 CheckSessionUsers(); 254 CheckSessionUsers();
241 } 255 }
242 256
243 } // namespace chromeos 257 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/users/multi_profile_user_controller.h ('k') | ui/login/account_picker/md_user_pod_row.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698