OLD | NEW |
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/screens/user_selection_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 user_dict->SetBoolean(kKeyPublicAccount, is_public_account); | 77 user_dict->SetBoolean(kKeyPublicAccount, is_public_account); |
78 user_dict->SetBoolean(kKeySupervisedUser, is_supervised_user); | 78 user_dict->SetBoolean(kKeySupervisedUser, is_supervised_user); |
79 user_dict->SetInteger(kKeyInitialAuthType, auth_type); | 79 user_dict->SetInteger(kKeyInitialAuthType, auth_type); |
80 user_dict->SetBoolean(kKeySignedIn, user->is_logged_in()); | 80 user_dict->SetBoolean(kKeySignedIn, user->is_logged_in()); |
81 user_dict->SetBoolean(kKeyIsOwner, is_owner); | 81 user_dict->SetBoolean(kKeyIsOwner, is_owner); |
82 | 82 |
83 // Fill in multi-profiles related fields. | 83 // Fill in multi-profiles related fields. |
84 if (is_signin_to_add) { | 84 if (is_signin_to_add) { |
85 MultiProfileUserController* multi_profile_user_controller = | 85 MultiProfileUserController* multi_profile_user_controller = |
86 UserManager::Get()->GetMultiProfileUserController(); | 86 UserManager::Get()->GetMultiProfileUserController(); |
87 std::string behavior = | 87 MultiProfileUserController::UserAllowedInSessionReason isUserAllowedReason; |
88 multi_profile_user_controller->GetCachedValue(user_id); | 88 bool isUserAllowed = multi_profile_user_controller->IsUserAllowedInSession( |
89 user_dict->SetBoolean(kKeyMultiProfilesAllowed, | 89 user_id, &isUserAllowedReason); |
90 multi_profile_user_controller->IsUserAllowedInSession( | 90 user_dict->SetBoolean(kKeyMultiProfilesAllowed, isUserAllowed); |
91 user_id) == MultiProfileUserController::ALLOWED); | 91 |
| 92 std::string behavior; |
| 93 switch (isUserAllowedReason) { |
| 94 case MultiProfileUserController::NOT_ALLOWED_OWNER_AS_SECONDARY: |
| 95 behavior = MultiProfileUserController::kBehaviorOwnerPrimaryOnly; |
| 96 break; |
| 97 default: |
| 98 behavior = multi_profile_user_controller->GetCachedValue(user_id); |
| 99 } |
92 user_dict->SetString(kKeyMultiProfilesPolicy, behavior); | 100 user_dict->SetString(kKeyMultiProfilesPolicy, behavior); |
93 } else { | 101 } else { |
94 user_dict->SetBoolean(kKeyMultiProfilesAllowed, true); | 102 user_dict->SetBoolean(kKeyMultiProfilesAllowed, true); |
95 } | 103 } |
96 | 104 |
97 if (is_public_account) { | 105 if (is_public_account) { |
98 policy::BrowserPolicyConnectorChromeOS* policy_connector = | 106 policy::BrowserPolicyConnectorChromeOS* policy_connector = |
99 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 107 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
100 | 108 |
101 if (policy_connector->IsEnterpriseManaged()) { | 109 if (policy_connector->IsEnterpriseManaged()) { |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 } | 316 } |
309 | 317 |
310 ScreenlockBridge::LockHandler::AuthType UserSelectionScreen::GetAuthType( | 318 ScreenlockBridge::LockHandler::AuthType UserSelectionScreen::GetAuthType( |
311 const std::string& username) const { | 319 const std::string& username) const { |
312 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) | 320 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) |
313 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; | 321 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; |
314 return user_auth_type_map_.find(username)->second; | 322 return user_auth_type_map_.find(username)->second; |
315 } | 323 } |
316 | 324 |
317 } // namespace chromeos | 325 } // namespace chromeos |
OLD | NEW |