| OLD | NEW |
| 1 // Copyright (c) 2011 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> |
| 11 | 11 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 // True if user image is a stub (while real image is being loaded from file). | 56 // True if user image is a stub (while real image is being loaded from file). |
| 57 bool image_is_stub() const { return image_is_stub_; } | 57 bool image_is_stub() const { return image_is_stub_; } |
| 58 | 58 |
| 59 // OAuth token status for this user. | 59 // OAuth token status for this user. |
| 60 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; } | 60 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; } |
| 61 | 61 |
| 62 // The displayed (non-canonical) user email. | 62 // The displayed (non-canonical) user email. |
| 63 std::string display_email() const { return display_email_; } | 63 std::string display_email() const { return display_email_; } |
| 64 | 64 |
| 65 bool is_guest() const { return is_guest_; } |
| 66 |
| 65 private: | 67 private: |
| 66 friend class UserManager; | 68 friend class UserManager; |
| 67 | 69 |
| 68 // Do not allow anyone else to create new User instances. | 70 // Do not allow anyone else to create new User instances. |
| 69 explicit User(const std::string& email); | 71 User(const std::string& email, bool is_guest); |
| 70 ~User(); | 72 ~User(); |
| 71 | 73 |
| 72 // Setters are private so only UserManager can call them. | 74 // Setters are private so only UserManager can call them. |
| 73 void SetImage(const SkBitmap& image, int image_index); | 75 void SetImage(const SkBitmap& image, int image_index); |
| 74 // Sets a stub image until the next |SetImage| call. |image_index| may be | 76 // Sets a stub image until the next |SetImage| call. |image_index| may be |
| 75 // one of |kExternalImageIndex| or |kProfileImageIndex|. | 77 // one of |kExternalImageIndex| or |kProfileImageIndex|. |
| 76 void SetStubImage(int image_index); | 78 void SetStubImage(int image_index); |
| 77 | 79 |
| 78 void set_oauth_token_status(OAuthTokenStatus status) { | 80 void set_oauth_token_status(OAuthTokenStatus status) { |
| 79 oauth_token_status_ = status; | 81 oauth_token_status_ = status; |
| 80 } | 82 } |
| 81 | 83 |
| 82 void set_display_email(const std::string& display_email) { | 84 void set_display_email(const std::string& display_email) { |
| 83 display_email_ = display_email; | 85 display_email_ = display_email; |
| 84 } | 86 } |
| 85 | 87 |
| 86 std::string email_; | 88 std::string email_; |
| 87 // The displayed user email, defaults to |email_|. | 89 // The displayed user email, defaults to |email_|. |
| 88 std::string display_email_; | 90 std::string display_email_; |
| 89 SkBitmap image_; | 91 SkBitmap image_; |
| 90 OAuthTokenStatus oauth_token_status_; | 92 OAuthTokenStatus oauth_token_status_; |
| 91 | 93 |
| 92 // Either index of a default image for the user, |kExternalImageIndex| or | 94 // Either index of a default image for the user, |kExternalImageIndex| or |
| 93 // |kProfileImageIndex|. | 95 // |kProfileImageIndex|. |
| 94 int image_index_; | 96 int image_index_; |
| 95 | 97 |
| 96 // True if current user image is a stub set by a |SetStubImage| call. | 98 // True if current user image is a stub set by a |SetStubImage| call. |
| 97 bool image_is_stub_; | 99 bool image_is_stub_; |
| 98 | 100 |
| 101 // Is this a guest account? |
| 102 bool is_guest_; |
| 103 |
| 99 DISALLOW_COPY_AND_ASSIGN(User); | 104 DISALLOW_COPY_AND_ASSIGN(User); |
| 100 }; | 105 }; |
| 101 | 106 |
| 102 // List of known users. | 107 // List of known users. |
| 103 typedef std::vector<User*> UserList; | 108 typedef std::vector<User*> UserList; |
| 104 | 109 |
| 105 } // namespace chromeos | 110 } // namespace chromeos |
| 106 | 111 |
| 107 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ | 112 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ |
| OLD | NEW |