| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 GetUILanguageList(&recommended_locales, std::string()); | 92 GetUILanguageList(&recommended_locales, std::string()); |
| 93 | 93 |
| 94 // Select the the first recommended locale that is actually available or the | 94 // Select the the first recommended locale that is actually available or the |
| 95 // current UI locale if none of them are available. | 95 // current UI locale if none of them are available. |
| 96 const std::string selected_locale = FindMostRelevantLocale( | 96 const std::string selected_locale = FindMostRelevantLocale( |
| 97 recommended_locales, | 97 recommended_locales, |
| 98 *available_locales.get(), | 98 *available_locales.get(), |
| 99 g_browser_process->GetApplicationLocale()); | 99 g_browser_process->GetApplicationLocale()); |
| 100 | 100 |
| 101 // Set |kKeyInitialLocales| to the list of available locales. | 101 // Set |kKeyInitialLocales| to the list of available locales. |
| 102 user_dict->Set(kKeyInitialLocales, available_locales.release()); | 102 user_dict->Set(kKeyInitialLocales, std::move(available_locales)); |
| 103 | 103 |
| 104 // Set |kKeyInitialLocale| to the initially selected locale. | 104 // Set |kKeyInitialLocale| to the initially selected locale. |
| 105 user_dict->SetString(kKeyInitialLocale, selected_locale); | 105 user_dict->SetString(kKeyInitialLocale, selected_locale); |
| 106 | 106 |
| 107 // Set |kKeyInitialMultipleRecommendedLocales| to indicate whether the list | 107 // Set |kKeyInitialMultipleRecommendedLocales| to indicate whether the list |
| 108 // of recommended locales contains at least two entries. This is used to | 108 // of recommended locales contains at least two entries. This is used to |
| 109 // decide whether the public session pod expands to its basic form (for zero | 109 // decide whether the public session pod expands to its basic form (for zero |
| 110 // or one recommended locales) or the advanced form (two or more recommended | 110 // or one recommended locales) or the advanced form (two or more recommended |
| 111 // locales). | 111 // locales). |
| 112 user_dict->SetBoolean(kKeyInitialMultipleRecommendedLocales, | 112 user_dict->SetBoolean(kKeyInitialMultipleRecommendedLocales, |
| 113 recommended_locales.size() >= 2); | 113 recommended_locales.size() >= 2); |
| 114 | 114 |
| 115 // Set |kKeyInitialKeyboardLayout| to the current keyboard layout. This | 115 // Set |kKeyInitialKeyboardLayout| to the current keyboard layout. This |
| 116 // value will be used temporarily only because the UI immediately requests a | 116 // value will be used temporarily only because the UI immediately requests a |
| 117 // list of keyboard layouts suitable for the currently selected locale. | 117 // list of keyboard layouts suitable for the currently selected locale. |
| 118 user_dict->Set(kKeyInitialKeyboardLayout, | 118 user_dict->Set(kKeyInitialKeyboardLayout, GetCurrentKeyboardLayout()); |
| 119 GetCurrentKeyboardLayout().release()); | |
| 120 } | 119 } |
| 121 | 120 |
| 122 // Returns true if the PIN keyboard should be displayed for the given |user|. | 121 // Returns true if the PIN keyboard should be displayed for the given |user|. |
| 123 bool CanShowPinForUser(user_manager::User* user) { | 122 bool CanShowPinForUser(user_manager::User* user) { |
| 124 if (!user->is_logged_in()) | 123 if (!user->is_logged_in()) |
| 125 return false; | 124 return false; |
| 126 | 125 |
| 127 quick_unlock::QuickUnlockStorage* quick_unlock_storage = | 126 quick_unlock::QuickUnlockStorage* quick_unlock_storage = |
| 128 quick_unlock::QuickUnlockFactory::GetForUser(user); | 127 quick_unlock::QuickUnlockFactory::GetForUser(user); |
| 129 if (!quick_unlock_storage) | 128 if (!quick_unlock_storage) |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 // The user profile should exist if and only if this is the lock screen. | 597 // The user profile should exist if and only if this is the lock screen. |
| 599 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); | 598 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); |
| 600 | 599 |
| 601 if (!profile) | 600 if (!profile) |
| 602 profile = profile_helper->GetSigninProfile(); | 601 profile = profile_helper->GetSigninProfile(); |
| 603 | 602 |
| 604 return EasyUnlockService::Get(profile); | 603 return EasyUnlockService::Get(profile); |
| 605 } | 604 } |
| 606 | 605 |
| 607 } // namespace chromeos | 606 } // namespace chromeos |
| OLD | NEW |