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->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->IsFingerprintAuthenticationAvailable(); |
132 } | 147 } |
133 | 148 |
134 } // namespace | 149 } // namespace |
135 | 150 |
136 UserSelectionScreen::UserSelectionScreen(const std::string& display_type) | 151 UserSelectionScreen::UserSelectionScreen(const std::string& display_type) |
137 : BaseScreen(nullptr, OobeScreen::SCREEN_USER_SELECTION), | 152 : BaseScreen(nullptr, OobeScreen::SCREEN_USER_SELECTION), |
138 display_type_(display_type), | 153 display_type_(display_type), |
139 weak_factory_(this) {} | 154 weak_factory_(this) {} |
140 | 155 |
141 UserSelectionScreen::~UserSelectionScreen() { | 156 UserSelectionScreen::~UserSelectionScreen() { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 user_dict->SetString(kKeyDisplayName, user->GetDisplayName()); | 188 user_dict->SetString(kKeyDisplayName, user->GetDisplayName()); |
174 user_dict->SetBoolean(kKeyPublicAccount, is_public_session); | 189 user_dict->SetBoolean(kKeyPublicAccount, is_public_session); |
175 user_dict->SetBoolean(kKeyLegacySupervisedUser, is_legacy_supervised_user); | 190 user_dict->SetBoolean(kKeyLegacySupervisedUser, is_legacy_supervised_user); |
176 user_dict->SetBoolean(kKeyChildUser, is_child_user); | 191 user_dict->SetBoolean(kKeyChildUser, is_child_user); |
177 user_dict->SetBoolean(kKeyDesktopUser, false); | 192 user_dict->SetBoolean(kKeyDesktopUser, false); |
178 user_dict->SetInteger(kKeyInitialAuthType, auth_type); | 193 user_dict->SetInteger(kKeyInitialAuthType, auth_type); |
179 user_dict->SetBoolean(kKeyShowPin, CanShowPinForUser(user)); | 194 user_dict->SetBoolean(kKeyShowPin, CanShowPinForUser(user)); |
180 user_dict->SetBoolean(kKeySignedIn, user->is_logged_in()); | 195 user_dict->SetBoolean(kKeySignedIn, user->is_logged_in()); |
181 user_dict->SetBoolean(kKeyIsOwner, is_owner); | 196 user_dict->SetBoolean(kKeyIsOwner, is_owner); |
182 user_dict->SetBoolean(kKeyIsActiveDirectory, user->IsActiveDirectoryUser()); | 197 user_dict->SetBoolean(kKeyIsActiveDirectory, user->IsActiveDirectoryUser()); |
| 198 user_dict->SetBoolean(kKeyAllowFingerprint, AllowFingerprintForUser(user)); |
183 | 199 |
184 FillMultiProfileUserPrefs(user, user_dict, is_signin_to_add); | 200 FillMultiProfileUserPrefs(user, user_dict, is_signin_to_add); |
185 FillKnownUserPrefs(user, user_dict); | 201 FillKnownUserPrefs(user, user_dict); |
186 | 202 |
187 if (is_public_session) { | 203 if (is_public_session) { |
188 AddPublicSessionDetailsToUserDictionaryEntry( | 204 AddPublicSessionDetailsToUserDictionaryEntry( |
189 user_dict, public_session_recommended_locales); | 205 user_dict, public_session_recommended_locales); |
190 } | 206 } |
191 } | 207 } |
192 | 208 |
(...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. | 594 // The user profile should exist if and only if this is the lock screen. |
579 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); | 595 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); |
580 | 596 |
581 if (!profile) | 597 if (!profile) |
582 profile = profile_helper->GetSigninProfile(); | 598 profile = profile_helper->GetSigninProfile(); |
583 | 599 |
584 return EasyUnlockService::Get(profile); | 600 return EasyUnlockService::Get(profile); |
585 } | 601 } |
586 | 602 |
587 } // namespace chromeos | 603 } // namespace chromeos |
OLD | NEW |