| 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/location.h" | 10 #include "base/location.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/browser_process_platform_part.h" | 15 #include "chrome/browser/browser_process_platform_part.h" |
| 16 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 16 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 17 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 17 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 18 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
| 18 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
| 19 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 19 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 20 #include "chrome/browser/signin/screenlock_bridge.h" | 20 #include "chrome/browser/signin/screenlock_bridge.h" |
| 21 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 21 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
| 22 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 22 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| 23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 24 #include "components/user_manager/user_manager.h" |
| 24 #include "components/user_manager/user_type.h" | 25 #include "components/user_manager/user_type.h" |
| 25 #include "ui/wm/core/user_activity_detector.h" | 26 #include "ui/wm/core/user_activity_detector.h" |
| 26 | 27 |
| 27 namespace chromeos { | 28 namespace chromeos { |
| 28 | 29 |
| 29 namespace { | 30 namespace { |
| 30 | 31 |
| 31 // User dictionary keys. | 32 // User dictionary keys. |
| 32 const char kKeyUsername[] = "username"; | 33 const char kKeyUsername[] = "username"; |
| 33 const char kKeyDisplayName[] = "displayName"; | 34 const char kKeyDisplayName[] = "displayName"; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 user_dict->SetString(kKeyDisplayName, user->GetDisplayName()); | 130 user_dict->SetString(kKeyDisplayName, user->GetDisplayName()); |
| 130 user_dict->SetBoolean(kKeyPublicAccount, is_public_session); | 131 user_dict->SetBoolean(kKeyPublicAccount, is_public_session); |
| 131 user_dict->SetBoolean(kKeySupervisedUser, is_supervised_user); | 132 user_dict->SetBoolean(kKeySupervisedUser, is_supervised_user); |
| 132 user_dict->SetInteger(kKeyInitialAuthType, auth_type); | 133 user_dict->SetInteger(kKeyInitialAuthType, auth_type); |
| 133 user_dict->SetBoolean(kKeySignedIn, user->is_logged_in()); | 134 user_dict->SetBoolean(kKeySignedIn, user->is_logged_in()); |
| 134 user_dict->SetBoolean(kKeyIsOwner, is_owner); | 135 user_dict->SetBoolean(kKeyIsOwner, is_owner); |
| 135 | 136 |
| 136 // Fill in multi-profiles related fields. | 137 // Fill in multi-profiles related fields. |
| 137 if (is_signin_to_add) { | 138 if (is_signin_to_add) { |
| 138 MultiProfileUserController* multi_profile_user_controller = | 139 MultiProfileUserController* multi_profile_user_controller = |
| 139 UserManager::Get()->GetMultiProfileUserController(); | 140 ChromeUserManager::Get()->GetMultiProfileUserController(); |
| 140 MultiProfileUserController::UserAllowedInSessionReason isUserAllowedReason; | 141 MultiProfileUserController::UserAllowedInSessionReason isUserAllowedReason; |
| 141 bool isUserAllowed = multi_profile_user_controller->IsUserAllowedInSession( | 142 bool isUserAllowed = multi_profile_user_controller->IsUserAllowedInSession( |
| 142 user_id, &isUserAllowedReason); | 143 user_id, &isUserAllowedReason); |
| 143 user_dict->SetBoolean(kKeyMultiProfilesAllowed, isUserAllowed); | 144 user_dict->SetBoolean(kKeyMultiProfilesAllowed, isUserAllowed); |
| 144 | 145 |
| 145 std::string behavior; | 146 std::string behavior; |
| 146 switch (isUserAllowedReason) { | 147 switch (isUserAllowedReason) { |
| 147 case MultiProfileUserController::NOT_ALLOWED_OWNER_AS_SECONDARY: | 148 case MultiProfileUserController::NOT_ALLOWED_OWNER_AS_SECONDARY: |
| 148 behavior = MultiProfileUserController::kBehaviorOwnerPrimaryOnly; | 149 behavior = MultiProfileUserController::kBehaviorOwnerPrimaryOnly; |
| 149 break; | 150 break; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 } | 293 } |
| 293 | 294 |
| 294 void UserSelectionScreen::SendUserList() { | 295 void UserSelectionScreen::SendUserList() { |
| 295 base::ListValue users_list; | 296 base::ListValue users_list; |
| 296 const user_manager::UserList& users = GetUsers(); | 297 const user_manager::UserList& users = GetUsers(); |
| 297 | 298 |
| 298 // TODO(nkostylev): Move to a separate method in UserManager. | 299 // TODO(nkostylev): Move to a separate method in UserManager. |
| 299 // http://crbug.com/230852 | 300 // http://crbug.com/230852 |
| 300 bool single_user = users.size() == 1; | 301 bool single_user = users.size() == 1; |
| 301 bool is_signin_to_add = LoginDisplayHostImpl::default_host() && | 302 bool is_signin_to_add = LoginDisplayHostImpl::default_host() && |
| 302 UserManager::Get()->IsUserLoggedIn(); | 303 user_manager::UserManager::Get()->IsUserLoggedIn(); |
| 303 std::string owner; | 304 std::string owner; |
| 304 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner); | 305 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner); |
| 305 | 306 |
| 306 policy::BrowserPolicyConnectorChromeOS* connector = | 307 policy::BrowserPolicyConnectorChromeOS* connector = |
| 307 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 308 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 308 bool is_enterprise_managed = connector->IsEnterpriseManaged(); | 309 bool is_enterprise_managed = connector->IsEnterpriseManaged(); |
| 309 | 310 |
| 310 const user_manager::UserList users_to_send = | 311 const user_manager::UserList users_to_send = |
| 311 PrepareUserListForSending(users, owner, is_signin_to_add); | 312 PrepareUserListForSending(users, owner, is_signin_to_add); |
| 312 | 313 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 } | 366 } |
| 366 | 367 |
| 367 ScreenlockBridge::LockHandler::AuthType UserSelectionScreen::GetAuthType( | 368 ScreenlockBridge::LockHandler::AuthType UserSelectionScreen::GetAuthType( |
| 368 const std::string& username) const { | 369 const std::string& username) const { |
| 369 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) | 370 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) |
| 370 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; | 371 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; |
| 371 return user_auth_type_map_.find(username)->second; | 372 return user_auth_type_map_.find(username)->second; |
| 372 } | 373 } |
| 373 | 374 |
| 374 } // namespace chromeos | 375 } // namespace chromeos |
| OLD | NEW |