| 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 kKeyLocallyManagedUser[] = "locallyManagedUser"; | 33 const char kKeyLocallyManagedUser[] = "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 const size_t kMaxUsers = 18; | 44 const size_t kMaxUsers = 18; |
| 40 | 45 |
| 41 const int kPasswordClearTimeoutSec = 60; | 46 const int kPasswordClearTimeoutSec = 60; |
| 42 | 47 |
| 43 } // namespace | 48 } // namespace |
| 44 | 49 |
| 45 UserSelectionScreen::UserSelectionScreen() : handler_(NULL) { | 50 UserSelectionScreen::UserSelectionScreen() : handler_(NULL) { |
| 46 } | 51 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 94 } |
| 90 | 95 |
| 91 if (is_public_account) { | 96 if (is_public_account) { |
| 92 policy::BrowserPolicyConnectorChromeOS* policy_connector = | 97 policy::BrowserPolicyConnectorChromeOS* policy_connector = |
| 93 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 98 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 94 | 99 |
| 95 if (policy_connector->IsEnterpriseManaged()) { | 100 if (policy_connector->IsEnterpriseManaged()) { |
| 96 user_dict->SetString(kKeyEnterpriseDomain, | 101 user_dict->SetString(kKeyEnterpriseDomain, |
| 97 policy_connector->GetEnterpriseDomain()); | 102 policy_connector->GetEnterpriseDomain()); |
| 98 } | 103 } |
| 104 |
| 105 // TODO(bartfab): Initialize |locale| and |most_relevant_languages| based on |
| 106 // policy. |
| 107 const std::string locale; |
| 108 std::vector<std::string> most_relevant_languages; |
| 109 user_dict->Set( |
| 110 kKeyInitialLocales, |
| 111 GetUILanguageList(&most_relevant_languages, locale).release()); |
| 112 user_dict->Set(kKeyInitialKeyboardLayouts, |
| 113 GetKeyboardLayouts(locale).release()); |
| 99 } | 114 } |
| 100 } | 115 } |
| 101 | 116 |
| 102 // static | 117 // static |
| 103 bool UserSelectionScreen::ShouldForceOnlineSignIn(const User* user) { | 118 bool UserSelectionScreen::ShouldForceOnlineSignIn(const User* user) { |
| 104 // Public sessions are always allowed to log in offline. | 119 // Public sessions are always allowed to log in offline. |
| 105 // Supervised user are allowed to log in offline if their OAuth token status | 120 // Supervised user are allowed to log in offline if their OAuth token status |
| 106 // is unknown or valid. | 121 // is unknown or valid. |
| 107 // For all other users, force online sign in if: | 122 // For all other users, force online sign in if: |
| 108 // * The flag to force online sign-in is set for the user. | 123 // * 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... |
| 288 } | 303 } |
| 289 | 304 |
| 290 ScreenlockBridge::LockHandler::AuthType UserSelectionScreen::GetAuthType( | 305 ScreenlockBridge::LockHandler::AuthType UserSelectionScreen::GetAuthType( |
| 291 const std::string& username) const { | 306 const std::string& username) const { |
| 292 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) | 307 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) |
| 293 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; | 308 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; |
| 294 return user_auth_type_map_.find(username)->second; | 309 return user_auth_type_map_.find(username)->second; |
| 295 } | 310 } |
| 296 | 311 |
| 297 } // namespace chromeos | 312 } // namespace chromeos |
| OLD | NEW |