Chromium Code Reviews| Index: components/user_manager/user_manager.h |
| diff --git a/components/user_manager/user_manager.h b/components/user_manager/user_manager.h |
| index 24b8c9aa7c675ec2906b9efb4103f079d56f4a1c..55101155d03463cf52e7fa815cec2e7552d1d564 100644 |
| --- a/components/user_manager/user_manager.h |
| +++ b/components/user_manager/user_manager.h |
| @@ -8,10 +8,11 @@ |
| #include <string> |
| #include "components/user_manager/user.h" |
| -#include "components/user_manager/user_id.h" |
| #include "components/user_manager/user_manager_export.h" |
| #include "components/user_manager/user_type.h" |
| +class AccountId; |
| + |
| namespace base { |
| class DictionaryValue; |
| } |
| @@ -138,21 +139,21 @@ class USER_MANAGER_EXPORT UserManager { |
| // All users that are unable to perform unlock are excluded from this list. |
| virtual UserList GetUnlockUsers() const = 0; |
| - // Returns the email of the owner user. Returns an empty string if there is |
| + // Returns account Id of the owner user. Returns an empty Id if there is |
| // no owner for the device. |
| - virtual const std::string& GetOwnerEmail() const = 0; |
| + virtual const AccountId& GetOwnerId() const = 0; |
| // Indicates that a user with the given |user_id| has just logged in. The |
| // persistent list is updated accordingly if the user is not ephemeral. |
| // |browser_restart| is true when reloading Chrome after crash to distinguish |
| // from normal sign in flow. |
| // |username_hash| is used to identify homedir mount point. |
| - virtual void UserLoggedIn(const std::string& user_id, |
| + virtual void UserLoggedIn(const AccountId& user_id, |
| const std::string& username_hash, |
| bool browser_restart) = 0; |
| // Switches to active user identified by |user_id|. User has to be logged in. |
| - virtual void SwitchActiveUser(const std::string& user_id) = 0; |
| + virtual void SwitchActiveUser(const AccountId& user_id) = 0; |
| // Switches to the last active user (called after crash happens and session |
| // restore has completed). |
| @@ -170,25 +171,25 @@ class USER_MANAGER_EXPORT UserManager { |
| // Removes the user from the device. Note, it will verify that the given user |
| // isn't the owner, so calling this method for the owner will take no effect. |
| // Note, |delegate| can be NULL. |
| - virtual void RemoveUser(const std::string& user_id, |
| + 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.
|
| RemoveUserDelegate* delegate) = 0; |
| // Removes the user from the persistent list only. Also removes the user's |
| // picture. |
| - virtual void RemoveUserFromList(const std::string& user_id) = 0; |
| + virtual void RemoveUserFromList(const AccountId& user_id) = 0; |
| // Returns true if a user with the given user id is found in the persistent |
| // list or currently logged in as ephemeral. |
| - virtual bool IsKnownUser(const std::string& user_id) const = 0; |
| + virtual bool IsKnownUser(const AccountId& user_id) const = 0; |
| // Returns the user with the given user id if found in the persistent |
| // list or currently logged in as ephemeral. Returns |NULL| otherwise. |
| - virtual const User* FindUser(const std::string& user_id) const = 0; |
| + virtual const User* FindUser(const AccountId& user_id) const = 0; |
| // Returns the user with the given user id if found in the persistent |
| // list or currently logged in as ephemeral. Returns |NULL| otherwise. |
| // Same as FindUser but returns non-const pointer to User object. |
| - virtual User* FindUserAndModify(const std::string& user_id) = 0; |
| + virtual User* FindUserAndModify(const AccountId& user_id) = 0; |
| // Returns the logged-in user. |
| // TODO(nkostylev): Deprecate this call, move clients to GetActiveUser(). |
| @@ -208,42 +209,41 @@ class USER_MANAGER_EXPORT UserManager { |
| // Saves user's oauth token status in local state preferences. |
| virtual void SaveUserOAuthStatus( |
| - const std::string& user_id, |
| + const AccountId& user_id, |
| User::OAuthTokenStatus oauth_token_status) = 0; |
| // Saves a flag indicating whether online authentication against GAIA should |
| // be enforced during the user's next sign-in. |
| - virtual void SaveForceOnlineSignin(const std::string& user_id, |
| + virtual void SaveForceOnlineSignin(const AccountId& user_id, |
| bool force_online_signin) = 0; |
| // Saves user's displayed name in local state preferences. |
| // Ignored If there is no such user. |
| - virtual void SaveUserDisplayName(const std::string& user_id, |
| + virtual void SaveUserDisplayName(const AccountId& user_id, |
| const base::string16& display_name) = 0; |
| // Updates data upon User Account download. |
| - virtual void UpdateUserAccountData(const std::string& user_id, |
| + virtual void UpdateUserAccountData(const AccountId& user_id, |
| const UserAccountData& account_data) = 0; |
| // Returns the display name for user |user_id| if it is known (was |
| // previously set by a |SaveUserDisplayName| call). |
| // Otherwise, returns an empty string. |
| - virtual base::string16 GetUserDisplayName( |
| - const std::string& user_id) const = 0; |
| + virtual base::string16 GetUserDisplayName(const AccountId& user_id) const = 0; |
| // Saves user's displayed (non-canonical) email in local state preferences. |
| // Ignored If there is no such user. |
| - virtual void SaveUserDisplayEmail(const std::string& user_id, |
| + virtual void SaveUserDisplayEmail(const AccountId& user_id, |
| const std::string& display_email) = 0; |
| // Returns the display email for user |user_id| if it is known (was |
| // previously set by a |SaveUserDisplayEmail| call). |
| // Otherwise, returns |user_id| itself. |
| - virtual std::string GetUserDisplayEmail(const std::string& user_id) const = 0; |
| + virtual std::string GetUserDisplayEmail(const AccountId& user_id) const = 0; |
| // Saves user's type for user |user_id| into local state preferences. |
| // Ignored If there is no such user. |
| - virtual void SaveUserType(const std::string& user_id, |
| + virtual void SaveUserType(const AccountId& user_id, |
| const UserType& user_type) = 0; |
| // Returns true if current user is an owner. |
| @@ -294,7 +294,7 @@ class USER_MANAGER_EXPORT UserManager { |
| // address outside that user's cryptohome (wallpaper, avatar, OAuth token |
| // status, display name, display email) is to be treated as ephemeral. |
| virtual bool IsUserNonCryptohomeDataEphemeral( |
| - const std::string& user_id) const = 0; |
| + const AccountId& user_id) const = 0; |
| virtual void AddObserver(Observer* obs) = 0; |
| virtual void RemoveObserver(Observer* obs) = 0; |
| @@ -316,92 +316,92 @@ class USER_MANAGER_EXPORT UserManager { |
| // Performs a lookup of properties associated with |user_id|. If found, |
| // returns |true| and fills |out_value|. |out_value| can be NULL, if |
| // only existence check is required. |
| - virtual bool FindKnownUserPrefs(const UserID& user_id, |
| + virtual bool FindKnownUserPrefs(const AccountId& user_id, |
| const base::DictionaryValue** out_value) = 0; |
| // Updates (or creates) properties associated with |user_id| based |
| // on |values|. |clear| defines if existing properties are cleared (|true|) |
| // or if it is just a incremental update (|false|). |
| - virtual void UpdateKnownUserPrefs(const UserID& user_id, |
| + virtual void UpdateKnownUserPrefs(const AccountId& user_id, |
| const base::DictionaryValue& values, |
| bool clear) = 0; |
| // Returns true if |user_id| preference by |path| does exist, |
| // fills in |out_value|. Otherwise returns false. |
| - virtual bool GetKnownUserStringPref(const UserID& user_id, |
| + virtual bool GetKnownUserStringPref(const AccountId& user_id, |
| const std::string& path, |
| std::string* out_value) = 0; |
| // Updates user's identified by |user_id| string preference |path|. |
| - virtual void SetKnownUserStringPref(const UserID& user_id, |
| + virtual void SetKnownUserStringPref(const AccountId& user_id, |
| const std::string& path, |
| const std::string& in_value) = 0; |
| // Returns true if |user_id| preference by |path| does exist, |
| // fills in |out_value|. Otherwise returns false. |
| - virtual bool GetKnownUserBooleanPref(const UserID& user_id, |
| + virtual bool GetKnownUserBooleanPref(const AccountId& user_id, |
| const std::string& path, |
| bool* out_value) = 0; |
| // Updates user's identified by |user_id| boolean preference |path|. |
| - virtual void SetKnownUserBooleanPref(const UserID& user_id, |
| + virtual void SetKnownUserBooleanPref(const AccountId& user_id, |
| const std::string& path, |
| const bool in_value) = 0; |
| // Returns true if |user_id| preference by |path| does exist, |
| // fills in |out_value|. Otherwise returns false. |
| - virtual bool GetKnownUserIntegerPref(const UserID& user_id, |
| + virtual bool GetKnownUserIntegerPref(const AccountId& user_id, |
| const std::string& path, |
| int* out_value) = 0; |
| // Updates user's identified by |user_id| integer preference |path|. |
| - virtual void SetKnownUserIntegerPref(const UserID& user_id, |
| + virtual void SetKnownUserIntegerPref(const AccountId& user_id, |
| const std::string& path, |
| const int in_value) = 0; |
| - // Returns true if user's canonical email was found. |
| - // Returns it in |out_email|. |
| - virtual bool GetKnownUserCanonicalEmail(const UserID& user_id, |
| - std::string* out_email) = 0; |
| + // Returns true if user's AccountId was found. |
| + // Returns it in |out_id|. |
| + virtual bool GetKnownUserAccountId(const AccountId& authenticated_id, |
| + AccountId* out_id) = 0; |
| // Updates |gaia_id| for user with |user_id|. |
| - // TODO(antrim): Update this once UserID contains GAIA ID. |
| - virtual void UpdateGaiaID(const UserID& user_id, |
| + // 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.
|
| + 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.
|
| const std::string& gaia_id) = 0; |
| // Find GAIA ID for user with |user_id|, fill in |out_value| and return true |
| // if GAIA ID was found or false otherwise. |
| - // TODO(antrim): Update this once UserID contains GAIA ID. |
| - virtual bool FindGaiaID(const UserID& user_id, std::string* out_value) = 0; |
| + // TODO(antrim): Update this once AccountId contains GAIA ID. |
| + virtual bool FindGaiaID(const AccountId& user_id, std::string* out_value) = 0; |
| // Saves whether the user authenticates using SAML. |
| - virtual void UpdateUsingSAML(const UserID& user_id, |
| + virtual void UpdateUsingSAML(const AccountId& user_id, |
| const bool using_saml) = 0; |
| // Returns if SAML needs to be used for authentication of the user with |
| // |user_id|, if it is known (was set by a |UpdateUsingSaml| call). Otherwise |
| // returns false. |
| - virtual bool FindUsingSAML(const UserID& user_id) = 0; |
| + virtual bool FindUsingSAML(const AccountId& user_id) = 0; |
| // Setter and getter for DeviceId known user string preference. |
| - virtual void SetKnownUserDeviceId(const UserID& user_id, |
| + virtual void SetKnownUserDeviceId(const AccountId& user_id, |
| const std::string& device_id) = 0; |
| - virtual std::string GetKnownUserDeviceId(const UserID& user_id) = 0; |
| + virtual std::string GetKnownUserDeviceId(const AccountId& user_id) = 0; |
| // Setter and getter for GAPSCookie known user string preference. |
| - virtual void SetKnownUserGAPSCookie(const UserID& user_id, |
| + virtual void SetKnownUserGAPSCookie(const AccountId& user_id, |
| const std::string& gaps_cookie) = 0; |
| - virtual std::string GetKnownUserGAPSCookie(const UserID& user_id) = 0; |
| + virtual std::string GetKnownUserGAPSCookie(const AccountId& user_id) = 0; |
| // Saves why the user has to go through re-auth flow. |
| - virtual void UpdateReauthReason(const UserID& user_id, |
| + virtual void UpdateReauthReason(const AccountId& user_id, |
| const int reauth_reason) = 0; |
| // Returns the reason why the user with |user_id| has to go through the |
| // re-auth flow. Returns true if such a reason was recorded or false |
| // otherwise. |
| - virtual bool FindReauthReason(const UserID& user_id, int* out_value) = 0; |
| + virtual bool FindReauthReason(const AccountId& user_id, int* out_value) = 0; |
| protected: |
| // Sets UserManager instance. |