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_H_ | 5 #ifndef COMPONENTS_USER_MANAGER_USER_H_ |
| 6 #define COMPONENTS_USER_MANAGER_USER_H_ | 6 #define COMPONENTS_USER_MANAGER_USER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 DEFAULT = 2, // Default. | 75 DEFAULT = 2, // Default. |
| 76 /* UNKNOWN = 3 */ // Removed. | 76 /* UNKNOWN = 3 */ // Removed. |
| 77 ONLINE = 4, // WallpaperInfo.location denotes an URL. | 77 ONLINE = 4, // WallpaperInfo.location denotes an URL. |
| 78 POLICY = 5, // Controlled by policy, can't be changed by the user. | 78 POLICY = 5, // Controlled by policy, can't be changed by the user. |
| 79 WALLPAPER_TYPE_COUNT = 6 | 79 WALLPAPER_TYPE_COUNT = 6 |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 // Returns true if user type has gaia account. | 82 // Returns true if user type has gaia account. |
| 83 static bool TypeHasGaiaAccount(UserType user_type); | 83 static bool TypeHasGaiaAccount(UserType user_type); |
| 84 | 84 |
| 85 explicit User(const AccountId& account_id); | |
| 86 ~User() override; | |
| 87 | |
| 85 // UserInfo | 88 // UserInfo |
| 86 std::string GetEmail() const override; | 89 std::string GetEmail() const override; |
| 87 base::string16 GetDisplayName() const override; | 90 base::string16 GetDisplayName() const override; |
| 88 base::string16 GetGivenName() const override; | 91 base::string16 GetGivenName() const override; |
| 89 const gfx::ImageSkia& GetImage() const override; | 92 const gfx::ImageSkia& GetImage() const override; |
| 90 const AccountId& GetAccountId() const override; | 93 const AccountId& GetAccountId() const override; |
| 91 | 94 |
| 92 // Returns the user type. | 95 // Returns the user type. |
| 93 virtual UserType GetType() const = 0; | 96 virtual UserType GetType() const = 0; |
| 94 | 97 |
| 95 // Allows managing child status of the user. Used for RegularUser. | 98 // Allows managing child status of the user. Used for RegularUser. |
| 96 virtual void SetIsChild(bool is_child); | 99 virtual void SetIsChild(bool is_child); |
| 97 | 100 |
| 98 // Returns true if user has gaia account. True for users of types | 101 // Returns true if user has gaia account. True for users of types |
| 99 // USER_TYPE_REGULAR and USER_TYPE_CHILD. | 102 // USER_TYPE_REGULAR and USER_TYPE_CHILD. |
| 100 virtual bool HasGaiaAccount() const; | 103 virtual bool HasGaiaAccount() const; |
| 101 | 104 |
| 102 // Returns true if user is supervised. | 105 // Returns true if user is supervised. |
| 103 virtual bool IsSupervised() const; | 106 virtual bool IsSupervised() const; |
| 104 | 107 |
| 105 // True if user image can be synced. | 108 // True if user image can be synced. |
| 106 virtual bool CanSyncImage() const; | 109 virtual bool CanSyncImage() const; |
| 107 | 110 |
| 108 // The displayed (non-canonical) user email. | 111 // The displayed (non-canonical) user email. |
| 109 virtual std::string display_email() const; | 112 virtual std::string display_email() const; |
| 110 | 113 |
| 111 // True if the user is affiliated to the device. | 114 // True if the user is affiliated to the device. |
| 112 virtual bool IsAffiliated() const; | 115 virtual bool IsAffiliated() const; |
| 113 | 116 |
| 117 // True if the user is a device local account user. | |
| 118 virtual bool IsDeviceLocalAccountUser() const; | |
|
bartfab (slow)
2016/04/18 13:09:25
Nit: The "User" is redundant.
xiyuan
2016/04/18 16:53:27
Done.
| |
| 119 | |
| 114 // The email the user used to log in. | 120 // The email the user used to log in. |
| 115 // TODO(alemate): rename this to GetUserEmail() (see crbug.com/548923) | 121 // TODO(alemate): rename this to GetUserEmail() (see crbug.com/548923) |
| 116 const std::string& email() const; | 122 const std::string& email() const; |
| 117 | 123 |
| 118 // The displayed user name. | 124 // The displayed user name. |
| 119 base::string16 display_name() const { return display_name_; } | 125 base::string16 display_name() const { return display_name_; } |
| 120 | 126 |
| 121 // If the user has to use SAML to log in. | 127 // If the user has to use SAML to log in. |
| 122 bool using_saml() const { return using_saml_; } | 128 bool using_saml() const { return using_saml_; } |
| 123 | 129 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 friend class chromeos::UserAddingScreenTest; | 192 friend class chromeos::UserAddingScreenTest; |
| 187 FRIEND_TEST_ALL_PREFIXES(UserTest, DeviceLocalAccountAffiliation); | 193 FRIEND_TEST_ALL_PREFIXES(UserTest, DeviceLocalAccountAffiliation); |
| 188 | 194 |
| 189 // Do not allow anyone else to create new User instances. | 195 // Do not allow anyone else to create new User instances. |
| 190 static User* CreateRegularUser(const AccountId& account_id); | 196 static User* CreateRegularUser(const AccountId& account_id); |
| 191 static User* CreateGuestUser(const AccountId& guest_account_id); | 197 static User* CreateGuestUser(const AccountId& guest_account_id); |
| 192 static User* CreateKioskAppUser(const AccountId& kiosk_app_account_id); | 198 static User* CreateKioskAppUser(const AccountId& kiosk_app_account_id); |
| 193 static User* CreateSupervisedUser(const AccountId& account_id); | 199 static User* CreateSupervisedUser(const AccountId& account_id); |
| 194 static User* CreatePublicAccountUser(const AccountId& account_id); | 200 static User* CreatePublicAccountUser(const AccountId& account_id); |
| 195 | 201 |
| 196 explicit User(const AccountId& account_id); | |
| 197 ~User() override; | |
| 198 | |
| 199 const std::string* GetAccountLocale() const { return account_locale_.get(); } | 202 const std::string* GetAccountLocale() const { return account_locale_.get(); } |
| 200 | 203 |
| 201 // Setters are private so only UserManager can call them. | 204 // Setters are private so only UserManager can call them. |
| 202 void SetAccountLocale(const std::string& resolved_account_locale); | 205 void SetAccountLocale(const std::string& resolved_account_locale); |
| 203 | 206 |
| 204 void SetImage(scoped_ptr<UserImage> user_image, int image_index); | 207 void SetImage(scoped_ptr<UserImage> user_image, int image_index); |
| 205 | 208 |
| 206 void SetImageURL(const GURL& image_url); | 209 void SetImageURL(const GURL& image_url); |
| 207 | 210 |
| 208 // Sets a stub image until the next |SetImage| call. |image_index| may be | 211 // Sets a stub image until the next |SetImage| call. |image_index| may be |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 | 303 |
| 301 DISALLOW_COPY_AND_ASSIGN(User); | 304 DISALLOW_COPY_AND_ASSIGN(User); |
| 302 }; | 305 }; |
| 303 | 306 |
| 304 // List of known users. | 307 // List of known users. |
| 305 using UserList = std::vector<User*>; | 308 using UserList = std::vector<User*>; |
| 306 | 309 |
| 307 } // namespace user_manager | 310 } // namespace user_manager |
| 308 | 311 |
| 309 #endif // COMPONENTS_USER_MANAGER_USER_H_ | 312 #endif // COMPONENTS_USER_MANAGER_USER_H_ |
| OLD | NEW |