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 #ifndef COMPONENTS_USER_MANAGER_USER_MANAGER_H_ | 5 #ifndef COMPONENTS_USER_MANAGER_USER_MANAGER_H_ |
6 #define COMPONENTS_USER_MANAGER_USER_MANAGER_H_ | 6 #define COMPONENTS_USER_MANAGER_USER_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "components/user_manager/user.h" | 10 #include "components/user_manager/user.h" |
11 #include "components/user_manager/user_id.h" | |
12 #include "components/user_manager/user_manager_export.h" | 11 #include "components/user_manager/user_manager_export.h" |
13 #include "components/user_manager/user_type.h" | 12 #include "components/user_manager/user_type.h" |
14 | 13 |
14 class AccountId; | |
15 | |
15 namespace base { | 16 namespace base { |
16 class DictionaryValue; | 17 class DictionaryValue; |
17 } | 18 } |
18 | 19 |
19 namespace chromeos { | 20 namespace chromeos { |
20 class ScopedUserManagerEnabler; | 21 class ScopedUserManagerEnabler; |
21 } | 22 } |
22 | 23 |
23 namespace user_manager { | 24 namespace user_manager { |
24 | 25 |
(...skipping 22 matching lines...) Expand all Loading... | |
47 // active user state changes. Default implementation is empty. | 48 // active user state changes. Default implementation is empty. |
48 class UserSessionStateObserver { | 49 class UserSessionStateObserver { |
49 public: | 50 public: |
50 // Called when active user has changed. | 51 // Called when active user has changed. |
51 virtual void ActiveUserChanged(const User* active_user); | 52 virtual void ActiveUserChanged(const User* active_user); |
52 | 53 |
53 // Called when another user got added to the existing session. | 54 // Called when another user got added to the existing session. |
54 virtual void UserAddedToSession(const User* added_user); | 55 virtual void UserAddedToSession(const User* added_user); |
55 | 56 |
56 // Called right before notifying on user change so that those who rely | 57 // Called right before notifying on user change so that those who rely |
57 // on user_id hash would be accessing up-to-date value. | 58 // on account_id hash would be accessing up-to-date value. |
58 virtual void ActiveUserHashChanged(const std::string& hash); | 59 virtual void ActiveUserHashChanged(const std::string& hash); |
59 | 60 |
60 // Called when child status has changed. | 61 // Called when child status has changed. |
61 virtual void UserChangedChildStatus(User* user); | 62 virtual void UserChangedChildStatus(User* user); |
62 | 63 |
63 protected: | 64 protected: |
64 virtual ~UserSessionStateObserver(); | 65 virtual ~UserSessionStateObserver(); |
65 }; | 66 }; |
66 | 67 |
67 // Data retrieved from user account. | 68 // Data retrieved from user account. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 virtual const UserList& GetLRULoggedInUsers() const = 0; | 132 virtual const UserList& GetLRULoggedInUsers() const = 0; |
132 | 133 |
133 // Returns a list of users who can unlock the device. | 134 // Returns a list of users who can unlock the device. |
134 // This list is based on policy and whether user is able to do unlock. | 135 // This list is based on policy and whether user is able to do unlock. |
135 // Policy: | 136 // Policy: |
136 // * If user has primary-only policy then it is the only user in unlock users. | 137 // * If user has primary-only policy then it is the only user in unlock users. |
137 // * Otherwise all users with unrestricted policy are added to this list. | 138 // * Otherwise all users with unrestricted policy are added to this list. |
138 // All users that are unable to perform unlock are excluded from this list. | 139 // All users that are unable to perform unlock are excluded from this list. |
139 virtual UserList GetUnlockUsers() const = 0; | 140 virtual UserList GetUnlockUsers() const = 0; |
140 | 141 |
141 // Returns the email of the owner user. Returns an empty string if there is | 142 // Returns account Id of the owner user. Returns an empty Id if there is |
142 // no owner for the device. | 143 // no owner for the device. |
143 virtual const std::string& GetOwnerEmail() const = 0; | 144 virtual const AccountId& GetOwnerAccountId() const = 0; |
144 | 145 |
145 // Indicates that a user with the given |user_id| has just logged in. The | 146 // Indicates that a user with the given |account_id| has just logged in. The |
146 // persistent list is updated accordingly if the user is not ephemeral. | 147 // persistent list is updated accordingly if the user is not ephemeral. |
147 // |browser_restart| is true when reloading Chrome after crash to distinguish | 148 // |browser_restart| is true when reloading Chrome after crash to distinguish |
148 // from normal sign in flow. | 149 // from normal sign in flow. |
149 // |username_hash| is used to identify homedir mount point. | 150 // |username_hash| is used to identify homedir mount point. |
150 virtual void UserLoggedIn(const std::string& user_id, | 151 virtual void UserLoggedIn(const AccountId& account_id, |
151 const std::string& username_hash, | 152 const std::string& username_hash, |
152 bool browser_restart) = 0; | 153 bool browser_restart) = 0; |
153 | 154 |
154 // Switches to active user identified by |user_id|. User has to be logged in. | 155 // Switches to active user identified by |account_id|. User has to be logged |
155 virtual void SwitchActiveUser(const std::string& user_id) = 0; | 156 // in. |
157 virtual void SwitchActiveUser(const AccountId& account_id) = 0; | |
156 | 158 |
157 // Switches to the last active user (called after crash happens and session | 159 // Switches to the last active user (called after crash happens and session |
158 // restore has completed). | 160 // restore has completed). |
159 virtual void SwitchToLastActiveUser() = 0; | 161 virtual void SwitchToLastActiveUser() = 0; |
160 | 162 |
161 // Called when browser session is started i.e. after | 163 // Called when browser session is started i.e. after |
162 // browser_creator.LaunchBrowser(...) was called after user sign in. | 164 // browser_creator.LaunchBrowser(...) was called after user sign in. |
163 // When user is at the image screen IsUserLoggedIn() will return true | 165 // When user is at the image screen IsUserLoggedIn() will return true |
164 // but IsSessionStarted() will return false. During the kiosk splash screen, | 166 // but IsSessionStarted() will return false. During the kiosk splash screen, |
165 // we perform additional initialization after the user is logged in but | 167 // we perform additional initialization after the user is logged in but |
166 // before the session has been started. | 168 // before the session has been started. |
167 // Fires NOTIFICATION_SESSION_STARTED. | 169 // Fires NOTIFICATION_SESSION_STARTED. |
168 virtual void SessionStarted() = 0; | 170 virtual void SessionStarted() = 0; |
169 | 171 |
170 // Removes the user from the device. Note, it will verify that the given user | 172 // Removes the user from the device. Note, it will verify that the given user |
171 // isn't the owner, so calling this method for the owner will take no effect. | 173 // isn't the owner, so calling this method for the owner will take no effect. |
172 // Note, |delegate| can be NULL. | 174 // Note, |delegate| can be NULL. |
173 virtual void RemoveUser(const std::string& user_id, | 175 virtual void RemoveUser(const AccountId& account_id, |
174 RemoveUserDelegate* delegate) = 0; | 176 RemoveUserDelegate* delegate) = 0; |
175 | 177 |
176 // Removes the user from the persistent list only. Also removes the user's | 178 // Removes the user from the persistent list only. Also removes the user's |
177 // picture. | 179 // picture. |
178 virtual void RemoveUserFromList(const std::string& user_id) = 0; | 180 virtual void RemoveUserFromList(const AccountId& account_id) = 0; |
179 | 181 |
180 // Returns true if a user with the given user id is found in the persistent | 182 // Returns true if a user with the given user id is found in the persistent |
achuithb
2015/10/28 23:11:47
s/user id/|account_id|/, here and all comments bel
Alexander Alekseev
2015/10/29 02:00:43
Done.
| |
181 // list or currently logged in as ephemeral. | 183 // list or currently logged in as ephemeral. |
182 virtual bool IsKnownUser(const std::string& user_id) const = 0; | 184 virtual bool IsKnownUser(const AccountId& account_id) const = 0; |
183 | 185 |
184 // Returns the user with the given user id if found in the persistent | 186 // Returns the user with the given user id if found in the persistent |
185 // list or currently logged in as ephemeral. Returns |NULL| otherwise. | 187 // list or currently logged in as ephemeral. Returns |NULL| otherwise. |
186 virtual const User* FindUser(const std::string& user_id) const = 0; | 188 virtual const User* FindUser(const AccountId& account_id) const = 0; |
187 | 189 |
188 // Returns the user with the given user id if found in the persistent | 190 // Returns the user with the given user id if found in the persistent |
189 // list or currently logged in as ephemeral. Returns |NULL| otherwise. | 191 // list or currently logged in as ephemeral. Returns |NULL| otherwise. |
190 // Same as FindUser but returns non-const pointer to User object. | 192 // Same as FindUser but returns non-const pointer to User object. |
191 virtual User* FindUserAndModify(const std::string& user_id) = 0; | 193 virtual User* FindUserAndModify(const AccountId& account_id) = 0; |
192 | 194 |
193 // Returns the logged-in user. | 195 // Returns the logged-in user. |
194 // TODO(nkostylev): Deprecate this call, move clients to GetActiveUser(). | 196 // TODO(nkostylev): Deprecate this call, move clients to GetActiveUser(). |
195 // http://crbug.com/230852 | 197 // http://crbug.com/230852 |
196 virtual const User* GetLoggedInUser() const = 0; | 198 virtual const User* GetLoggedInUser() const = 0; |
197 virtual User* GetLoggedInUser() = 0; | 199 virtual User* GetLoggedInUser() = 0; |
198 | 200 |
199 // Returns the logged-in user that is currently active within this session. | 201 // Returns the logged-in user that is currently active within this session. |
200 // There could be multiple users logged in at the the same but for now | 202 // There could be multiple users logged in at the the same but for now |
201 // we support only one of them being active. | 203 // we support only one of them being active. |
202 virtual const User* GetActiveUser() const = 0; | 204 virtual const User* GetActiveUser() const = 0; |
203 virtual User* GetActiveUser() = 0; | 205 virtual User* GetActiveUser() = 0; |
204 | 206 |
205 // Returns the primary user of the current session. It is recorded for the | 207 // Returns the primary user of the current session. It is recorded for the |
206 // first signed-in user and does not change thereafter. | 208 // first signed-in user and does not change thereafter. |
207 virtual const User* GetPrimaryUser() const = 0; | 209 virtual const User* GetPrimaryUser() const = 0; |
208 | 210 |
209 // Saves user's oauth token status in local state preferences. | 211 // Saves user's oauth token status in local state preferences. |
210 virtual void SaveUserOAuthStatus( | 212 virtual void SaveUserOAuthStatus( |
211 const std::string& user_id, | 213 const AccountId& account_id, |
212 User::OAuthTokenStatus oauth_token_status) = 0; | 214 User::OAuthTokenStatus oauth_token_status) = 0; |
213 | 215 |
214 // Saves a flag indicating whether online authentication against GAIA should | 216 // Saves a flag indicating whether online authentication against GAIA should |
215 // be enforced during the user's next sign-in. | 217 // be enforced during the user's next sign-in. |
216 virtual void SaveForceOnlineSignin(const std::string& user_id, | 218 virtual void SaveForceOnlineSignin(const AccountId& account_id, |
217 bool force_online_signin) = 0; | 219 bool force_online_signin) = 0; |
218 | 220 |
219 // Saves user's displayed name in local state preferences. | 221 // Saves user's displayed name in local state preferences. |
220 // Ignored If there is no such user. | 222 // Ignored If there is no such user. |
221 virtual void SaveUserDisplayName(const std::string& user_id, | 223 virtual void SaveUserDisplayName(const AccountId& account_id, |
222 const base::string16& display_name) = 0; | 224 const base::string16& display_name) = 0; |
223 | 225 |
224 // Updates data upon User Account download. | 226 // Updates data upon User Account download. |
225 virtual void UpdateUserAccountData(const std::string& user_id, | 227 virtual void UpdateUserAccountData(const AccountId& account_id, |
226 const UserAccountData& account_data) = 0; | 228 const UserAccountData& account_data) = 0; |
227 | 229 |
228 // Returns the display name for user |user_id| if it is known (was | 230 // Returns the display name for user |account_id| if it is known (was |
229 // previously set by a |SaveUserDisplayName| call). | 231 // previously set by a |SaveUserDisplayName| call). |
230 // Otherwise, returns an empty string. | 232 // Otherwise, returns an empty string. |
231 virtual base::string16 GetUserDisplayName( | 233 virtual base::string16 GetUserDisplayName( |
232 const std::string& user_id) const = 0; | 234 const AccountId& account_id) const = 0; |
233 | 235 |
234 // Saves user's displayed (non-canonical) email in local state preferences. | 236 // Saves user's displayed (non-canonical) email in local state preferences. |
235 // Ignored If there is no such user. | 237 // Ignored If there is no such user. |
236 virtual void SaveUserDisplayEmail(const std::string& user_id, | 238 virtual void SaveUserDisplayEmail(const AccountId& account_id, |
237 const std::string& display_email) = 0; | 239 const std::string& display_email) = 0; |
238 | 240 |
239 // Returns the display email for user |user_id| if it is known (was | 241 // Returns the display email for user |account_id| if it is known (was |
240 // previously set by a |SaveUserDisplayEmail| call). | 242 // previously set by a |SaveUserDisplayEmail| call). |
241 // Otherwise, returns |user_id| itself. | 243 // Otherwise, returns |account_id| itself. |
242 virtual std::string GetUserDisplayEmail(const std::string& user_id) const = 0; | 244 virtual std::string GetUserDisplayEmail( |
245 const AccountId& account_id) const = 0; | |
243 | 246 |
244 // Saves user's type for user |user_id| into local state preferences. | 247 // Saves user's type for user |account_id| into local state preferences. |
245 // Ignored If there is no such user. | 248 // Ignored If there is no such user. |
246 virtual void SaveUserType(const std::string& user_id, | 249 virtual void SaveUserType(const AccountId& account_id, |
247 const UserType& user_type) = 0; | 250 const UserType& user_type) = 0; |
248 | 251 |
249 // Returns true if current user is an owner. | 252 // Returns true if current user is an owner. |
250 virtual bool IsCurrentUserOwner() const = 0; | 253 virtual bool IsCurrentUserOwner() const = 0; |
251 | 254 |
252 // Returns true if current user is not existing one (hasn't signed in before). | 255 // Returns true if current user is not existing one (hasn't signed in before). |
253 virtual bool IsCurrentUserNew() const = 0; | 256 virtual bool IsCurrentUserNew() const = 0; |
254 | 257 |
255 // Returns true if data stored or cached for the current user outside that | 258 // Returns true if data stored or cached for the current user outside that |
256 // user's cryptohome (wallpaper, avatar, OAuth token status, display name, | 259 // user's cryptohome (wallpaper, avatar, OAuth token status, display name, |
(...skipping 26 matching lines...) Expand all Loading... | |
283 virtual bool IsLoggedInAsKioskApp() const = 0; | 286 virtual bool IsLoggedInAsKioskApp() const = 0; |
284 | 287 |
285 // Returns true if we're logged in as the stub user used for testing on Linux. | 288 // Returns true if we're logged in as the stub user used for testing on Linux. |
286 virtual bool IsLoggedInAsStub() const = 0; | 289 virtual bool IsLoggedInAsStub() const = 0; |
287 | 290 |
288 // Returns true if we're logged in and browser has been started i.e. | 291 // Returns true if we're logged in and browser has been started i.e. |
289 // browser_creator.LaunchBrowser(...) was called after sign in | 292 // browser_creator.LaunchBrowser(...) was called after sign in |
290 // or restart after crash. | 293 // or restart after crash. |
291 virtual bool IsSessionStarted() const = 0; | 294 virtual bool IsSessionStarted() const = 0; |
292 | 295 |
293 // Returns true if data stored or cached for the user with the given user id | 296 // Returns true if data stored or cached for the user with the given user id |
achuithb
2015/10/28 23:11:47
|account_id|
Alexander Alekseev
2015/10/29 02:00:43
Done.
| |
294 // address outside that user's cryptohome (wallpaper, avatar, OAuth token | 297 // address outside that user's cryptohome (wallpaper, avatar, OAuth token |
295 // status, display name, display email) is to be treated as ephemeral. | 298 // status, display name, display email) is to be treated as ephemeral. |
296 virtual bool IsUserNonCryptohomeDataEphemeral( | 299 virtual bool IsUserNonCryptohomeDataEphemeral( |
297 const std::string& user_id) const = 0; | 300 const AccountId& account_id) const = 0; |
298 | 301 |
299 virtual void AddObserver(Observer* obs) = 0; | 302 virtual void AddObserver(Observer* obs) = 0; |
300 virtual void RemoveObserver(Observer* obs) = 0; | 303 virtual void RemoveObserver(Observer* obs) = 0; |
301 | 304 |
302 virtual void AddSessionStateObserver(UserSessionStateObserver* obs) = 0; | 305 virtual void AddSessionStateObserver(UserSessionStateObserver* obs) = 0; |
303 virtual void RemoveSessionStateObserver(UserSessionStateObserver* obs) = 0; | 306 virtual void RemoveSessionStateObserver(UserSessionStateObserver* obs) = 0; |
304 | 307 |
305 virtual void NotifyLocalStateChanged() = 0; | 308 virtual void NotifyLocalStateChanged() = 0; |
306 | 309 |
307 // Changes the child status and notifies observers. | 310 // Changes the child status and notifies observers. |
308 virtual void ChangeUserChildStatus(User* user, bool is_child) = 0; | 311 virtual void ChangeUserChildStatus(User* user, bool is_child) = 0; |
309 | 312 |
310 | 313 |
311 // Returns true if supervised users allowed. | 314 // Returns true if supervised users allowed. |
312 virtual bool AreSupervisedUsersAllowed() const = 0; | 315 virtual bool AreSupervisedUsersAllowed() const = 0; |
313 | 316 |
314 // Methods for storage/retrieval of per-user properties in Local State. | 317 // Methods for storage/retrieval of per-user properties in Local State. |
315 | 318 |
316 // Performs a lookup of properties associated with |user_id|. If found, | 319 // Performs a lookup of properties associated with |account_id|. If found, |
317 // returns |true| and fills |out_value|. |out_value| can be NULL, if | 320 // returns |true| and fills |out_value|. |out_value| can be NULL, if |
318 // only existence check is required. | 321 // only existence check is required. |
319 virtual bool FindKnownUserPrefs(const UserID& user_id, | 322 virtual bool FindKnownUserPrefs(const AccountId& account_id, |
320 const base::DictionaryValue** out_value) = 0; | 323 const base::DictionaryValue** out_value) = 0; |
321 | 324 |
322 // Updates (or creates) properties associated with |user_id| based | 325 // Updates (or creates) properties associated with |account_id| based |
323 // on |values|. |clear| defines if existing properties are cleared (|true|) | 326 // on |values|. |clear| defines if existing properties are cleared (|true|) |
324 // or if it is just a incremental update (|false|). | 327 // or if it is just a incremental update (|false|). |
325 virtual void UpdateKnownUserPrefs(const UserID& user_id, | 328 virtual void UpdateKnownUserPrefs(const AccountId& account_id, |
326 const base::DictionaryValue& values, | 329 const base::DictionaryValue& values, |
327 bool clear) = 0; | 330 bool clear) = 0; |
328 | 331 |
329 // Returns true if |user_id| preference by |path| does exist, | 332 // Returns true if |account_id| preference by |path| does exist, |
330 // fills in |out_value|. Otherwise returns false. | 333 // fills in |out_value|. Otherwise returns false. |
331 virtual bool GetKnownUserStringPref(const UserID& user_id, | 334 virtual bool GetKnownUserStringPref(const AccountId& account_id, |
332 const std::string& path, | 335 const std::string& path, |
333 std::string* out_value) = 0; | 336 std::string* out_value) = 0; |
334 | 337 |
335 // Updates user's identified by |user_id| string preference |path|. | 338 // Updates user's identified by |account_id| string preference |path|. |
336 virtual void SetKnownUserStringPref(const UserID& user_id, | 339 virtual void SetKnownUserStringPref(const AccountId& account_id, |
337 const std::string& path, | 340 const std::string& path, |
338 const std::string& in_value) = 0; | 341 const std::string& in_value) = 0; |
339 | 342 |
340 // Returns true if |user_id| preference by |path| does exist, | 343 // Returns true if |account_id| preference by |path| does exist, |
341 // fills in |out_value|. Otherwise returns false. | 344 // fills in |out_value|. Otherwise returns false. |
342 virtual bool GetKnownUserBooleanPref(const UserID& user_id, | 345 virtual bool GetKnownUserBooleanPref(const AccountId& account_id, |
343 const std::string& path, | 346 const std::string& path, |
344 bool* out_value) = 0; | 347 bool* out_value) = 0; |
345 | 348 |
346 // Updates user's identified by |user_id| boolean preference |path|. | 349 // Updates user's identified by |account_id| boolean preference |path|. |
347 virtual void SetKnownUserBooleanPref(const UserID& user_id, | 350 virtual void SetKnownUserBooleanPref(const AccountId& account_id, |
348 const std::string& path, | 351 const std::string& path, |
349 const bool in_value) = 0; | 352 const bool in_value) = 0; |
350 | 353 |
351 // Returns true if |user_id| preference by |path| does exist, | 354 // Returns true if |account_id| preference by |path| does exist, |
352 // fills in |out_value|. Otherwise returns false. | 355 // fills in |out_value|. Otherwise returns false. |
353 virtual bool GetKnownUserIntegerPref(const UserID& user_id, | 356 virtual bool GetKnownUserIntegerPref(const AccountId& account_id, |
354 const std::string& path, | 357 const std::string& path, |
355 int* out_value) = 0; | 358 int* out_value) = 0; |
356 | 359 |
357 // Updates user's identified by |user_id| integer preference |path|. | 360 // Updates user's identified by |account_id| integer preference |path|. |
358 virtual void SetKnownUserIntegerPref(const UserID& user_id, | 361 virtual void SetKnownUserIntegerPref(const AccountId& account_id, |
359 const std::string& path, | 362 const std::string& path, |
360 const int in_value) = 0; | 363 const int in_value) = 0; |
361 | 364 |
362 // Returns true if user's canonical email was found. | 365 // Returns true if user's AccountId was found. |
363 // Returns it in |out_email|. | 366 // Returns it in |out_id|. |
achuithb
2015/10/28 23:11:47
out_account_id
Alexander Alekseev
2015/10/29 02:00:43
Done.
| |
364 virtual bool GetKnownUserCanonicalEmail(const UserID& user_id, | 367 virtual bool GetKnownUserAccountId(const AccountId& authenticated_account_id, |
365 std::string* out_email) = 0; | 368 AccountId* out_id) = 0; |
366 | 369 |
367 // Updates |gaia_id| for user with |user_id|. | 370 // Updates |gaia_id| for user with |account_id|. |
368 // TODO(antrim): Update this once UserID contains GAIA ID. | 371 // TODO(alemate): Update this once AccountId contains GAIA ID. |
achuithb
2015/10/28 23:11:47
reference bug?
Alexander Alekseev
2015/10/29 02:00:43
Done.
| |
369 virtual void UpdateGaiaID(const UserID& user_id, | 372 virtual void UpdateGaiaID(const AccountId& account_id, |
370 const std::string& gaia_id) = 0; | 373 const std::string& gaia_id) = 0; |
371 | 374 |
372 // Find GAIA ID for user with |user_id|, fill in |out_value| and return true | 375 // Find GAIA ID for user with |account_id|, fill in |out_value| and return |
376 // true | |
373 // if GAIA ID was found or false otherwise. | 377 // if GAIA ID was found or false otherwise. |
374 // TODO(antrim): Update this once UserID contains GAIA ID. | 378 // TODO(antrim): Update this once AccountId contains GAIA ID. |
375 virtual bool FindGaiaID(const UserID& user_id, std::string* out_value) = 0; | 379 virtual bool FindGaiaID(const AccountId& account_id, |
380 std::string* out_value) = 0; | |
376 | 381 |
377 // Saves whether the user authenticates using SAML. | 382 // Saves whether the user authenticates using SAML. |
378 virtual void UpdateUsingSAML(const UserID& user_id, | 383 virtual void UpdateUsingSAML(const AccountId& account_id, |
379 const bool using_saml) = 0; | 384 const bool using_saml) = 0; |
380 | 385 |
381 // Returns if SAML needs to be used for authentication of the user with | 386 // Returns if SAML needs to be used for authentication of the user with |
382 // |user_id|, if it is known (was set by a |UpdateUsingSaml| call). Otherwise | 387 // |account_id|, if it is known (was set by a |UpdateUsingSaml| call). |
388 // Otherwise | |
383 // returns false. | 389 // returns false. |
384 virtual bool FindUsingSAML(const UserID& user_id) = 0; | 390 virtual bool FindUsingSAML(const AccountId& account_id) = 0; |
385 | 391 |
386 // Setter and getter for DeviceId known user string preference. | 392 // Setter and getter for DeviceId known user string preference. |
387 virtual void SetKnownUserDeviceId(const UserID& user_id, | 393 virtual void SetKnownUserDeviceId(const AccountId& account_id, |
388 const std::string& device_id) = 0; | 394 const std::string& device_id) = 0; |
389 virtual std::string GetKnownUserDeviceId(const UserID& user_id) = 0; | 395 virtual std::string GetKnownUserDeviceId(const AccountId& account_id) = 0; |
390 | 396 |
391 // Setter and getter for GAPSCookie known user string preference. | 397 // Setter and getter for GAPSCookie known user string preference. |
392 virtual void SetKnownUserGAPSCookie(const UserID& user_id, | 398 virtual void SetKnownUserGAPSCookie(const AccountId& account_id, |
393 const std::string& gaps_cookie) = 0; | 399 const std::string& gaps_cookie) = 0; |
394 | 400 |
395 virtual std::string GetKnownUserGAPSCookie(const UserID& user_id) = 0; | 401 virtual std::string GetKnownUserGAPSCookie(const AccountId& account_id) = 0; |
396 | 402 |
397 // Saves why the user has to go through re-auth flow. | 403 // Saves why the user has to go through re-auth flow. |
398 virtual void UpdateReauthReason(const UserID& user_id, | 404 virtual void UpdateReauthReason(const AccountId& account_id, |
399 const int reauth_reason) = 0; | 405 const int reauth_reason) = 0; |
400 | 406 |
401 // Returns the reason why the user with |user_id| has to go through the | 407 // Returns the reason why the user with |account_id| has to go through the |
402 // re-auth flow. Returns true if such a reason was recorded or false | 408 // re-auth flow. Returns true if such a reason was recorded or false |
403 // otherwise. | 409 // otherwise. |
404 virtual bool FindReauthReason(const UserID& user_id, int* out_value) = 0; | 410 virtual bool FindReauthReason(const AccountId& account_id, |
411 int* out_value) = 0; | |
405 | 412 |
406 protected: | 413 protected: |
407 // Sets UserManager instance. | 414 // Sets UserManager instance. |
408 static void SetInstance(UserManager* user_manager); | 415 static void SetInstance(UserManager* user_manager); |
409 | 416 |
410 // Pointer to the existing UserManager instance (if any). | 417 // Pointer to the existing UserManager instance (if any). |
411 // Usually is set by calling Initialize(), reset by calling Destroy(). | 418 // Usually is set by calling Initialize(), reset by calling Destroy(). |
412 // Not owned since specific implementation of UserManager should decide on its | 419 // Not owned since specific implementation of UserManager should decide on its |
413 // own appropriate owner. For src/chrome implementation such place is | 420 // own appropriate owner. For src/chrome implementation such place is |
414 // g_browser_process->platform_part(). | 421 // g_browser_process->platform_part(). |
415 static UserManager* instance; | 422 static UserManager* instance; |
416 | 423 |
417 private: | 424 private: |
418 friend class chromeos::ScopedUserManagerEnabler; | 425 friend class chromeos::ScopedUserManagerEnabler; |
419 | 426 |
420 // Same as Get() but doesn't won't crash is current instance is NULL. | 427 // Same as Get() but doesn't won't crash is current instance is NULL. |
421 static UserManager* GetForTesting(); | 428 static UserManager* GetForTesting(); |
422 | 429 |
423 // Sets UserManager instance to the given |user_manager|. | 430 // Sets UserManager instance to the given |user_manager|. |
424 // Returns the previous value of the instance. | 431 // Returns the previous value of the instance. |
425 static UserManager* SetForTesting(UserManager* user_manager); | 432 static UserManager* SetForTesting(UserManager* user_manager); |
426 }; | 433 }; |
427 | 434 |
428 } // namespace user_manager | 435 } // namespace user_manager |
429 | 436 |
430 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_H_ | 437 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_H_ |
OLD | NEW |