| 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "components/user_manager/user_id.h" |
| 13 #include "components/user_manager/user_image/user_image.h" | 14 #include "components/user_manager/user_image/user_image.h" |
| 14 #include "components/user_manager/user_info.h" | 15 #include "components/user_manager/user_info.h" |
| 15 #include "components/user_manager/user_manager_export.h" | 16 #include "components/user_manager/user_manager_export.h" |
| 16 #include "components/user_manager/user_type.h" | 17 #include "components/user_manager/user_type.h" |
| 17 #include "third_party/skia/include/core/SkBitmap.h" | 18 #include "third_party/skia/include/core/SkBitmap.h" |
| 18 #include "ui/gfx/image/image_skia.h" | 19 #include "ui/gfx/image/image_skia.h" |
| 19 | 20 |
| 20 namespace chromeos { | 21 namespace chromeos { |
| 21 class ChromeUserManagerImpl; | 22 class ChromeUserManagerImpl; |
| 22 class FakeChromeUserManager; | 23 class FakeChromeUserManager; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 const std::string& email() const { return email_; } | 86 const std::string& email() const { return email_; } |
| 86 | 87 |
| 87 // The displayed user name. | 88 // The displayed user name. |
| 88 base::string16 display_name() const { return display_name_; } | 89 base::string16 display_name() const { return display_name_; } |
| 89 | 90 |
| 90 // UserInfo | 91 // UserInfo |
| 91 std::string GetEmail() const override; | 92 std::string GetEmail() const override; |
| 92 base::string16 GetDisplayName() const override; | 93 base::string16 GetDisplayName() const override; |
| 93 base::string16 GetGivenName() const override; | 94 base::string16 GetGivenName() const override; |
| 94 const gfx::ImageSkia& GetImage() const override; | 95 const gfx::ImageSkia& GetImage() const override; |
| 95 std::string GetUserID() const override; | 96 UserID GetUserID() const override; |
| 96 | 97 |
| 97 // Allows managing child status of the user. Used for RegularUser. | 98 // Allows managing child status of the user. Used for RegularUser. |
| 98 virtual void SetIsChild(bool is_child); | 99 virtual void SetIsChild(bool is_child); |
| 99 | 100 |
| 100 // 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 |
| 101 // USER_TYPE_REGULAR and USER_TYPE_CHILD. | 102 // USER_TYPE_REGULAR and USER_TYPE_CHILD. |
| 102 virtual bool HasGaiaAccount() const; | 103 virtual bool HasGaiaAccount() const; |
| 103 | 104 |
| 104 // Returns true if user is supervised. | 105 // Returns true if user is supervised. |
| 105 virtual bool IsSupervised() const; | 106 virtual bool IsSupervised() const; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 friend class chromeos::UserImageManagerImpl; | 169 friend class chromeos::UserImageManagerImpl; |
| 169 friend class chromeos::UserSessionManager; | 170 friend class chromeos::UserSessionManager; |
| 170 | 171 |
| 171 // For testing: | 172 // For testing: |
| 172 friend class FakeUserManager; | 173 friend class FakeUserManager; |
| 173 friend class chromeos::FakeChromeUserManager; | 174 friend class chromeos::FakeChromeUserManager; |
| 174 friend class chromeos::MockUserManager; | 175 friend class chromeos::MockUserManager; |
| 175 friend class chromeos::UserAddingScreenTest; | 176 friend class chromeos::UserAddingScreenTest; |
| 176 | 177 |
| 177 // Do not allow anyone else to create new User instances. | 178 // Do not allow anyone else to create new User instances. |
| 178 static User* CreateRegularUser(const std::string& email); | 179 static User* CreateRegularUser(const UserID& email); |
| 179 static User* CreateGuestUser(); | 180 static User* CreateGuestUser(); |
| 180 static User* CreateKioskAppUser(const std::string& kiosk_app_username); | 181 static User* CreateKioskAppUser(const UserID& kiosk_app_username); |
| 181 static User* CreateSupervisedUser(const std::string& username); | 182 static User* CreateSupervisedUser(const UserID& username); |
| 182 static User* CreatePublicAccountUser(const std::string& email); | 183 static User* CreatePublicAccountUser(const UserID& email); |
| 183 | 184 |
| 184 explicit User(const std::string& email); | 185 explicit User(const std::string& email); |
| 185 ~User() override; | 186 ~User() override; |
| 186 | 187 |
| 187 const std::string* GetAccountLocale() const { return account_locale_.get(); } | 188 const std::string* GetAccountLocale() const { return account_locale_.get(); } |
| 188 | 189 |
| 189 // Setters are private so only UserManager can call them. | 190 // Setters are private so only UserManager can call them. |
| 190 void SetAccountLocale(const std::string& resolved_account_locale); | 191 void SetAccountLocale(const std::string& resolved_account_locale); |
| 191 | 192 |
| 192 void SetImage(const UserImage& user_image, int image_index); | 193 void SetImage(const UserImage& user_image, int image_index); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 | 281 |
| 281 DISALLOW_COPY_AND_ASSIGN(User); | 282 DISALLOW_COPY_AND_ASSIGN(User); |
| 282 }; | 283 }; |
| 283 | 284 |
| 284 // List of known users. | 285 // List of known users. |
| 285 typedef std::vector<User*> UserList; | 286 typedef std::vector<User*> UserList; |
| 286 | 287 |
| 287 } // namespace user_manager | 288 } // namespace user_manager |
| 288 | 289 |
| 289 #endif // COMPONENTS_USER_MANAGER_USER_H_ | 290 #endif // COMPONENTS_USER_MANAGER_USER_H_ |
| OLD | NEW |