| 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> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 const char kKeyEnterpriseDomain[] = "enterpriseDomain"; | 31 const char kKeyEnterpriseDomain[] = "enterpriseDomain"; |
| 32 const char kKeyPublicAccount[] = "publicAccount"; | 32 const char kKeyPublicAccount[] = "publicAccount"; |
| 33 const char kKeySupervisedUser[] = "supervisedUser"; | 33 const char kKeySupervisedUser[] = "supervisedUser"; |
| 34 const char kKeySignedIn[] = "signedIn"; | 34 const char kKeySignedIn[] = "signedIn"; |
| 35 const char kKeyCanRemove[] = "canRemove"; | 35 const char kKeyCanRemove[] = "canRemove"; |
| 36 const char kKeyIsOwner[] = "isOwner"; | 36 const char kKeyIsOwner[] = "isOwner"; |
| 37 const char kKeyInitialAuthType[] = "initialAuthType"; | 37 const char kKeyInitialAuthType[] = "initialAuthType"; |
| 38 const char kKeyMultiProfilesAllowed[] = "isMultiProfilesAllowed"; | 38 const char kKeyMultiProfilesAllowed[] = "isMultiProfilesAllowed"; |
| 39 const char kKeyMultiProfilesPolicy[] = "multiProfilesPolicy"; | 39 const char kKeyMultiProfilesPolicy[] = "multiProfilesPolicy"; |
| 40 const char kKeyInitialLocales[] = "initialLocales"; | 40 const char kKeyInitialLocales[] = "initialLocales"; |
| 41 const char kKeyInitialKeyboardLayouts[] = "initialKeyboardLayouts"; | 41 const char kKeyInitialKeyboardLayout[] = "initialKeyboardLayout"; |
| 42 | 42 |
| 43 // Max number of users to show. | 43 // Max number of users to show. |
| 44 // Please keep synced with one in signin_userlist_unittest.cc. | 44 // Please keep synced with one in signin_userlist_unittest.cc. |
| 45 const size_t kMaxUsers = 18; | 45 const size_t kMaxUsers = 18; |
| 46 | 46 |
| 47 const int kPasswordClearTimeoutSec = 60; | 47 const int kPasswordClearTimeoutSec = 60; |
| 48 | 48 |
| 49 } // namespace | 49 } // namespace |
| 50 | 50 |
| 51 UserSelectionScreen::UserSelectionScreen() : handler_(NULL) { | 51 UserSelectionScreen::UserSelectionScreen() : handler_(NULL) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 if (is_public_account) { | 97 if (is_public_account) { |
| 98 policy::BrowserPolicyConnectorChromeOS* policy_connector = | 98 policy::BrowserPolicyConnectorChromeOS* policy_connector = |
| 99 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 99 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 100 | 100 |
| 101 if (policy_connector->IsEnterpriseManaged()) { | 101 if (policy_connector->IsEnterpriseManaged()) { |
| 102 user_dict->SetString(kKeyEnterpriseDomain, | 102 user_dict->SetString(kKeyEnterpriseDomain, |
| 103 policy_connector->GetEnterpriseDomain()); | 103 policy_connector->GetEnterpriseDomain()); |
| 104 } | 104 } |
| 105 | 105 |
| 106 // TODO(bartfab): Initialize |locale| and |most_relevant_languages| based on | 106 // TODO(bartfab): Initialize |locale| based on policy. |
| 107 // policy. | |
| 108 const std::string locale; | 107 const std::string locale; |
| 109 std::vector<std::string> most_relevant_languages; | 108 std::vector<std::string> most_relevant_languages; |
| 110 user_dict->Set( | 109 user_dict->Set( |
| 111 kKeyInitialLocales, | 110 kKeyInitialLocales, |
| 112 GetUILanguageList(&most_relevant_languages, locale).release()); | 111 GetUILanguageList(&most_relevant_languages, locale).release()); |
| 113 user_dict->Set(kKeyInitialKeyboardLayouts, | 112 user_dict->Set(kKeyInitialKeyboardLayout, |
| 114 GetKeyboardLayoutsForLocale(locale).release()); | 113 GetCurrentKeyboardLayout().release()); |
| 115 } | 114 } |
| 116 } | 115 } |
| 117 | 116 |
| 118 // static | 117 // static |
| 119 bool UserSelectionScreen::ShouldForceOnlineSignIn( | 118 bool UserSelectionScreen::ShouldForceOnlineSignIn( |
| 120 const user_manager::User* user) { | 119 const user_manager::User* user) { |
| 121 // Public sessions are always allowed to log in offline. | 120 // Public sessions are always allowed to log in offline. |
| 122 // 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 |
| 123 // is unknown or valid. | 122 // is unknown or valid. |
| 124 // For all other users, force online sign in if: | 123 // For all other users, force online sign in if: |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 } | 307 } |
| 309 | 308 |
| 310 ScreenlockBridge::LockHandler::AuthType UserSelectionScreen::GetAuthType( | 309 ScreenlockBridge::LockHandler::AuthType UserSelectionScreen::GetAuthType( |
| 311 const std::string& username) const { | 310 const std::string& username) const { |
| 312 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) | 311 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) |
| 313 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; | 312 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; |
| 314 return user_auth_type_map_.find(username)->second; | 313 return user_auth_type_map_.find(username)->second; |
| 315 } | 314 } |
| 316 | 315 |
| 317 } // namespace chromeos | 316 } // namespace chromeos |
| OLD | NEW |