| 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 "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/browser_process_platform_part.h" | 13 #include "chrome/browser/browser_process_platform_part.h" |
| 14 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 14 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 15 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage.h" |
| 16 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage_factory.h" |
| 15 #include "chrome/browser/chromeos/login/reauth_stats.h" | 17 #include "chrome/browser/chromeos/login/reauth_stats.h" |
| 16 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 18 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 17 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" | 19 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" |
| 18 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 20 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 19 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 21 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
| 20 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 22 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 21 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 23 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 22 #include "chrome/browser/signin/easy_unlock_service.h" | 24 #include "chrome/browser/signin/easy_unlock_service.h" |
| 23 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 25 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
| 24 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 26 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 37 // User dictionary keys. | 39 // User dictionary keys. |
| 38 const char kKeyUsername[] = "username"; | 40 const char kKeyUsername[] = "username"; |
| 39 const char kKeyGaiaID[] = "gaiaId"; | 41 const char kKeyGaiaID[] = "gaiaId"; |
| 40 const char kKeyDisplayName[] = "displayName"; | 42 const char kKeyDisplayName[] = "displayName"; |
| 41 const char kKeyEmailAddress[] = "emailAddress"; | 43 const char kKeyEmailAddress[] = "emailAddress"; |
| 42 const char kKeyEnterpriseDomain[] = "enterpriseDomain"; | 44 const char kKeyEnterpriseDomain[] = "enterpriseDomain"; |
| 43 const char kKeyPublicAccount[] = "publicAccount"; | 45 const char kKeyPublicAccount[] = "publicAccount"; |
| 44 const char kKeyLegacySupervisedUser[] = "legacySupervisedUser"; | 46 const char kKeyLegacySupervisedUser[] = "legacySupervisedUser"; |
| 45 const char kKeyChildUser[] = "childUser"; | 47 const char kKeyChildUser[] = "childUser"; |
| 46 const char kKeyDesktopUser[] = "isDesktopUser"; | 48 const char kKeyDesktopUser[] = "isDesktopUser"; |
| 49 const char kKeyShowPin[] = "showPin"; |
| 47 const char kKeySignedIn[] = "signedIn"; | 50 const char kKeySignedIn[] = "signedIn"; |
| 48 const char kKeyCanRemove[] = "canRemove"; | 51 const char kKeyCanRemove[] = "canRemove"; |
| 49 const char kKeyIsOwner[] = "isOwner"; | 52 const char kKeyIsOwner[] = "isOwner"; |
| 50 const char kKeyInitialAuthType[] = "initialAuthType"; | 53 const char kKeyInitialAuthType[] = "initialAuthType"; |
| 51 const char kKeyMultiProfilesAllowed[] = "isMultiProfilesAllowed"; | 54 const char kKeyMultiProfilesAllowed[] = "isMultiProfilesAllowed"; |
| 52 const char kKeyMultiProfilesPolicy[] = "multiProfilesPolicy"; | 55 const char kKeyMultiProfilesPolicy[] = "multiProfilesPolicy"; |
| 53 const char kKeyInitialLocales[] = "initialLocales"; | 56 const char kKeyInitialLocales[] = "initialLocales"; |
| 54 const char kKeyInitialLocale[] = "initialLocale"; | 57 const char kKeyInitialLocale[] = "initialLocale"; |
| 55 const char kKeyInitialMultipleRecommendedLocales[] = | 58 const char kKeyInitialMultipleRecommendedLocales[] = |
| 56 "initialMultipleRecommendedLocales"; | 59 "initialMultipleRecommendedLocales"; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 user_dict->SetBoolean(kKeyInitialMultipleRecommendedLocales, | 107 user_dict->SetBoolean(kKeyInitialMultipleRecommendedLocales, |
| 105 recommended_locales.size() >= 2); | 108 recommended_locales.size() >= 2); |
| 106 | 109 |
| 107 // Set |kKeyInitialKeyboardLayout| to the current keyboard layout. This | 110 // Set |kKeyInitialKeyboardLayout| to the current keyboard layout. This |
| 108 // value will be used temporarily only because the UI immediately requests a | 111 // value will be used temporarily only because the UI immediately requests a |
| 109 // list of keyboard layouts suitable for the currently selected locale. | 112 // list of keyboard layouts suitable for the currently selected locale. |
| 110 user_dict->Set(kKeyInitialKeyboardLayout, | 113 user_dict->Set(kKeyInitialKeyboardLayout, |
| 111 GetCurrentKeyboardLayout().release()); | 114 GetCurrentKeyboardLayout().release()); |
| 112 } | 115 } |
| 113 | 116 |
| 117 // Returns true if the PIN keyboard should be displayed for the given |user|. |
| 118 bool CanShowPinForUser(user_manager::User* user) { |
| 119 if (!user->is_logged_in()) |
| 120 return false; |
| 121 |
| 122 PinStorage* pin_storage = PinStorageFactory::GetForUser(user); |
| 123 if (!pin_storage) |
| 124 return false; |
| 125 |
| 126 return pin_storage->IsPinAuthenticationAvailable(); |
| 127 } |
| 128 |
| 114 } // namespace | 129 } // namespace |
| 115 | 130 |
| 116 UserSelectionScreen::UserSelectionScreen(const std::string& display_type) | 131 UserSelectionScreen::UserSelectionScreen(const std::string& display_type) |
| 117 : handler_(nullptr), | 132 : handler_(nullptr), |
| 118 login_display_delegate_(nullptr), | 133 login_display_delegate_(nullptr), |
| 119 view_(nullptr), | 134 view_(nullptr), |
| 120 display_type_(display_type), | 135 display_type_(display_type), |
| 121 weak_factory_(this) { | 136 weak_factory_(this) { |
| 122 } | 137 } |
| 123 | 138 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 152 const bool is_child_user = user->GetType() == user_manager::USER_TYPE_CHILD; | 167 const bool is_child_user = user->GetType() == user_manager::USER_TYPE_CHILD; |
| 153 | 168 |
| 154 user_dict->SetString(kKeyUsername, user->GetAccountId().Serialize()); | 169 user_dict->SetString(kKeyUsername, user->GetAccountId().Serialize()); |
| 155 user_dict->SetString(kKeyEmailAddress, user->display_email()); | 170 user_dict->SetString(kKeyEmailAddress, user->display_email()); |
| 156 user_dict->SetString(kKeyDisplayName, user->GetDisplayName()); | 171 user_dict->SetString(kKeyDisplayName, user->GetDisplayName()); |
| 157 user_dict->SetBoolean(kKeyPublicAccount, is_public_session); | 172 user_dict->SetBoolean(kKeyPublicAccount, is_public_session); |
| 158 user_dict->SetBoolean(kKeyLegacySupervisedUser, is_legacy_supervised_user); | 173 user_dict->SetBoolean(kKeyLegacySupervisedUser, is_legacy_supervised_user); |
| 159 user_dict->SetBoolean(kKeyChildUser, is_child_user); | 174 user_dict->SetBoolean(kKeyChildUser, is_child_user); |
| 160 user_dict->SetBoolean(kKeyDesktopUser, false); | 175 user_dict->SetBoolean(kKeyDesktopUser, false); |
| 161 user_dict->SetInteger(kKeyInitialAuthType, auth_type); | 176 user_dict->SetInteger(kKeyInitialAuthType, auth_type); |
| 177 user_dict->SetBoolean(kKeyShowPin, CanShowPinForUser(user)); |
| 162 user_dict->SetBoolean(kKeySignedIn, user->is_logged_in()); | 178 user_dict->SetBoolean(kKeySignedIn, user->is_logged_in()); |
| 163 user_dict->SetBoolean(kKeyIsOwner, is_owner); | 179 user_dict->SetBoolean(kKeyIsOwner, is_owner); |
| 164 | 180 |
| 165 FillMultiProfileUserPrefs(user, user_dict, is_signin_to_add); | 181 FillMultiProfileUserPrefs(user, user_dict, is_signin_to_add); |
| 166 FillKnownUserPrefs(user, user_dict); | 182 FillKnownUserPrefs(user, user_dict); |
| 167 | 183 |
| 168 if (is_public_session) { | 184 if (is_public_session) { |
| 169 AddPublicSessionDetailsToUserDictionaryEntry( | 185 AddPublicSessionDetailsToUserDictionaryEntry( |
| 170 user_dict, public_session_recommended_locales); | 186 user_dict, public_session_recommended_locales); |
| 171 } | 187 } |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 // The user profile should exist if and only if this is the lock screen. | 569 // The user profile should exist if and only if this is the lock screen. |
| 554 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); | 570 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); |
| 555 | 571 |
| 556 if (!profile) | 572 if (!profile) |
| 557 profile = profile_helper->GetSigninProfile(); | 573 profile = profile_helper->GetSigninProfile(); |
| 558 | 574 |
| 559 return EasyUnlockService::Get(profile); | 575 return EasyUnlockService::Get(profile); |
| 560 } | 576 } |
| 561 | 577 |
| 562 } // namespace chromeos | 578 } // namespace chromeos |
| OLD | NEW |