Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1659)

Side by Side Diff: chrome/browser/chromeos/login/user.h

Issue 253063002: CleanUp: Introduce UserInfo. Move session_state stuff to ash/session. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "ash/session/user_info.h"
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
12 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
13 #include "chrome/browser/chromeos/login/user_image.h" 14 #include "chrome/browser/chromeos/login/user_image.h"
14 #include "third_party/skia/include/core/SkBitmap.h" 15 #include "third_party/skia/include/core/SkBitmap.h"
15 #include "ui/gfx/image/image_skia.h" 16 #include "ui/gfx/image/image_skia.h"
16 17
17 namespace chromeos { 18 namespace chromeos {
18 19
19 extern const int kDefaultImagesCount; 20 extern const int kDefaultImagesCount;
20 21
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 bool using_oauth; 63 bool using_oauth;
63 AuthFlow auth_flow; 64 AuthFlow auth_flow;
64 }; 65 };
65 66
66 // A class representing information about a previously logged in user. 67 // A class representing information about a previously logged in user.
67 // Each user has a canonical email (username), returned by |email()| and 68 // Each user has a canonical email (username), returned by |email()| and
68 // may have a different displayed email (in the raw form as entered by user), 69 // may have a different displayed email (in the raw form as entered by user),
69 // returned by |displayed_email()|. 70 // returned by |displayed_email()|.
70 // Displayed emails are for use in UI only, anywhere else users must be referred 71 // Displayed emails are for use in UI only, anywhere else users must be referred
71 // to by |email()|. 72 // to by |email()|.
72 class User { 73 class User : public ash::UserInfo {
73 public: 74 public:
74 // The user type. Used in a histogram; do not modify existing types. 75 // The user type. Used in a histogram; do not modify existing types.
75 typedef enum { 76 typedef enum {
76 // Regular user, has a user name and password. 77 // Regular user, has a user name and password.
77 USER_TYPE_REGULAR = 0, 78 USER_TYPE_REGULAR = 0,
78 // Guest user, logs in without authentication. 79 // Guest user, logs in without authentication.
79 USER_TYPE_GUEST = 1, 80 USER_TYPE_GUEST = 1,
80 // Retail mode user, logs in without authentication. This is a special user 81 // Retail mode user, logs in without authentication. This is a special user
81 // type used in retail mode only. 82 // type used in retail mode only.
82 USER_TYPE_RETAIL_MODE = 2, 83 USER_TYPE_RETAIL_MODE = 2,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 POLICY = 5, // Controlled by policy, can't be changed by the user. 117 POLICY = 5, // Controlled by policy, can't be changed by the user.
117 WALLPAPER_TYPE_COUNT = 6 118 WALLPAPER_TYPE_COUNT = 6
118 }; 119 };
119 120
120 // Returns the user type. 121 // Returns the user type.
121 virtual UserType GetType() const = 0; 122 virtual UserType GetType() const = 0;
122 123
123 // The email the user used to log in. 124 // The email the user used to log in.
124 const std::string& email() const { return email_; } 125 const std::string& email() const { return email_; }
125 126
126 // Returns the human name to display for this user. 127 // The displayed user name.
127 base::string16 GetDisplayName() const; 128 base::string16 display_name() const { return display_name_; }
128 129
129 // Returns given name of user, or empty string if given name is unknown. 130 // ash::UserInfo
130 const base::string16& given_name() const { return given_name_; } 131 virtual std::string GetEmail() const OVERRIDE;
132 virtual base::string16 GetDisplayName() const OVERRIDE;
133 virtual base::string16 GetGivenName() const OVERRIDE;
134 virtual const gfx::ImageSkia& GetImage() const OVERRIDE;
135 virtual std::string GetUserID() const OVERRIDE;
131 136
132 // Returns the account name part of the email. Use the display form of the 137 // Returns the account name part of the email. Use the display form of the
133 // email if available and use_display_name == true. Otherwise use canonical. 138 // email if available and use_display_name == true. Otherwise use canonical.
134 std::string GetAccountName(bool use_display_email) const; 139 std::string GetAccountName(bool use_display_email) const;
135 140
136 // The image for this user.
137 const gfx::ImageSkia& image() const { return user_image_.image(); }
138
139 // Whether the user has a default image. 141 // Whether the user has a default image.
140 bool HasDefaultImage() const; 142 bool HasDefaultImage() const;
141 143
142 // True if user image can be synced. 144 // True if user image can be synced.
143 virtual bool CanSyncImage() const; 145 virtual bool CanSyncImage() const;
144 146
145 int image_index() const { return image_index_; } 147 int image_index() const { return image_index_; }
146 bool has_raw_image() const { return user_image_.has_raw_image(); } 148 bool has_raw_image() const { return user_image_.has_raw_image(); }
147 // Returns raw representation of static user image. 149 // Returns raw representation of static user image.
148 const UserImage::RawImage& raw_image() const { 150 const UserImage::RawImage& raw_image() const {
(...skipping 12 matching lines...) Expand all
161 // Returns the URL of user image, if there is any. Currently only the profile 163 // Returns the URL of user image, if there is any. Currently only the profile
162 // image has a URL, for other images empty URL is returned. 164 // image has a URL, for other images empty URL is returned.
163 GURL image_url() const { return user_image_.url(); } 165 GURL image_url() const { return user_image_.url(); }
164 166
165 // True if user image is a stub (while real image is being loaded from file). 167 // True if user image is a stub (while real image is being loaded from file).
166 bool image_is_stub() const { return image_is_stub_; } 168 bool image_is_stub() const { return image_is_stub_; }
167 169
168 // True if image is being loaded from file. 170 // True if image is being loaded from file.
169 bool image_is_loading() const { return image_is_loading_; } 171 bool image_is_loading() const { return image_is_loading_; }
170 172
171 // The displayed user name.
172 base::string16 display_name() const { return display_name_; }
173
174 // The displayed (non-canonical) user email. 173 // The displayed (non-canonical) user email.
175 virtual std::string display_email() const; 174 virtual std::string display_email() const;
176 175
177 // OAuth token status for this user. 176 // OAuth token status for this user.
178 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; } 177 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; }
179 178
180 // Whether online authentication against GAIA should be enforced during the 179 // Whether online authentication against GAIA should be enforced during the
181 // user's next sign-in. 180 // user's next sign-in.
182 bool force_online_signin() const { return force_online_signin_; } 181 bool force_online_signin() const { return force_online_signin_; }
183 182
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 320
322 DISALLOW_COPY_AND_ASSIGN(User); 321 DISALLOW_COPY_AND_ASSIGN(User);
323 }; 322 };
324 323
325 // List of known users. 324 // List of known users.
326 typedef std::vector<User*> UserList; 325 typedef std::vector<User*> UserList;
327 326
328 } // namespace chromeos 327 } // namespace chromeos
329 328
330 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ 329 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/session_login_browsertest.cc ('k') | chrome/browser/chromeos/login/user.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698