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

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

Issue 10805007: [cros] UserManager cleanup regarding stub/demo users. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused fields and fix compile Created 8 years, 5 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 "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "chrome/browser/chromeos/login/user_image.h" 13 #include "chrome/browser/chromeos/login/user_image.h"
14 #include "third_party/skia/include/core/SkBitmap.h" 14 #include "third_party/skia/include/core/SkBitmap.h"
15 #include "ui/gfx/image/image_skia.h" 15 #include "ui/gfx/image/image_skia.h"
16 16
17 // The demo user is represented by a domainless username. 17 namespace chromeos {
18 const char kDemoUser[] = "demouser";
19 18
20 namespace chromeos { 19 // Fake username for the demo user.
20 extern const char kDemoUser[];
21
22 // Username for incognito login.
23 extern const char kGuestUser[];
21 24
22 // A class representing information about a previously logged in user. 25 // A class representing information about a previously logged in user.
23 // Each user has a canonical email (username), returned by |email()| and 26 // Each user has a canonical email (username), returned by |email()| and
24 // may have a different displayed email (in the raw form as entered by user), 27 // may have a different displayed email (in the raw form as entered by user),
25 // returned by |displayed_email()|. 28 // returned by |displayed_email()|.
26 // Displayed emails are for use in UI only, anywhere else users must be referred 29 // Displayed emails are for use in UI only, anywhere else users must be referred
27 // to by |email()|. 30 // to by |email()|.
28 class User { 31 class User {
29 public: 32 public:
30 // User OAuth token status according to the last check. 33 // User OAuth token status according to the last check.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 88
86 // OAuth token status for this user. 89 // OAuth token status for this user.
87 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; } 90 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; }
88 91
89 // The displayed user name. 92 // The displayed user name.
90 string16 display_name() const { return display_name_; } 93 string16 display_name() const { return display_name_; }
91 94
92 // The displayed (non-canonical) user email. 95 // The displayed (non-canonical) user email.
93 std::string display_email() const { return display_email_; } 96 std::string display_email() const { return display_email_; }
94 97
95 bool is_demo_user() const { return is_demo_user_; } 98 bool is_demo_user() const { return email_ == kDemoUser; }
96 bool is_guest() const { return is_guest_; } 99 bool is_guest() const { return email_ == kGuestUser; }
97 100
98 private: 101 private:
99 friend class UserManagerImpl; 102 friend class UserManagerImpl;
100 friend class MockUserManager; 103 friend class MockUserManager;
101 friend class UserManagerTest; 104 friend class UserManagerTest;
102 105
103 // Do not allow anyone else to create new User instances. 106 // Do not allow anyone else to create new User instances.
104 User(const std::string& email, bool is_guest); 107 explicit User(const std::string& email_guest);
105 ~User(); 108 ~User();
106 109
107 // Setters are private so only UserManager can call them. 110 // Setters are private so only UserManager can call them.
108 void SetImage(const UserImage& user_image, int image_index); 111 void SetImage(const UserImage& user_image, int image_index);
109 112
110 void SetImageURL(const GURL& image_url); 113 void SetImageURL(const GURL& image_url);
111 114
112 // Sets a stub image until the next |SetImage| call. |image_index| may be 115 // Sets a stub image until the next |SetImage| call. |image_index| may be
113 // one of |kExternalImageIndex| or |kProfileImageIndex|. 116 // one of |kExternalImageIndex| or |kProfileImageIndex|.
114 void SetStubImage(int image_index); 117 void SetStubImage(int image_index);
(...skipping 21 matching lines...) Expand all
136 OAuthTokenStatus oauth_token_status_; 139 OAuthTokenStatus oauth_token_status_;
137 SkBitmap wallpaper_thumbnail_; 140 SkBitmap wallpaper_thumbnail_;
138 141
139 // Either index of a default image for the user, |kExternalImageIndex| or 142 // Either index of a default image for the user, |kExternalImageIndex| or
140 // |kProfileImageIndex|. 143 // |kProfileImageIndex|.
141 int image_index_; 144 int image_index_;
142 145
143 // True if current user image is a stub set by a |SetStubImage| call. 146 // True if current user image is a stub set by a |SetStubImage| call.
144 bool image_is_stub_; 147 bool image_is_stub_;
145 148
146 // Is this a guest account?
147 bool is_guest_;
148
149 // Is this a demo user account?
150 bool is_demo_user_;
151
152 DISALLOW_COPY_AND_ASSIGN(User); 149 DISALLOW_COPY_AND_ASSIGN(User);
153 }; 150 };
154 151
155 // List of known users. 152 // List of known users.
156 typedef std::vector<User*> UserList; 153 typedef std::vector<User*> UserList;
157 154
158 } // namespace chromeos 155 } // namespace chromeos
159 156
160 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ 157 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698