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

Unified Diff: components/user_manager/user_manager.h

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/user_manager/user_manager.h
diff --git a/components/user_manager/user_manager.h b/components/user_manager/user_manager.h
index 5d9268ea1f1c6cf56c8e7218a600010cb75b98b9..ff3ba2dd074e7ccd2a179485b255921d08d82cc4 100644
--- a/components/user_manager/user_manager.h
+++ b/components/user_manager/user_manager.h
@@ -138,21 +138,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 the 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 UserID& 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 UserID& 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 UserID& user_id) = 0;
// Switches to the last active user (called after crash happens and session
// restore has completed).
@@ -170,25 +170,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 UserID& user_id,
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 UserID& 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 UserID& 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 UserID& 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 UserID& user_id) = 0;
// Returns the logged-in user.
// TODO(nkostylev): Deprecate this call, move clients to GetActiveUser().
@@ -208,42 +208,42 @@ class USER_MANAGER_EXPORT UserManager {
// Saves user's oauth token status in local state preferences.
virtual void SaveUserOAuthStatus(
- const std::string& user_id,
+ const UserID& 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 UserID& 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 UserID& 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 UserID& 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;
+ const UserID& 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 UserID& 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 UserID& 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 UserID& 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 UserID& user_id) const = 0;
virtual void AddObserver(Observer* obs) = 0;
virtual void RemoveObserver(Observer* obs) = 0;

Powered by Google App Engine
This is Rietveld 408576698