| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // User dictionary keys. | 42 // User dictionary keys. |
| 43 const char kKeyUsername[] = "username"; | 43 const char kKeyUsername[] = "username"; |
| 44 const char kKeyGaiaID[] = "gaiaId"; | 44 const char kKeyGaiaID[] = "gaiaId"; |
| 45 const char kKeyDisplayName[] = "displayName"; | 45 const char kKeyDisplayName[] = "displayName"; |
| 46 const char kKeyEmailAddress[] = "emailAddress"; | 46 const char kKeyEmailAddress[] = "emailAddress"; |
| 47 const char kKeyEnterpriseDomain[] = "enterpriseDomain"; | 47 const char kKeyEnterpriseDomain[] = "enterpriseDomain"; |
| 48 const char kKeyPublicAccount[] = "publicAccount"; | 48 const char kKeyPublicAccount[] = "publicAccount"; |
| 49 const char kKeyLegacySupervisedUser[] = "legacySupervisedUser"; | 49 const char kKeyLegacySupervisedUser[] = "legacySupervisedUser"; |
| 50 const char kKeyChildUser[] = "childUser"; | 50 const char kKeyChildUser[] = "childUser"; |
| 51 const char kKeyDesktopUser[] = "isDesktopUser"; | 51 const char kKeyDesktopUser[] = "isDesktopUser"; |
| 52 const char kKeyShowPin[] = "showPin"; | |
| 53 const char kKeySignedIn[] = "signedIn"; | 52 const char kKeySignedIn[] = "signedIn"; |
| 54 const char kKeyCanRemove[] = "canRemove"; | 53 const char kKeyCanRemove[] = "canRemove"; |
| 55 const char kKeyIsOwner[] = "isOwner"; | 54 const char kKeyIsOwner[] = "isOwner"; |
| 56 const char kKeyIsActiveDirectory[] = "isActiveDirectory"; | 55 const char kKeyIsActiveDirectory[] = "isActiveDirectory"; |
| 57 const char kKeyInitialAuthType[] = "initialAuthType"; | 56 const char kKeyInitialAuthType[] = "initialAuthType"; |
| 58 const char kKeyMultiProfilesAllowed[] = "isMultiProfilesAllowed"; | 57 const char kKeyMultiProfilesAllowed[] = "isMultiProfilesAllowed"; |
| 59 const char kKeyMultiProfilesPolicy[] = "multiProfilesPolicy"; | 58 const char kKeyMultiProfilesPolicy[] = "multiProfilesPolicy"; |
| 60 const char kKeyInitialLocales[] = "initialLocales"; | 59 const char kKeyInitialLocales[] = "initialLocales"; |
| 61 const char kKeyInitialLocale[] = "initialLocale"; | 60 const char kKeyInitialLocale[] = "initialLocale"; |
| 62 const char kKeyInitialMultipleRecommendedLocales[] = | 61 const char kKeyInitialMultipleRecommendedLocales[] = |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // locales). | 110 // locales). |
| 112 user_dict->SetBoolean(kKeyInitialMultipleRecommendedLocales, | 111 user_dict->SetBoolean(kKeyInitialMultipleRecommendedLocales, |
| 113 recommended_locales.size() >= 2); | 112 recommended_locales.size() >= 2); |
| 114 | 113 |
| 115 // Set |kKeyInitialKeyboardLayout| to the current keyboard layout. This | 114 // Set |kKeyInitialKeyboardLayout| to the current keyboard layout. This |
| 116 // value will be used temporarily only because the UI immediately requests a | 115 // value will be used temporarily only because the UI immediately requests a |
| 117 // list of keyboard layouts suitable for the currently selected locale. | 116 // list of keyboard layouts suitable for the currently selected locale. |
| 118 user_dict->Set(kKeyInitialKeyboardLayout, GetCurrentKeyboardLayout()); | 117 user_dict->Set(kKeyInitialKeyboardLayout, GetCurrentKeyboardLayout()); |
| 119 } | 118 } |
| 120 | 119 |
| 121 // Returns true if the PIN keyboard should be displayed for the given |user|. | |
| 122 bool CanShowPinForUser(user_manager::User* user) { | |
| 123 if (!user->is_logged_in()) | |
| 124 return false; | |
| 125 | |
| 126 quick_unlock::QuickUnlockStorage* quick_unlock_storage = | |
| 127 quick_unlock::QuickUnlockFactory::GetForUser(user); | |
| 128 if (!quick_unlock_storage) | |
| 129 return false; | |
| 130 | |
| 131 return quick_unlock_storage->IsPinAuthenticationAvailable(); | |
| 132 } | |
| 133 | |
| 134 // Returns true if the fingerprint icon should be displayed for the given | 120 // Returns true if the fingerprint icon should be displayed for the given |
| 135 // |user|. | 121 // |user|. |
| 136 bool AllowFingerprintForUser(user_manager::User* user) { | 122 bool AllowFingerprintForUser(user_manager::User* user) { |
| 137 if (!user->is_logged_in()) | 123 if (!user->is_logged_in()) |
| 138 return false; | 124 return false; |
| 139 | 125 |
| 140 quick_unlock::QuickUnlockStorage* quick_unlock_storage = | 126 quick_unlock::QuickUnlockStorage* quick_unlock_storage = |
| 141 quick_unlock::QuickUnlockFactory::GetForUser(user); | 127 quick_unlock::QuickUnlockFactory::GetForUser(user); |
| 142 if (!quick_unlock_storage) | 128 if (!quick_unlock_storage) |
| 143 return false; | 129 return false; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 const bool is_child_user = user->GetType() == user_manager::USER_TYPE_CHILD; | 169 const bool is_child_user = user->GetType() == user_manager::USER_TYPE_CHILD; |
| 184 | 170 |
| 185 user_dict->SetString(kKeyUsername, user->GetAccountId().Serialize()); | 171 user_dict->SetString(kKeyUsername, user->GetAccountId().Serialize()); |
| 186 user_dict->SetString(kKeyEmailAddress, user->display_email()); | 172 user_dict->SetString(kKeyEmailAddress, user->display_email()); |
| 187 user_dict->SetString(kKeyDisplayName, user->GetDisplayName()); | 173 user_dict->SetString(kKeyDisplayName, user->GetDisplayName()); |
| 188 user_dict->SetBoolean(kKeyPublicAccount, is_public_session); | 174 user_dict->SetBoolean(kKeyPublicAccount, is_public_session); |
| 189 user_dict->SetBoolean(kKeyLegacySupervisedUser, is_legacy_supervised_user); | 175 user_dict->SetBoolean(kKeyLegacySupervisedUser, is_legacy_supervised_user); |
| 190 user_dict->SetBoolean(kKeyChildUser, is_child_user); | 176 user_dict->SetBoolean(kKeyChildUser, is_child_user); |
| 191 user_dict->SetBoolean(kKeyDesktopUser, false); | 177 user_dict->SetBoolean(kKeyDesktopUser, false); |
| 192 user_dict->SetInteger(kKeyInitialAuthType, auth_type); | 178 user_dict->SetInteger(kKeyInitialAuthType, auth_type); |
| 193 user_dict->SetBoolean(kKeyShowPin, CanShowPinForUser(user)); | |
| 194 user_dict->SetBoolean(kKeySignedIn, user->is_logged_in()); | 179 user_dict->SetBoolean(kKeySignedIn, user->is_logged_in()); |
| 195 user_dict->SetBoolean(kKeyIsOwner, is_owner); | 180 user_dict->SetBoolean(kKeyIsOwner, is_owner); |
| 196 user_dict->SetBoolean(kKeyIsActiveDirectory, user->IsActiveDirectoryUser()); | 181 user_dict->SetBoolean(kKeyIsActiveDirectory, user->IsActiveDirectoryUser()); |
| 197 user_dict->SetBoolean(kKeyAllowFingerprint, AllowFingerprintForUser(user)); | 182 user_dict->SetBoolean(kKeyAllowFingerprint, AllowFingerprintForUser(user)); |
| 198 | 183 |
| 199 FillMultiProfileUserPrefs(user, user_dict, is_signin_to_add); | 184 FillMultiProfileUserPrefs(user, user_dict, is_signin_to_add); |
| 200 FillKnownUserPrefs(user, user_dict); | 185 FillKnownUserPrefs(user, user_dict); |
| 201 | 186 |
| 202 if (is_public_session) { | 187 if (is_public_session) { |
| 203 AddPublicSessionDetailsToUserDictionaryEntry( | 188 AddPublicSessionDetailsToUserDictionaryEntry( |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 // The user profile should exist if and only if this is the lock screen. | 582 // The user profile should exist if and only if this is the lock screen. |
| 598 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); | 583 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); |
| 599 | 584 |
| 600 if (!profile) | 585 if (!profile) |
| 601 profile = profile_helper->GetSigninProfile(); | 586 profile = profile_helper->GetSigninProfile(); |
| 602 | 587 |
| 603 return EasyUnlockService::Get(profile); | 588 return EasyUnlockService::Get(profile); |
| 604 } | 589 } |
| 605 | 590 |
| 606 } // namespace chromeos | 591 } // namespace chromeos |
| OLD | NEW |