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