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

Side by Side Diff: components/user_manager/user.h

Issue 1425093004: Revert of This CL replaces user_manager::UserID with AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@468875--Chrome-OS-handles-deletion-of-Gmail-account-poorly--Create-AccountID-structure-part2--user_names
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « components/user_manager/fake_user_manager.cc ('k') | components/user_manager/user.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/signin/core/account_id/account_id.h" 13 #include "components/user_manager/user_id.h"
14 #include "components/user_manager/user_image/user_image.h" 14 #include "components/user_manager/user_image/user_image.h"
15 #include "components/user_manager/user_info.h" 15 #include "components/user_manager/user_info.h"
16 #include "components/user_manager/user_manager_export.h" 16 #include "components/user_manager/user_manager_export.h"
17 #include "components/user_manager/user_type.h" 17 #include "components/user_manager/user_type.h"
18 #include "third_party/skia/include/core/SkBitmap.h" 18 #include "third_party/skia/include/core/SkBitmap.h"
19 #include "ui/gfx/image/image_skia.h" 19 #include "ui/gfx/image/image_skia.h"
20 20
21 namespace chromeos { 21 namespace chromeos {
22 class ChromeUserManagerImpl; 22 class ChromeUserManagerImpl;
23 class FakeChromeUserManager; 23 class FakeChromeUserManager;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 WALLPAPER_TYPE_COUNT = 6 76 WALLPAPER_TYPE_COUNT = 6
77 }; 77 };
78 78
79 // Returns true if user type has gaia account. 79 // Returns true if user type has gaia account.
80 static bool TypeHasGaiaAccount(UserType user_type); 80 static bool TypeHasGaiaAccount(UserType user_type);
81 81
82 // Returns the user type. 82 // Returns the user type.
83 virtual UserType GetType() const = 0; 83 virtual UserType GetType() const = 0;
84 84
85 // The email the user used to log in. 85 // The email the user used to log in.
86 // TODO(alemate): rename this to GetUserEmail() (see crbug.com/548923) 86 const std::string& email() const { return email_; }
87 const std::string& email() const;
88 87
89 // The displayed user name. 88 // The displayed user name.
90 base::string16 display_name() const { return display_name_; } 89 base::string16 display_name() const { return display_name_; }
91 90
92 // If the user has to use SAML to log in. 91 // If the user has to use SAML to log in.
93 bool using_saml() const { return using_saml_; } 92 bool using_saml() const { return using_saml_; }
94 93
95 // UserInfo 94 // UserInfo
96 std::string GetEmail() const override; 95 std::string GetEmail() const override;
97 base::string16 GetDisplayName() const override; 96 base::string16 GetDisplayName() const override;
98 base::string16 GetGivenName() const override; 97 base::string16 GetGivenName() const override;
99 const gfx::ImageSkia& GetImage() const override; 98 const gfx::ImageSkia& GetImage() const override;
100 AccountId GetAccountId() const override; 99 UserID GetUserID() const override;
101 100
102 // Allows managing child status of the user. Used for RegularUser. 101 // Allows managing child status of the user. Used for RegularUser.
103 virtual void SetIsChild(bool is_child); 102 virtual void SetIsChild(bool is_child);
104 103
105 // Returns true if user has gaia account. True for users of types 104 // Returns true if user has gaia account. True for users of types
106 // USER_TYPE_REGULAR and USER_TYPE_CHILD. 105 // USER_TYPE_REGULAR and USER_TYPE_CHILD.
107 virtual bool HasGaiaAccount() const; 106 virtual bool HasGaiaAccount() const;
108 107
109 // Returns true if user is supervised. 108 // Returns true if user is supervised.
110 virtual bool IsSupervised() const; 109 virtual bool IsSupervised() const;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 friend class chromeos::UserImageManagerImpl; 175 friend class chromeos::UserImageManagerImpl;
177 friend class chromeos::UserSessionManager; 176 friend class chromeos::UserSessionManager;
178 177
179 // For testing: 178 // For testing:
180 friend class FakeUserManager; 179 friend class FakeUserManager;
181 friend class chromeos::FakeChromeUserManager; 180 friend class chromeos::FakeChromeUserManager;
182 friend class chromeos::MockUserManager; 181 friend class chromeos::MockUserManager;
183 friend class chromeos::UserAddingScreenTest; 182 friend class chromeos::UserAddingScreenTest;
184 183
185 // Do not allow anyone else to create new User instances. 184 // Do not allow anyone else to create new User instances.
186 static User* CreateRegularUser(const AccountId& account_id); 185 static User* CreateRegularUser(const UserID& email);
187 static User* CreateGuestUser(); 186 static User* CreateGuestUser();
188 static User* CreateKioskAppUser(const AccountId& kiosk_app_account_id); 187 static User* CreateKioskAppUser(const UserID& kiosk_app_username);
189 static User* CreateSupervisedUser(const AccountId& account_id); 188 static User* CreateSupervisedUser(const UserID& username);
190 static User* CreatePublicAccountUser(const AccountId& account_id); 189 static User* CreatePublicAccountUser(const UserID& email);
191 190
192 explicit User(const AccountId& account_id); 191 explicit User(const std::string& email);
193 ~User() override; 192 ~User() override;
194 193
195 const std::string* GetAccountLocale() const { return account_locale_.get(); } 194 const std::string* GetAccountLocale() const { return account_locale_.get(); }
196 195
197 // Setters are private so only UserManager can call them. 196 // Setters are private so only UserManager can call them.
198 void SetAccountLocale(const std::string& resolved_account_locale); 197 void SetAccountLocale(const std::string& resolved_account_locale);
199 198
200 void SetImage(const UserImage& user_image, int image_index); 199 void SetImage(const UserImage& user_image, int image_index);
201 200
202 void SetImageURL(const GURL& image_url); 201 void SetImageURL(const GURL& image_url);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 void set_profile_is_created() { profile_is_created_ = true; } 244 void set_profile_is_created() { profile_is_created_ = true; }
246 245
247 // True if user has google account (not a guest or managed user). 246 // True if user has google account (not a guest or managed user).
248 bool has_gaia_account() const; 247 bool has_gaia_account() const;
249 248
250 void set_affiliation(bool is_affiliated) { 249 void set_affiliation(bool is_affiliated) {
251 is_affiliated_ = is_affiliated; 250 is_affiliated_ = is_affiliated;
252 } 251 }
253 252
254 private: 253 private:
255 AccountId account_id_; 254 std::string email_;
256 base::string16 display_name_; 255 base::string16 display_name_;
257 base::string16 given_name_; 256 base::string16 given_name_;
258 // The displayed user email, defaults to |email_|. 257 // The displayed user email, defaults to |email_|.
259 std::string display_email_; 258 std::string display_email_;
260 bool using_saml_ = false; 259 bool using_saml_;
261 UserImage user_image_; 260 UserImage user_image_;
262 OAuthTokenStatus oauth_token_status_ = OAUTH_TOKEN_STATUS_UNKNOWN; 261 OAuthTokenStatus oauth_token_status_;
263 bool force_online_signin_ = false; 262 bool force_online_signin_;
264 263
265 // This is set to chromeos locale if account data has been downloaded. 264 // This is set to chromeos locale if account data has been downloaded.
266 // (Or failed to download, but at least one download attempt finished). 265 // (Or failed to download, but at least one download attempt finished).
267 // An empty string indicates error in data load, or in 266 // An empty string indicates error in data load, or in
268 // translation of Account locale to chromeos locale. 267 // translation of Account locale to chromeos locale.
269 scoped_ptr<std::string> account_locale_; 268 scoped_ptr<std::string> account_locale_;
270 269
271 // Used to identify homedir mount point. 270 // Used to identify homedir mount point.
272 std::string username_hash_; 271 std::string username_hash_;
273 272
274 // Either index of a default image for the user, |USER_IMAGE_EXTERNAL| or 273 // Either index of a default image for the user, |USER_IMAGE_EXTERNAL| or
275 // |USER_IMAGE_PROFILE|. 274 // |USER_IMAGE_PROFILE|.
276 int image_index_ = USER_IMAGE_INVALID; 275 int image_index_;
277 276
278 // True if current user image is a stub set by a |SetStubImage| call. 277 // True if current user image is a stub set by a |SetStubImage| call.
279 bool image_is_stub_ = false; 278 bool image_is_stub_;
280 279
281 // True if current user image is being loaded from file. 280 // True if current user image is being loaded from file.
282 bool image_is_loading_ = false; 281 bool image_is_loading_;
283 282
284 // True if user is able to lock screen. 283 // True if user is able to lock screen.
285 bool can_lock_ = false; 284 bool can_lock_;
286 285
287 // True if user is currently logged in in current session. 286 // True if user is currently logged in in current session.
288 bool is_logged_in_ = false; 287 bool is_logged_in_;
289 288
290 // True if user is currently logged in and active in current session. 289 // True if user is currently logged in and active in current session.
291 bool is_active_ = false; 290 bool is_active_;
292 291
293 // True if user Profile is created 292 // True if user Profile is created
294 bool profile_is_created_ = false; 293 bool profile_is_created_;
295 294
296 // True if the user is affiliated to the device. 295 // True if the user is affiliated to the device.
297 bool is_affiliated_ = false; 296 bool is_affiliated_;
298 297
299 DISALLOW_COPY_AND_ASSIGN(User); 298 DISALLOW_COPY_AND_ASSIGN(User);
300 }; 299 };
301 300
302 // List of known users. 301 // List of known users.
303 using UserList = std::vector<User*>; 302 typedef std::vector<User*> UserList;
304 303
305 } // namespace user_manager 304 } // namespace user_manager
306 305
307 #endif // COMPONENTS_USER_MANAGER_USER_H_ 306 #endif // COMPONENTS_USER_MANAGER_USER_H_
OLDNEW
« no previous file with comments | « components/user_manager/fake_user_manager.cc ('k') | components/user_manager/user.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698