| 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 |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/browser_process_platform_part.h" | 16 #include "chrome/browser/browser_process_platform_part.h" |
| 17 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 17 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 18 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage.h" | 18 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h" |
| 19 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage_factory.h" | 19 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h" |
| 20 #include "chrome/browser/chromeos/login/reauth_stats.h" | 20 #include "chrome/browser/chromeos/login/reauth_stats.h" |
| 21 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 21 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 22 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" | 22 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" |
| 23 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 23 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 24 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 24 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
| 25 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 25 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 26 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 26 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 27 #include "chrome/browser/signin/easy_unlock_service.h" | 27 #include "chrome/browser/signin/easy_unlock_service.h" |
| 28 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 28 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
| 29 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 29 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 55 const char kKeyIsOwner[] = "isOwner"; | 55 const char kKeyIsOwner[] = "isOwner"; |
| 56 const char kKeyIsActiveDirectory[] = "isActiveDirectory"; | 56 const char kKeyIsActiveDirectory[] = "isActiveDirectory"; |
| 57 const char kKeyInitialAuthType[] = "initialAuthType"; | 57 const char kKeyInitialAuthType[] = "initialAuthType"; |
| 58 const char kKeyMultiProfilesAllowed[] = "isMultiProfilesAllowed"; | 58 const char kKeyMultiProfilesAllowed[] = "isMultiProfilesAllowed"; |
| 59 const char kKeyMultiProfilesPolicy[] = "multiProfilesPolicy"; | 59 const char kKeyMultiProfilesPolicy[] = "multiProfilesPolicy"; |
| 60 const char kKeyInitialLocales[] = "initialLocales"; | 60 const char kKeyInitialLocales[] = "initialLocales"; |
| 61 const char kKeyInitialLocale[] = "initialLocale"; | 61 const char kKeyInitialLocale[] = "initialLocale"; |
| 62 const char kKeyInitialMultipleRecommendedLocales[] = | 62 const char kKeyInitialMultipleRecommendedLocales[] = |
| 63 "initialMultipleRecommendedLocales"; | 63 "initialMultipleRecommendedLocales"; |
| 64 const char kKeyInitialKeyboardLayout[] = "initialKeyboardLayout"; | 64 const char kKeyInitialKeyboardLayout[] = "initialKeyboardLayout"; |
| 65 const char kKeyAllowFingerprint[] = "allowFingerprint"; |
| 65 | 66 |
| 66 // Max number of users to show. | 67 // Max number of users to show. |
| 67 // Please keep synced with one in signin_userlist_unittest.cc. | 68 // Please keep synced with one in signin_userlist_unittest.cc. |
| 68 const size_t kMaxUsers = 18; | 69 const size_t kMaxUsers = 18; |
| 69 | 70 |
| 70 const int kPasswordClearTimeoutSec = 60; | 71 const int kPasswordClearTimeoutSec = 60; |
| 71 | 72 |
| 72 void AddPublicSessionDetailsToUserDictionaryEntry( | 73 void AddPublicSessionDetailsToUserDictionaryEntry( |
| 73 base::DictionaryValue* user_dict, | 74 base::DictionaryValue* user_dict, |
| 74 const std::vector<std::string>* public_session_recommended_locales) { | 75 const std::vector<std::string>* public_session_recommended_locales) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // list of keyboard layouts suitable for the currently selected locale. | 117 // list of keyboard layouts suitable for the currently selected locale. |
| 117 user_dict->Set(kKeyInitialKeyboardLayout, | 118 user_dict->Set(kKeyInitialKeyboardLayout, |
| 118 GetCurrentKeyboardLayout().release()); | 119 GetCurrentKeyboardLayout().release()); |
| 119 } | 120 } |
| 120 | 121 |
| 121 // Returns true if the PIN keyboard should be displayed for the given |user|. | 122 // Returns true if the PIN keyboard should be displayed for the given |user|. |
| 122 bool CanShowPinForUser(user_manager::User* user) { | 123 bool CanShowPinForUser(user_manager::User* user) { |
| 123 if (!user->is_logged_in()) | 124 if (!user->is_logged_in()) |
| 124 return false; | 125 return false; |
| 125 | 126 |
| 126 quick_unlock::PinStorage* pin_storage = | 127 quick_unlock::QuickUnlockStorage* quick_unlock_storage = |
| 127 quick_unlock::PinStorageFactory::GetForUser(user); | 128 quick_unlock::QuickUnlockFactory::GetForUser(user); |
| 128 if (!pin_storage) | 129 if (!quick_unlock_storage) |
| 129 return false; | 130 return false; |
| 130 | 131 |
| 131 return pin_storage->IsPinAuthenticationAvailable(); | 132 return quick_unlock_storage->pin_storage()->IsPinAuthenticationAvailable(); |
| 133 } |
| 134 |
| 135 // Returns true if the fingerprint icon should be displayed for the given |
| 136 // |user|. |
| 137 bool AllowFingerprintForUser(user_manager::User* user) { |
| 138 if (!user->is_logged_in()) |
| 139 return false; |
| 140 |
| 141 quick_unlock::QuickUnlockStorage* quick_unlock_storage = |
| 142 quick_unlock::QuickUnlockFactory::GetForUser(user); |
| 143 if (!quick_unlock_storage) |
| 144 return false; |
| 145 |
| 146 return quick_unlock_storage->fingerprint_storage() |
| 147 ->IsFingerprintAuthenticationAvailable(); |
| 132 } | 148 } |
| 133 | 149 |
| 134 } // namespace | 150 } // namespace |
| 135 | 151 |
| 136 UserSelectionScreen::UserSelectionScreen(const std::string& display_type) | 152 UserSelectionScreen::UserSelectionScreen(const std::string& display_type) |
| 137 : BaseScreen(nullptr, OobeScreen::SCREEN_USER_SELECTION), | 153 : BaseScreen(nullptr, OobeScreen::SCREEN_USER_SELECTION), |
| 138 display_type_(display_type), | 154 display_type_(display_type), |
| 139 weak_factory_(this) {} | 155 weak_factory_(this) {} |
| 140 | 156 |
| 141 UserSelectionScreen::~UserSelectionScreen() { | 157 UserSelectionScreen::~UserSelectionScreen() { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 user_dict->SetString(kKeyDisplayName, user->GetDisplayName()); | 189 user_dict->SetString(kKeyDisplayName, user->GetDisplayName()); |
| 174 user_dict->SetBoolean(kKeyPublicAccount, is_public_session); | 190 user_dict->SetBoolean(kKeyPublicAccount, is_public_session); |
| 175 user_dict->SetBoolean(kKeyLegacySupervisedUser, is_legacy_supervised_user); | 191 user_dict->SetBoolean(kKeyLegacySupervisedUser, is_legacy_supervised_user); |
| 176 user_dict->SetBoolean(kKeyChildUser, is_child_user); | 192 user_dict->SetBoolean(kKeyChildUser, is_child_user); |
| 177 user_dict->SetBoolean(kKeyDesktopUser, false); | 193 user_dict->SetBoolean(kKeyDesktopUser, false); |
| 178 user_dict->SetInteger(kKeyInitialAuthType, auth_type); | 194 user_dict->SetInteger(kKeyInitialAuthType, auth_type); |
| 179 user_dict->SetBoolean(kKeyShowPin, CanShowPinForUser(user)); | 195 user_dict->SetBoolean(kKeyShowPin, CanShowPinForUser(user)); |
| 180 user_dict->SetBoolean(kKeySignedIn, user->is_logged_in()); | 196 user_dict->SetBoolean(kKeySignedIn, user->is_logged_in()); |
| 181 user_dict->SetBoolean(kKeyIsOwner, is_owner); | 197 user_dict->SetBoolean(kKeyIsOwner, is_owner); |
| 182 user_dict->SetBoolean(kKeyIsActiveDirectory, user->IsActiveDirectoryUser()); | 198 user_dict->SetBoolean(kKeyIsActiveDirectory, user->IsActiveDirectoryUser()); |
| 199 user_dict->SetBoolean(kKeyAllowFingerprint, AllowFingerprintForUser(user)); |
| 183 | 200 |
| 184 FillMultiProfileUserPrefs(user, user_dict, is_signin_to_add); | 201 FillMultiProfileUserPrefs(user, user_dict, is_signin_to_add); |
| 185 FillKnownUserPrefs(user, user_dict); | 202 FillKnownUserPrefs(user, user_dict); |
| 186 | 203 |
| 187 if (is_public_session) { | 204 if (is_public_session) { |
| 188 AddPublicSessionDetailsToUserDictionaryEntry( | 205 AddPublicSessionDetailsToUserDictionaryEntry( |
| 189 user_dict, public_session_recommended_locales); | 206 user_dict, public_session_recommended_locales); |
| 190 } | 207 } |
| 191 } | 208 } |
| 192 | 209 |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 // The user profile should exist if and only if this is the lock screen. | 595 // The user profile should exist if and only if this is the lock screen. |
| 579 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); | 596 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); |
| 580 | 597 |
| 581 if (!profile) | 598 if (!profile) |
| 582 profile = profile_helper->GetSigninProfile(); | 599 profile = profile_helper->GetSigninProfile(); |
| 583 | 600 |
| 584 return EasyUnlockService::Get(profile); | 601 return EasyUnlockService::Get(profile); |
| 585 } | 602 } |
| 586 | 603 |
| 587 } // namespace chromeos | 604 } // namespace chromeos |
| OLD | NEW |