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 <vector> |
| 8 |
7 #include "ash/shell.h" | 9 #include "ash/shell.h" |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 13 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
12 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 14 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
13 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 15 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
14 #include "chrome/browser/signin/screenlock_bridge.h" | 16 #include "chrome/browser/signin/screenlock_bridge.h" |
| 17 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
15 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 18 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
16 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
17 #include "components/user_manager/user_type.h" | 20 #include "components/user_manager/user_type.h" |
18 #include "ui/wm/core/user_activity_detector.h" | 21 #include "ui/wm/core/user_activity_detector.h" |
19 | 22 |
20 namespace chromeos { | 23 namespace chromeos { |
21 | 24 |
22 namespace { | 25 namespace { |
23 | 26 |
24 // User dictionary keys. | 27 // User dictionary keys. |
25 const char kKeyUsername[] = "username"; | 28 const char kKeyUsername[] = "username"; |
26 const char kKeyDisplayName[] = "displayName"; | 29 const char kKeyDisplayName[] = "displayName"; |
27 const char kKeyEmailAddress[] = "emailAddress"; | 30 const char kKeyEmailAddress[] = "emailAddress"; |
28 const char kKeyEnterpriseDomain[] = "enterpriseDomain"; | 31 const char kKeyEnterpriseDomain[] = "enterpriseDomain"; |
29 const char kKeyPublicAccount[] = "publicAccount"; | 32 const char kKeyPublicAccount[] = "publicAccount"; |
30 const char kKeySupervisedUser[] = "locallyManagedUser"; | 33 const char kKeySupervisedUser[] = "locallyManagedUser"; |
31 const char kKeySignedIn[] = "signedIn"; | 34 const char kKeySignedIn[] = "signedIn"; |
32 const char kKeyCanRemove[] = "canRemove"; | 35 const char kKeyCanRemove[] = "canRemove"; |
33 const char kKeyIsOwner[] = "isOwner"; | 36 const char kKeyIsOwner[] = "isOwner"; |
34 const char kKeyInitialAuthType[] = "initialAuthType"; | 37 const char kKeyInitialAuthType[] = "initialAuthType"; |
35 const char kKeyMultiProfilesAllowed[] = "isMultiProfilesAllowed"; | 38 const char kKeyMultiProfilesAllowed[] = "isMultiProfilesAllowed"; |
36 const char kKeyMultiProfilesPolicy[] = "multiProfilesPolicy"; | 39 const char kKeyMultiProfilesPolicy[] = "multiProfilesPolicy"; |
| 40 const char kKeyInitialLocales[] = "initialLocales"; |
| 41 const char kKeyInitialKeyboardLayouts[] = "initialKeyboardLayouts"; |
37 | 42 |
38 // Max number of users to show. | 43 // Max number of users to show. |
39 // Please keep synced with one in signin_userlist_unittest.cc. | 44 // Please keep synced with one in signin_userlist_unittest.cc. |
40 const size_t kMaxUsers = 18; | 45 const size_t kMaxUsers = 18; |
41 | 46 |
42 const int kPasswordClearTimeoutSec = 60; | 47 const int kPasswordClearTimeoutSec = 60; |
43 | 48 |
44 } // namespace | 49 } // namespace |
45 | 50 |
46 UserSelectionScreen::UserSelectionScreen() : handler_(NULL) { | 51 UserSelectionScreen::UserSelectionScreen() : handler_(NULL) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 95 } |
91 | 96 |
92 if (is_public_account) { | 97 if (is_public_account) { |
93 policy::BrowserPolicyConnectorChromeOS* policy_connector = | 98 policy::BrowserPolicyConnectorChromeOS* policy_connector = |
94 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 99 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
95 | 100 |
96 if (policy_connector->IsEnterpriseManaged()) { | 101 if (policy_connector->IsEnterpriseManaged()) { |
97 user_dict->SetString(kKeyEnterpriseDomain, | 102 user_dict->SetString(kKeyEnterpriseDomain, |
98 policy_connector->GetEnterpriseDomain()); | 103 policy_connector->GetEnterpriseDomain()); |
99 } | 104 } |
| 105 |
| 106 // TODO(bartfab): Initialize |locale| and |most_relevant_languages| based on |
| 107 // policy. |
| 108 const std::string locale; |
| 109 std::vector<std::string> most_relevant_languages; |
| 110 user_dict->Set( |
| 111 kKeyInitialLocales, |
| 112 GetUILanguageList(&most_relevant_languages, locale).release()); |
| 113 user_dict->Set(kKeyInitialKeyboardLayouts, |
| 114 GetKeyboardLayoutsForLocale(locale).release()); |
100 } | 115 } |
101 } | 116 } |
102 | 117 |
103 // static | 118 // static |
104 bool UserSelectionScreen::ShouldForceOnlineSignIn(const User* user) { | 119 bool UserSelectionScreen::ShouldForceOnlineSignIn(const User* user) { |
105 // Public sessions are always allowed to log in offline. | 120 // Public sessions are always allowed to log in offline. |
106 // Supervised user are allowed to log in offline if their OAuth token status | 121 // Supervised user are allowed to log in offline if their OAuth token status |
107 // is unknown or valid. | 122 // is unknown or valid. |
108 // For all other users, force online sign in if: | 123 // For all other users, force online sign in if: |
109 // * The flag to force online sign-in is set for the user. | 124 // * The flag to force online sign-in is set for the user. |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 } | 304 } |
290 | 305 |
291 ScreenlockBridge::LockHandler::AuthType UserSelectionScreen::GetAuthType( | 306 ScreenlockBridge::LockHandler::AuthType UserSelectionScreen::GetAuthType( |
292 const std::string& username) const { | 307 const std::string& username) const { |
293 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) | 308 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) |
294 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; | 309 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; |
295 return user_auth_type_map_.find(username)->second; | 310 return user_auth_type_map_.find(username)->second; |
296 } | 311 } |
297 | 312 |
298 } // namespace chromeos | 313 } // namespace chromeos |
OLD | NEW |