Chromium Code Reviews| 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 106 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& GetOwnerId() 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 |user_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& user_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 |user_id|. User has to be logged in. |
| 155 virtual void SwitchActiveUser(const std::string& user_id) = 0; | 156 virtual void SwitchActiveUser(const AccountId& user_id) = 0; |
| 156 | 157 |
| 157 // Switches to the last active user (called after crash happens and session | 158 // Switches to the last active user (called after crash happens and session |
| 158 // restore has completed). | 159 // restore has completed). |
| 159 virtual void SwitchToLastActiveUser() = 0; | 160 virtual void SwitchToLastActiveUser() = 0; |
| 160 | 161 |
| 161 // Called when browser session is started i.e. after | 162 // Called when browser session is started i.e. after |
| 162 // browser_creator.LaunchBrowser(...) was called after user sign in. | 163 // browser_creator.LaunchBrowser(...) was called after user sign in. |
| 163 // When user is at the image screen IsUserLoggedIn() will return true | 164 // When user is at the image screen IsUserLoggedIn() will return true |
| 164 // but IsSessionStarted() will return false. During the kiosk splash screen, | 165 // but IsSessionStarted() will return false. During the kiosk splash screen, |
| 165 // we perform additional initialization after the user is logged in but | 166 // we perform additional initialization after the user is logged in but |
| 166 // before the session has been started. | 167 // before the session has been started. |
| 167 // Fires NOTIFICATION_SESSION_STARTED. | 168 // Fires NOTIFICATION_SESSION_STARTED. |
| 168 virtual void SessionStarted() = 0; | 169 virtual void SessionStarted() = 0; |
| 169 | 170 |
| 170 // Removes the user from the device. Note, it will verify that the given user | 171 // 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. | 172 // isn't the owner, so calling this method for the owner will take no effect. |
| 172 // Note, |delegate| can be NULL. | 173 // Note, |delegate| can be NULL. |
| 173 virtual void RemoveUser(const std::string& user_id, | 174 virtual void RemoveUser(const AccountId& user_id, |
|
achuithb
2015/10/23 00:08:52
account_id, here and below
Alexander Alekseev
2015/10/23 09:11:24
Done.
| |
| 174 RemoveUserDelegate* delegate) = 0; | 175 RemoveUserDelegate* delegate) = 0; |
| 175 | 176 |
| 176 // Removes the user from the persistent list only. Also removes the user's | 177 // Removes the user from the persistent list only. Also removes the user's |
| 177 // picture. | 178 // picture. |
| 178 virtual void RemoveUserFromList(const std::string& user_id) = 0; | 179 virtual void RemoveUserFromList(const AccountId& user_id) = 0; |
| 179 | 180 |
| 180 // Returns true if a user with the given user id is found in the persistent | 181 // Returns true if a user with the given user id is found in the persistent |
| 181 // list or currently logged in as ephemeral. | 182 // list or currently logged in as ephemeral. |
| 182 virtual bool IsKnownUser(const std::string& user_id) const = 0; | 183 virtual bool IsKnownUser(const AccountId& user_id) const = 0; |
| 183 | 184 |
| 184 // Returns the user with the given user id if found in the persistent | 185 // Returns the user with the given user id if found in the persistent |
| 185 // list or currently logged in as ephemeral. Returns |NULL| otherwise. | 186 // list or currently logged in as ephemeral. Returns |NULL| otherwise. |
| 186 virtual const User* FindUser(const std::string& user_id) const = 0; | 187 virtual const User* FindUser(const AccountId& user_id) const = 0; |
| 187 | 188 |
| 188 // Returns the user with the given user id if found in the persistent | 189 // Returns the user with the given user id if found in the persistent |
| 189 // list or currently logged in as ephemeral. Returns |NULL| otherwise. | 190 // list or currently logged in as ephemeral. Returns |NULL| otherwise. |
| 190 // Same as FindUser but returns non-const pointer to User object. | 191 // Same as FindUser but returns non-const pointer to User object. |
| 191 virtual User* FindUserAndModify(const std::string& user_id) = 0; | 192 virtual User* FindUserAndModify(const AccountId& user_id) = 0; |
| 192 | 193 |
| 193 // Returns the logged-in user. | 194 // Returns the logged-in user. |
| 194 // TODO(nkostylev): Deprecate this call, move clients to GetActiveUser(). | 195 // TODO(nkostylev): Deprecate this call, move clients to GetActiveUser(). |
| 195 // http://crbug.com/230852 | 196 // http://crbug.com/230852 |
| 196 virtual const User* GetLoggedInUser() const = 0; | 197 virtual const User* GetLoggedInUser() const = 0; |
| 197 virtual User* GetLoggedInUser() = 0; | 198 virtual User* GetLoggedInUser() = 0; |
| 198 | 199 |
| 199 // Returns the logged-in user that is currently active within this session. | 200 // 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 | 201 // There could be multiple users logged in at the the same but for now |
| 201 // we support only one of them being active. | 202 // we support only one of them being active. |
| 202 virtual const User* GetActiveUser() const = 0; | 203 virtual const User* GetActiveUser() const = 0; |
| 203 virtual User* GetActiveUser() = 0; | 204 virtual User* GetActiveUser() = 0; |
| 204 | 205 |
| 205 // Returns the primary user of the current session. It is recorded for the | 206 // Returns the primary user of the current session. It is recorded for the |
| 206 // first signed-in user and does not change thereafter. | 207 // first signed-in user and does not change thereafter. |
| 207 virtual const User* GetPrimaryUser() const = 0; | 208 virtual const User* GetPrimaryUser() const = 0; |
| 208 | 209 |
| 209 // Saves user's oauth token status in local state preferences. | 210 // Saves user's oauth token status in local state preferences. |
| 210 virtual void SaveUserOAuthStatus( | 211 virtual void SaveUserOAuthStatus( |
| 211 const std::string& user_id, | 212 const AccountId& user_id, |
| 212 User::OAuthTokenStatus oauth_token_status) = 0; | 213 User::OAuthTokenStatus oauth_token_status) = 0; |
| 213 | 214 |
| 214 // Saves a flag indicating whether online authentication against GAIA should | 215 // Saves a flag indicating whether online authentication against GAIA should |
| 215 // be enforced during the user's next sign-in. | 216 // be enforced during the user's next sign-in. |
| 216 virtual void SaveForceOnlineSignin(const std::string& user_id, | 217 virtual void SaveForceOnlineSignin(const AccountId& user_id, |
| 217 bool force_online_signin) = 0; | 218 bool force_online_signin) = 0; |
| 218 | 219 |
| 219 // Saves user's displayed name in local state preferences. | 220 // Saves user's displayed name in local state preferences. |
| 220 // Ignored If there is no such user. | 221 // Ignored If there is no such user. |
| 221 virtual void SaveUserDisplayName(const std::string& user_id, | 222 virtual void SaveUserDisplayName(const AccountId& user_id, |
| 222 const base::string16& display_name) = 0; | 223 const base::string16& display_name) = 0; |
| 223 | 224 |
| 224 // Updates data upon User Account download. | 225 // Updates data upon User Account download. |
| 225 virtual void UpdateUserAccountData(const std::string& user_id, | 226 virtual void UpdateUserAccountData(const AccountId& user_id, |
| 226 const UserAccountData& account_data) = 0; | 227 const UserAccountData& account_data) = 0; |
| 227 | 228 |
| 228 // Returns the display name for user |user_id| if it is known (was | 229 // Returns the display name for user |user_id| if it is known (was |
| 229 // previously set by a |SaveUserDisplayName| call). | 230 // previously set by a |SaveUserDisplayName| call). |
| 230 // Otherwise, returns an empty string. | 231 // Otherwise, returns an empty string. |
| 231 virtual base::string16 GetUserDisplayName( | 232 virtual base::string16 GetUserDisplayName(const AccountId& user_id) const = 0; |
| 232 const std::string& user_id) const = 0; | |
| 233 | 233 |
| 234 // Saves user's displayed (non-canonical) email in local state preferences. | 234 // Saves user's displayed (non-canonical) email in local state preferences. |
| 235 // Ignored If there is no such user. | 235 // Ignored If there is no such user. |
| 236 virtual void SaveUserDisplayEmail(const std::string& user_id, | 236 virtual void SaveUserDisplayEmail(const AccountId& user_id, |
| 237 const std::string& display_email) = 0; | 237 const std::string& display_email) = 0; |
| 238 | 238 |
| 239 // Returns the display email for user |user_id| if it is known (was | 239 // Returns the display email for user |user_id| if it is known (was |
| 240 // previously set by a |SaveUserDisplayEmail| call). | 240 // previously set by a |SaveUserDisplayEmail| call). |
| 241 // Otherwise, returns |user_id| itself. | 241 // Otherwise, returns |user_id| itself. |
| 242 virtual std::string GetUserDisplayEmail(const std::string& user_id) const = 0; | 242 virtual std::string GetUserDisplayEmail(const AccountId& user_id) const = 0; |
| 243 | 243 |
| 244 // Saves user's type for user |user_id| into local state preferences. | 244 // Saves user's type for user |user_id| into local state preferences. |
| 245 // Ignored If there is no such user. | 245 // Ignored If there is no such user. |
| 246 virtual void SaveUserType(const std::string& user_id, | 246 virtual void SaveUserType(const AccountId& user_id, |
| 247 const UserType& user_type) = 0; | 247 const UserType& user_type) = 0; |
| 248 | 248 |
| 249 // Returns true if current user is an owner. | 249 // Returns true if current user is an owner. |
| 250 virtual bool IsCurrentUserOwner() const = 0; | 250 virtual bool IsCurrentUserOwner() const = 0; |
| 251 | 251 |
| 252 // 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). |
| 253 virtual bool IsCurrentUserNew() const = 0; | 253 virtual bool IsCurrentUserNew() const = 0; |
| 254 | 254 |
| 255 // 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 |
| 256 // user's cryptohome (wallpaper, avatar, OAuth token status, display name, | 256 // user's cryptohome (wallpaper, avatar, OAuth token status, display name, |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 287 | 287 |
| 288 // 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. |
| 289 // browser_creator.LaunchBrowser(...) was called after sign in | 289 // browser_creator.LaunchBrowser(...) was called after sign in |
| 290 // or restart after crash. | 290 // or restart after crash. |
| 291 virtual bool IsSessionStarted() const = 0; | 291 virtual bool IsSessionStarted() const = 0; |
| 292 | 292 |
| 293 // Returns true if data stored or cached for the user with the given user id | 293 // Returns true if data stored or cached for the user with the given user id |
| 294 // address outside that user's cryptohome (wallpaper, avatar, OAuth token | 294 // address outside that user's cryptohome (wallpaper, avatar, OAuth token |
| 295 // status, display name, display email) is to be treated as ephemeral. | 295 // status, display name, display email) is to be treated as ephemeral. |
| 296 virtual bool IsUserNonCryptohomeDataEphemeral( | 296 virtual bool IsUserNonCryptohomeDataEphemeral( |
| 297 const std::string& user_id) const = 0; | 297 const AccountId& user_id) const = 0; |
| 298 | 298 |
| 299 virtual void AddObserver(Observer* obs) = 0; | 299 virtual void AddObserver(Observer* obs) = 0; |
| 300 virtual void RemoveObserver(Observer* obs) = 0; | 300 virtual void RemoveObserver(Observer* obs) = 0; |
| 301 | 301 |
| 302 virtual void AddSessionStateObserver(UserSessionStateObserver* obs) = 0; | 302 virtual void AddSessionStateObserver(UserSessionStateObserver* obs) = 0; |
| 303 virtual void RemoveSessionStateObserver(UserSessionStateObserver* obs) = 0; | 303 virtual void RemoveSessionStateObserver(UserSessionStateObserver* obs) = 0; |
| 304 | 304 |
| 305 virtual void NotifyLocalStateChanged() = 0; | 305 virtual void NotifyLocalStateChanged() = 0; |
| 306 | 306 |
| 307 // Changes the child status and notifies observers. | 307 // Changes the child status and notifies observers. |
| 308 virtual void ChangeUserChildStatus(User* user, bool is_child) = 0; | 308 virtual void ChangeUserChildStatus(User* user, bool is_child) = 0; |
| 309 | 309 |
| 310 | 310 |
| 311 // Returns true if supervised users allowed. | 311 // Returns true if supervised users allowed. |
| 312 virtual bool AreSupervisedUsersAllowed() const = 0; | 312 virtual bool AreSupervisedUsersAllowed() const = 0; |
| 313 | 313 |
| 314 // Methods for storage/retrieval of per-user properties in Local State. | 314 // Methods for storage/retrieval of per-user properties in Local State. |
| 315 | 315 |
| 316 // Performs a lookup of properties associated with |user_id|. If found, | 316 // Performs a lookup of properties associated with |user_id|. If found, |
| 317 // 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 |
| 318 // only existence check is required. | 318 // only existence check is required. |
| 319 virtual bool FindKnownUserPrefs(const UserID& user_id, | 319 virtual bool FindKnownUserPrefs(const AccountId& user_id, |
| 320 const base::DictionaryValue** out_value) = 0; | 320 const base::DictionaryValue** out_value) = 0; |
| 321 | 321 |
| 322 // Updates (or creates) properties associated with |user_id| based | 322 // Updates (or creates) properties associated with |user_id| based |
| 323 // on |values|. |clear| defines if existing properties are cleared (|true|) | 323 // on |values|. |clear| defines if existing properties are cleared (|true|) |
| 324 // or if it is just a incremental update (|false|). | 324 // or if it is just a incremental update (|false|). |
| 325 virtual void UpdateKnownUserPrefs(const UserID& user_id, | 325 virtual void UpdateKnownUserPrefs(const AccountId& user_id, |
| 326 const base::DictionaryValue& values, | 326 const base::DictionaryValue& values, |
| 327 bool clear) = 0; | 327 bool clear) = 0; |
| 328 | 328 |
| 329 // Returns true if |user_id| preference by |path| does exist, | 329 // Returns true if |user_id| preference by |path| does exist, |
| 330 // fills in |out_value|. Otherwise returns false. | 330 // fills in |out_value|. Otherwise returns false. |
| 331 virtual bool GetKnownUserStringPref(const UserID& user_id, | 331 virtual bool GetKnownUserStringPref(const AccountId& user_id, |
| 332 const std::string& path, | 332 const std::string& path, |
| 333 std::string* out_value) = 0; | 333 std::string* out_value) = 0; |
| 334 | 334 |
| 335 // Updates user's identified by |user_id| string preference |path|. | 335 // Updates user's identified by |user_id| string preference |path|. |
| 336 virtual void SetKnownUserStringPref(const UserID& user_id, | 336 virtual void SetKnownUserStringPref(const AccountId& user_id, |
| 337 const std::string& path, | 337 const std::string& path, |
| 338 const std::string& in_value) = 0; | 338 const std::string& in_value) = 0; |
| 339 | 339 |
| 340 // Returns true if |user_id| preference by |path| does exist, | 340 // Returns true if |user_id| preference by |path| does exist, |
| 341 // fills in |out_value|. Otherwise returns false. | 341 // fills in |out_value|. Otherwise returns false. |
| 342 virtual bool GetKnownUserBooleanPref(const UserID& user_id, | 342 virtual bool GetKnownUserBooleanPref(const AccountId& user_id, |
| 343 const std::string& path, | 343 const std::string& path, |
| 344 bool* out_value) = 0; | 344 bool* out_value) = 0; |
| 345 | 345 |
| 346 // Updates user's identified by |user_id| boolean preference |path|. | 346 // Updates user's identified by |user_id| boolean preference |path|. |
| 347 virtual void SetKnownUserBooleanPref(const UserID& user_id, | 347 virtual void SetKnownUserBooleanPref(const AccountId& user_id, |
| 348 const std::string& path, | 348 const std::string& path, |
| 349 const bool in_value) = 0; | 349 const bool in_value) = 0; |
| 350 | 350 |
| 351 // Returns true if |user_id| preference by |path| does exist, | 351 // Returns true if |user_id| preference by |path| does exist, |
| 352 // fills in |out_value|. Otherwise returns false. | 352 // fills in |out_value|. Otherwise returns false. |
| 353 virtual bool GetKnownUserIntegerPref(const UserID& user_id, | 353 virtual bool GetKnownUserIntegerPref(const AccountId& user_id, |
| 354 const std::string& path, | 354 const std::string& path, |
| 355 int* out_value) = 0; | 355 int* out_value) = 0; |
| 356 | 356 |
| 357 // Updates user's identified by |user_id| integer preference |path|. | 357 // Updates user's identified by |user_id| integer preference |path|. |
| 358 virtual void SetKnownUserIntegerPref(const UserID& user_id, | 358 virtual void SetKnownUserIntegerPref(const AccountId& user_id, |
| 359 const std::string& path, | 359 const std::string& path, |
| 360 const int in_value) = 0; | 360 const int in_value) = 0; |
| 361 | 361 |
| 362 // Returns true if user's canonical email was found. | 362 // Returns true if user's AccountId was found. |
| 363 // Returns it in |out_email|. | 363 // Returns it in |out_id|. |
| 364 virtual bool GetKnownUserCanonicalEmail(const UserID& user_id, | 364 virtual bool GetKnownUserAccountId(const AccountId& authenticated_id, |
| 365 std::string* out_email) = 0; | 365 AccountId* out_id) = 0; |
| 366 | 366 |
| 367 // Updates |gaia_id| for user with |user_id|. | 367 // Updates |gaia_id| for user with |user_id|. |
| 368 // TODO(antrim): Update this once UserID contains GAIA ID. | 368 // TODO(antrim): Update this once AccountId contains GAIA ID. |
|
achuithb
2015/10/23 00:08:52
TODO(alemate)?
Alexander Alekseev
2015/10/23 09:11:24
Done.
| |
| 369 virtual void UpdateGaiaID(const UserID& user_id, | 369 virtual void UpdateGaiaID(const AccountId& user_id, |
|
achuithb
2015/10/23 00:08:52
account_id
Alexander Alekseev
2015/10/23 09:11:24
Done.
| |
| 370 const std::string& gaia_id) = 0; | 370 const std::string& gaia_id) = 0; |
| 371 | 371 |
| 372 // Find GAIA ID for user with |user_id|, fill in |out_value| and return true | 372 // Find GAIA ID for user with |user_id|, fill in |out_value| and return true |
| 373 // if GAIA ID was found or false otherwise. | 373 // if GAIA ID was found or false otherwise. |
| 374 // TODO(antrim): Update this once UserID contains GAIA ID. | 374 // TODO(antrim): Update this once AccountId contains GAIA ID. |
| 375 virtual bool FindGaiaID(const UserID& user_id, std::string* out_value) = 0; | 375 virtual bool FindGaiaID(const AccountId& user_id, std::string* out_value) = 0; |
| 376 | 376 |
| 377 // Saves whether the user authenticates using SAML. | 377 // Saves whether the user authenticates using SAML. |
| 378 virtual void UpdateUsingSAML(const UserID& user_id, | 378 virtual void UpdateUsingSAML(const AccountId& user_id, |
| 379 const bool using_saml) = 0; | 379 const bool using_saml) = 0; |
| 380 | 380 |
| 381 // 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 |
| 382 // |user_id|, if it is known (was set by a |UpdateUsingSaml| call). Otherwise | 382 // |user_id|, if it is known (was set by a |UpdateUsingSaml| call). Otherwise |
| 383 // returns false. | 383 // returns false. |
| 384 virtual bool FindUsingSAML(const UserID& user_id) = 0; | 384 virtual bool FindUsingSAML(const AccountId& user_id) = 0; |
| 385 | 385 |
| 386 // Setter and getter for DeviceId known user string preference. | 386 // Setter and getter for DeviceId known user string preference. |
| 387 virtual void SetKnownUserDeviceId(const UserID& user_id, | 387 virtual void SetKnownUserDeviceId(const AccountId& user_id, |
| 388 const std::string& device_id) = 0; | 388 const std::string& device_id) = 0; |
| 389 virtual std::string GetKnownUserDeviceId(const UserID& user_id) = 0; | 389 virtual std::string GetKnownUserDeviceId(const AccountId& user_id) = 0; |
| 390 | 390 |
| 391 // Setter and getter for GAPSCookie known user string preference. | 391 // Setter and getter for GAPSCookie known user string preference. |
| 392 virtual void SetKnownUserGAPSCookie(const UserID& user_id, | 392 virtual void SetKnownUserGAPSCookie(const AccountId& user_id, |
| 393 const std::string& gaps_cookie) = 0; | 393 const std::string& gaps_cookie) = 0; |
| 394 | 394 |
| 395 virtual std::string GetKnownUserGAPSCookie(const UserID& user_id) = 0; | 395 virtual std::string GetKnownUserGAPSCookie(const AccountId& user_id) = 0; |
| 396 | 396 |
| 397 // Saves why the user has to go through re-auth flow. | 397 // Saves why the user has to go through re-auth flow. |
| 398 virtual void UpdateReauthReason(const UserID& user_id, | 398 virtual void UpdateReauthReason(const AccountId& user_id, |
| 399 const int reauth_reason) = 0; | 399 const int reauth_reason) = 0; |
| 400 | 400 |
| 401 // Returns the reason why the user with |user_id| has to go through the | 401 // Returns the reason why the user with |user_id| has to go through the |
| 402 // 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 |
| 403 // otherwise. | 403 // otherwise. |
| 404 virtual bool FindReauthReason(const UserID& user_id, int* out_value) = 0; | 404 virtual bool FindReauthReason(const AccountId& user_id, int* out_value) = 0; |
| 405 | 405 |
| 406 protected: | 406 protected: |
| 407 // Sets UserManager instance. | 407 // Sets UserManager instance. |
| 408 static void SetInstance(UserManager* user_manager); | 408 static void SetInstance(UserManager* user_manager); |
| 409 | 409 |
| 410 // Pointer to the existing UserManager instance (if any). | 410 // Pointer to the existing UserManager instance (if any). |
| 411 // Usually is set by calling Initialize(), reset by calling Destroy(). | 411 // Usually is set by calling Initialize(), reset by calling Destroy(). |
| 412 // Not owned since specific implementation of UserManager should decide on its | 412 // Not owned since specific implementation of UserManager should decide on its |
| 413 // own appropriate owner. For src/chrome implementation such place is | 413 // own appropriate owner. For src/chrome implementation such place is |
| 414 // g_browser_process->platform_part(). | 414 // g_browser_process->platform_part(). |
| 415 static UserManager* instance; | 415 static UserManager* instance; |
| 416 | 416 |
| 417 private: | 417 private: |
| 418 friend class chromeos::ScopedUserManagerEnabler; | 418 friend class chromeos::ScopedUserManagerEnabler; |
| 419 | 419 |
| 420 // 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. |
| 421 static UserManager* GetForTesting(); | 421 static UserManager* GetForTesting(); |
| 422 | 422 |
| 423 // Sets UserManager instance to the given |user_manager|. | 423 // Sets UserManager instance to the given |user_manager|. |
| 424 // Returns the previous value of the instance. | 424 // Returns the previous value of the instance. |
| 425 static UserManager* SetForTesting(UserManager* user_manager); | 425 static UserManager* SetForTesting(UserManager* user_manager); |
| 426 }; | 426 }; |
| 427 | 427 |
| 428 } // namespace user_manager | 428 } // namespace user_manager |
| 429 | 429 |
| 430 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_H_ | 430 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_H_ |
| OLD | NEW |