Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: chrome/browser/chromeos/login/screens/user_selection_screen.h

Issue 2937553002: Create Mojo Struct for user information used in login/lock screen. (Closed)
Patch Set: rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "ash/public/interfaces/lock_screen.mojom.h"
12 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
15 #include "base/values.h" 16 #include "base/values.h"
16 #include "chrome/browser/chromeos/login/screens/base_screen.h" 17 #include "chrome/browser/chromeos/login/screens/base_screen.h"
17 #include "chrome/browser/chromeos/login/signin/token_handle_util.h" 18 #include "chrome/browser/chromeos/login/signin/token_handle_util.h"
18 #include "chrome/browser/chromeos/login/ui/login_display.h" 19 #include "chrome/browser/chromeos/login/ui/login_display.h"
19 #include "components/proximity_auth/screenlock_bridge.h" 20 #include "components/proximity_auth/screenlock_bridge.h"
20 #include "components/signin/core/account_id/account_id.h" 21 #include "components/signin/core/account_id/account_id.h"
21 #include "components/user_manager/user.h" 22 #include "components/user_manager/user.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // proximity_auth::ScreenlockBridge::LockHandler implementation: 74 // proximity_auth::ScreenlockBridge::LockHandler implementation:
74 void ShowBannerMessage(const base::string16& message) override; 75 void ShowBannerMessage(const base::string16& message) override;
75 void ShowUserPodCustomIcon( 76 void ShowUserPodCustomIcon(
76 const AccountId& account_id, 77 const AccountId& account_id,
77 const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions& icon) 78 const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions& icon)
78 override; 79 override;
79 void HideUserPodCustomIcon(const AccountId& account_id) override; 80 void HideUserPodCustomIcon(const AccountId& account_id) override;
80 81
81 void EnableInput() override; 82 void EnableInput() override;
82 void SetAuthType(const AccountId& account_id, 83 void SetAuthType(const AccountId& account_id,
83 AuthType auth_type, 84 proximity_auth::mojom::AuthType auth_type,
84 const base::string16& auth_value) override; 85 const base::string16& auth_value) override;
85 AuthType GetAuthType(const AccountId& account_id) const override; 86 proximity_auth::mojom::AuthType GetAuthType(
87 const AccountId& account_id) const override;
86 ScreenType GetScreenType() const override; 88 ScreenType GetScreenType() const override;
87 89
88 void Unlock(const AccountId& account_id) override; 90 void Unlock(const AccountId& account_id) override;
89 void AttemptEasySignin(const AccountId& account_id, 91 void AttemptEasySignin(const AccountId& account_id,
90 const std::string& secret, 92 const std::string& secret,
91 const std::string& key_label) override; 93 const std::string& key_label) override;
92 94
93 // BaseScreen implementation: 95 // BaseScreen implementation:
94 void Show() override; 96 void Show() override;
95 void Hide() override; 97 void Hide() override;
96 98
97 // Fills |user_dict| with information about |user|. 99 // Fills |user_dict| with information about |user|.
98 static void FillUserDictionary( 100 static void FillUserDictionary(
99 user_manager::User* user, 101 user_manager::User* user,
100 bool is_owner, 102 bool is_owner,
101 bool is_signin_to_add, 103 bool is_signin_to_add,
102 AuthType auth_type, 104 proximity_auth::mojom::AuthType auth_type,
103 const std::vector<std::string>* public_session_recommended_locales, 105 const std::vector<std::string>* public_session_recommended_locales,
104 base::DictionaryValue* user_dict); 106 base::DictionaryValue* user_dict);
105 107
106 // Fills |user_dict| with |user| known preferences. 108 // Fills |user_dict| with |user| known preferences.
107 static void FillKnownUserPrefs(user_manager::User* user, 109 static void FillKnownUserPrefs(user_manager::User* user,
108 base::DictionaryValue* user_dict); 110 base::DictionaryValue* user_dict);
109 111
110 // Fills |user_dict| with |user| multi-profile related preferences. 112 // Fills |user_dict| with |user| multi-profile related preferences.
111 static void FillMultiProfileUserPrefs(user_manager::User* user, 113 static void FillMultiProfileUserPrefs(user_manager::User* user,
112 base::DictionaryValue* user_dict, 114 base::DictionaryValue* user_dict,
113 bool is_signin_to_add); 115 bool is_signin_to_add);
114 116
115 // Determines if user auth status requires online sign in. 117 // Determines if user auth status requires online sign in.
116 static bool ShouldForceOnlineSignIn(const user_manager::User* user); 118 static bool ShouldForceOnlineSignIn(const user_manager::User* user);
117 119
118 std::unique_ptr<base::ListValue> PrepareUserList(); 120 // Fills |user_info| with information about |user|.
121 // TODO: Public sesssions exist in login screen, but not lock screen.
122 // We will need public session locales in the future when we change login
123 // screen to view-based as well. See crbug.com/732452.
124 static void FillUserMojoStruct(const user_manager::User* user,
125 bool is_owner,
126 bool is_signin_to_add,
127 proximity_auth::mojom::AuthType auth_type,
128 ash::mojom::LoginUserInfo* user_info);
129
130 std::unique_ptr<base::ListValue> UpdateAndReturnUserListForWebUI();
131 std::vector<ash::mojom::LoginUserInfoPtr> UpdateAndReturnUserListForMojo();
119 132
120 protected: 133 protected:
121 UserBoardView* view_ = nullptr; 134 UserBoardView* view_ = nullptr;
122 135
123 // Map from public session account IDs to recommended locales set by policy. 136 // Map from public session account IDs to recommended locales set by policy.
124 std::map<AccountId, std::vector<std::string>> 137 std::map<AccountId, std::vector<std::string>>
125 public_session_recommended_locales_; 138 public_session_recommended_locales_;
126 139
127 private: 140 private:
128 class DircryptoMigrationChecker; 141 class DircryptoMigrationChecker;
129 142
130 EasyUnlockService* GetEasyUnlockServiceForUser( 143 EasyUnlockService* GetEasyUnlockServiceForUser(
131 const AccountId& account_id) const; 144 const AccountId& account_id) const;
132 145
133 void OnUserStatusChecked(const AccountId& account_id, 146 void OnUserStatusChecked(const AccountId& account_id,
134 TokenHandleUtil::TokenHandleStatus status); 147 TokenHandleUtil::TokenHandleStatus status);
135 148
136 LoginDisplayWebUIHandler* handler_ = nullptr; 149 LoginDisplayWebUIHandler* handler_ = nullptr;
137 LoginDisplay::Delegate* login_display_delegate_ = nullptr; 150 LoginDisplay::Delegate* login_display_delegate_ = nullptr;
138 151
139 // Purpose of the screen (see constants in OobeUI). 152 // Purpose of the screen (see constants in OobeUI).
140 const std::string display_type_; 153 const std::string display_type_;
141 154
142 // Set of Users that are visible. 155 // Set of Users that are visible.
143 user_manager::UserList users_; 156 user_manager::UserList users_;
144 157
145 // Map of accounnt ids to their current authentication type. If a user is not 158 // Map of accounnt ids to their current authentication type. If a user is not
146 // contained in the map, it is using the default authentication type. 159 // contained in the map, it is using the default authentication type.
147 std::map<AccountId, proximity_auth::ScreenlockBridge::LockHandler::AuthType> 160 std::map<AccountId, proximity_auth::mojom::AuthType> user_auth_type_map_;
148 user_auth_type_map_;
149 161
150 // Timer for measuring idle state duration before password clear. 162 // Timer for measuring idle state duration before password clear.
151 base::OneShotTimer password_clear_timer_; 163 base::OneShotTimer password_clear_timer_;
152 164
153 // Token handler util for checking user OAuth token status. 165 // Token handler util for checking user OAuth token status.
154 std::unique_ptr<TokenHandleUtil> token_handle_util_; 166 std::unique_ptr<TokenHandleUtil> token_handle_util_;
155 167
156 // Helper to check whether a user needs dircrypto migration. 168 // Helper to check whether a user needs dircrypto migration.
157 std::unique_ptr<DircryptoMigrationChecker> dircrypto_migration_checker_; 169 std::unique_ptr<DircryptoMigrationChecker> dircrypto_migration_checker_;
158 170
159 user_manager::UserList users_to_send_; 171 user_manager::UserList users_to_send_;
160 172
161 base::WeakPtrFactory<UserSelectionScreen> weak_factory_; 173 base::WeakPtrFactory<UserSelectionScreen> weak_factory_;
162 174
163 DISALLOW_COPY_AND_ASSIGN(UserSelectionScreen); 175 DISALLOW_COPY_AND_ASSIGN(UserSelectionScreen);
164 }; 176 };
165 177
166 } // namespace chromeos 178 } // namespace chromeos
167 179
168 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_ 180 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698