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