| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // this user from the other one with the same display name. | 58 // this user from the other one with the same display name. |
| 59 std::string GetNameTooltip() const; | 59 std::string GetNameTooltip() const; |
| 60 | 60 |
| 61 // Returns true if some users have same display name. | 61 // Returns true if some users have same display name. |
| 62 bool NeedsNameTooltip() const; | 62 bool NeedsNameTooltip() const; |
| 63 | 63 |
| 64 // The image for this user. | 64 // The image for this user. |
| 65 const SkBitmap& image() const { return image_; } | 65 const SkBitmap& image() const { return image_; } |
| 66 int image_index() const { return image_index_; } | 66 int image_index() const { return image_index_; } |
| 67 | 67 |
| 68 // The thumbnail of user custom wallpaper. |
| 69 const SkBitmap& wallpaper_thumb() const { return wallpaper_thumb_; } |
| 70 |
| 68 // True if user image is a stub (while real image is being loaded from file). | 71 // True if user image is a stub (while real image is being loaded from file). |
| 69 bool image_is_stub() const { return image_is_stub_; } | 72 bool image_is_stub() const { return image_is_stub_; } |
| 70 | 73 |
| 71 // OAuth token status for this user. | 74 // OAuth token status for this user. |
| 72 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; } | 75 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; } |
| 73 | 76 |
| 74 // The displayed (non-canonical) user email. | 77 // The displayed (non-canonical) user email. |
| 75 std::string display_email() const { return display_email_; } | 78 std::string display_email() const { return display_email_; } |
| 76 | 79 |
| 77 bool is_demo_user() const { return is_demo_user_; } | 80 bool is_demo_user() const { return is_demo_user_; } |
| 78 bool is_guest() const { return is_guest_; } | 81 bool is_guest() const { return is_guest_; } |
| 79 | 82 |
| 80 private: | 83 private: |
| 81 friend class UserManagerImpl; | 84 friend class UserManagerImpl; |
| 82 friend class MockUserManager; | 85 friend class MockUserManager; |
| 83 friend class UserManagerTest; | 86 friend class UserManagerTest; |
| 84 | 87 |
| 85 // Do not allow anyone else to create new User instances. | 88 // Do not allow anyone else to create new User instances. |
| 86 User(const std::string& email, bool is_guest); | 89 User(const std::string& email, bool is_guest); |
| 87 ~User(); | 90 ~User(); |
| 88 | 91 |
| 89 // Setters are private so only UserManager can call them. | 92 // Setters are private so only UserManager can call them. |
| 90 void SetImage(const SkBitmap& image, int image_index); | 93 void SetImage(const SkBitmap& image, int image_index); |
| 91 // Sets a stub image until the next |SetImage| call. |image_index| may be | 94 // Sets a stub image until the next |SetImage| call. |image_index| may be |
| 92 // one of |kExternalImageIndex| or |kProfileImageIndex|. | 95 // one of |kExternalImageIndex| or |kProfileImageIndex|. |
| 93 void SetStubImage(int image_index); | 96 void SetStubImage(int image_index); |
| 94 | 97 |
| 98 // Set thumbnail of user custom wallpaper. |
| 99 void SetWallpaperThumbnail(const SkBitmap& wallpaper_thumb); |
| 100 |
| 95 void set_oauth_token_status(OAuthTokenStatus status) { | 101 void set_oauth_token_status(OAuthTokenStatus status) { |
| 96 oauth_token_status_ = status; | 102 oauth_token_status_ = status; |
| 97 } | 103 } |
| 98 | 104 |
| 99 void set_display_email(const std::string& display_email) { | 105 void set_display_email(const std::string& display_email) { |
| 100 display_email_ = display_email; | 106 display_email_ = display_email; |
| 101 } | 107 } |
| 102 | 108 |
| 103 std::string email_; | 109 std::string email_; |
| 104 // The displayed user email, defaults to |email_|. | 110 // The displayed user email, defaults to |email_|. |
| 105 std::string display_email_; | 111 std::string display_email_; |
| 106 SkBitmap image_; | 112 SkBitmap image_; |
| 107 OAuthTokenStatus oauth_token_status_; | 113 OAuthTokenStatus oauth_token_status_; |
| 114 SkBitmap wallpaper_thumb_; |
| 108 | 115 |
| 109 // Either index of a default image for the user, |kExternalImageIndex| or | 116 // Either index of a default image for the user, |kExternalImageIndex| or |
| 110 // |kProfileImageIndex|. | 117 // |kProfileImageIndex|. |
| 111 int image_index_; | 118 int image_index_; |
| 112 | 119 |
| 113 // True if current user image is a stub set by a |SetStubImage| call. | 120 // True if current user image is a stub set by a |SetStubImage| call. |
| 114 bool image_is_stub_; | 121 bool image_is_stub_; |
| 115 | 122 |
| 116 // Is this a guest account? | 123 // Is this a guest account? |
| 117 bool is_guest_; | 124 bool is_guest_; |
| 118 | 125 |
| 119 // Is this a demo user account? | 126 // Is this a demo user account? |
| 120 bool is_demo_user_; | 127 bool is_demo_user_; |
| 121 | 128 |
| 122 DISALLOW_COPY_AND_ASSIGN(User); | 129 DISALLOW_COPY_AND_ASSIGN(User); |
| 123 }; | 130 }; |
| 124 | 131 |
| 125 // List of known users. | 132 // List of known users. |
| 126 typedef std::vector<User*> UserList; | 133 typedef std::vector<User*> UserList; |
| 127 | 134 |
| 128 } // namespace chromeos | 135 } // namespace chromeos |
| 129 | 136 |
| 130 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ | 137 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ |
| OLD | NEW |