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 "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 11 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
12 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 12 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
13 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 13 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
14 #include "chrome/browser/signin/screenlock_bridge.h" | 14 #include "chrome/browser/signin/screenlock_bridge.h" |
15 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 15 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
17 #include "components/user_manager/user_type.h" | 17 #include "components/user_manager/user_type.h" |
18 #include "ui/wm/core/user_activity_detector.h" | 18 #include "ui/wm/core/user_activity_detector.h" |
19 | 19 |
20 namespace chromeos { | 20 namespace chromeos { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 // User dictionary keys. | 24 // User dictionary keys. |
25 const char kKeyUsername[] = "username"; | 25 const char kKeyUsername[] = "username"; |
26 const char kKeyDisplayName[] = "displayName"; | 26 const char kKeyDisplayName[] = "displayName"; |
27 const char kKeyEmailAddress[] = "emailAddress"; | 27 const char kKeyEmailAddress[] = "emailAddress"; |
28 const char kKeyEnterpriseDomain[] = "enterpriseDomain"; | 28 const char kKeyEnterpriseDomain[] = "enterpriseDomain"; |
29 const char kKeyPublicAccount[] = "publicAccount"; | 29 const char kKeyPublicAccount[] = "publicAccount"; |
30 const char kKeyLocallyManagedUser[] = "locallyManagedUser"; | 30 const char kKeySupervisedUser[] = "locallyManagedUser"; |
31 const char kKeySignedIn[] = "signedIn"; | 31 const char kKeySignedIn[] = "signedIn"; |
32 const char kKeyCanRemove[] = "canRemove"; | 32 const char kKeyCanRemove[] = "canRemove"; |
33 const char kKeyIsOwner[] = "isOwner"; | 33 const char kKeyIsOwner[] = "isOwner"; |
34 const char kKeyInitialAuthType[] = "initialAuthType"; | 34 const char kKeyInitialAuthType[] = "initialAuthType"; |
35 const char kKeyMultiProfilesAllowed[] = "isMultiProfilesAllowed"; | 35 const char kKeyMultiProfilesAllowed[] = "isMultiProfilesAllowed"; |
36 const char kKeyMultiProfilesPolicy[] = "multiProfilesPolicy"; | 36 const char kKeyMultiProfilesPolicy[] = "multiProfilesPolicy"; |
37 | 37 |
38 // Max number of users to show. | 38 // Max number of users to show. |
39 // Please keep synced with one in signin_userlist_unittest.cc. | 39 // Please keep synced with one in signin_userlist_unittest.cc. |
40 const size_t kMaxUsers = 18; | 40 const size_t kMaxUsers = 18; |
(...skipping 15 matching lines...) Expand all Loading... |
56 // static | 56 // static |
57 void UserSelectionScreen::FillUserDictionary( | 57 void UserSelectionScreen::FillUserDictionary( |
58 User* user, | 58 User* user, |
59 bool is_owner, | 59 bool is_owner, |
60 bool is_signin_to_add, | 60 bool is_signin_to_add, |
61 ScreenlockBridge::LockHandler::AuthType auth_type, | 61 ScreenlockBridge::LockHandler::AuthType auth_type, |
62 base::DictionaryValue* user_dict) { | 62 base::DictionaryValue* user_dict) { |
63 const std::string& user_id = user->email(); | 63 const std::string& user_id = user->email(); |
64 const bool is_public_account = | 64 const bool is_public_account = |
65 user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT; | 65 user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT; |
66 const bool is_locally_managed_user = | 66 const bool is_supervised_user = |
67 user->GetType() == user_manager::USER_TYPE_LOCALLY_MANAGED; | 67 user->GetType() == user_manager::USER_TYPE_SUPERVISED; |
68 | 68 |
69 user_dict->SetString(kKeyUsername, user_id); | 69 user_dict->SetString(kKeyUsername, user_id); |
70 user_dict->SetString(kKeyEmailAddress, user->display_email()); | 70 user_dict->SetString(kKeyEmailAddress, user->display_email()); |
71 user_dict->SetString(kKeyDisplayName, user->GetDisplayName()); | 71 user_dict->SetString(kKeyDisplayName, user->GetDisplayName()); |
72 user_dict->SetBoolean(kKeyPublicAccount, is_public_account); | 72 user_dict->SetBoolean(kKeyPublicAccount, is_public_account); |
73 user_dict->SetBoolean(kKeyLocallyManagedUser, is_locally_managed_user); | 73 user_dict->SetBoolean(kKeySupervisedUser, is_supervised_user); |
74 user_dict->SetInteger(kKeyInitialAuthType, auth_type); | 74 user_dict->SetInteger(kKeyInitialAuthType, auth_type); |
75 user_dict->SetBoolean(kKeySignedIn, user->is_logged_in()); | 75 user_dict->SetBoolean(kKeySignedIn, user->is_logged_in()); |
76 user_dict->SetBoolean(kKeyIsOwner, is_owner); | 76 user_dict->SetBoolean(kKeyIsOwner, is_owner); |
77 | 77 |
78 // Fill in multi-profiles related fields. | 78 // Fill in multi-profiles related fields. |
79 if (is_signin_to_add) { | 79 if (is_signin_to_add) { |
80 MultiProfileUserController* multi_profile_user_controller = | 80 MultiProfileUserController* multi_profile_user_controller = |
81 UserManager::Get()->GetMultiProfileUserController(); | 81 UserManager::Get()->GetMultiProfileUserController(); |
82 std::string behavior = | 82 std::string behavior = |
83 multi_profile_user_controller->GetCachedValue(user_id); | 83 multi_profile_user_controller->GetCachedValue(user_id); |
(...skipping 23 matching lines...) Expand all Loading... |
107 // is unknown or valid. | 107 // is unknown or valid. |
108 // For all other users, force online sign in if: | 108 // For all other users, force online sign in if: |
109 // * The flag to force online sign-in is set for the user. | 109 // * The flag to force online sign-in is set for the user. |
110 // * The user's OAuth token is invalid. | 110 // * The user's OAuth token is invalid. |
111 // * The user's OAuth token status is unknown (except supervised users, | 111 // * The user's OAuth token status is unknown (except supervised users, |
112 // see above). | 112 // see above). |
113 if (user->is_logged_in()) | 113 if (user->is_logged_in()) |
114 return false; | 114 return false; |
115 | 115 |
116 const User::OAuthTokenStatus token_status = user->oauth_token_status(); | 116 const User::OAuthTokenStatus token_status = user->oauth_token_status(); |
117 const bool is_locally_managed_user = | 117 const bool is_supervised_user = |
118 user->GetType() == user_manager::USER_TYPE_LOCALLY_MANAGED; | 118 user->GetType() == user_manager::USER_TYPE_SUPERVISED; |
119 const bool is_public_session = | 119 const bool is_public_session = |
120 user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT; | 120 user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT; |
121 | 121 |
122 if (is_locally_managed_user && | 122 if (is_supervised_user && |
123 token_status == User::OAUTH_TOKEN_STATUS_UNKNOWN) { | 123 token_status == User::OAUTH_TOKEN_STATUS_UNKNOWN) { |
124 return false; | 124 return false; |
125 } | 125 } |
126 | 126 |
127 if (is_public_session) | 127 if (is_public_session) |
128 return false; | 128 return false; |
129 | 129 |
130 return user->force_online_signin() || | 130 return user->force_online_signin() || |
131 (token_status == User::OAUTH2_TOKEN_STATUS_INVALID) || | 131 (token_status == User::OAUTH2_TOKEN_STATUS_INVALID) || |
132 (token_status == User::OAUTH_TOKEN_STATUS_UNKNOWN); | 132 (token_status == User::OAUTH_TOKEN_STATUS_UNKNOWN); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 } | 289 } |
290 | 290 |
291 ScreenlockBridge::LockHandler::AuthType UserSelectionScreen::GetAuthType( | 291 ScreenlockBridge::LockHandler::AuthType UserSelectionScreen::GetAuthType( |
292 const std::string& username) const { | 292 const std::string& username) const { |
293 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) | 293 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) |
294 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; | 294 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; |
295 return user_auth_type_map_.find(username)->second; | 295 return user_auth_type_map_.find(username)->second; |
296 } | 296 } |
297 | 297 |
298 } // namespace chromeos | 298 } // namespace chromeos |
OLD | NEW |