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

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

Issue 145073003: Indicate which authentication flow was used in UserContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Speculative fix for telemetry. Created 6 years, 11 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
« no previous file with comments | « chrome/browser/chromeos/login/screen_locker.cc ('k') | chrome/browser/chromeos/login/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 (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/strings/string16.h" 12 #include "base/strings/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 namespace chromeos { 17 namespace chromeos {
18 18
19 extern const int kDefaultImagesCount; 19 extern const int kDefaultImagesCount;
20 20
21 // User context data that is being exchanged between part of ChromeOS 21 // User context data that is being exchanged between part of ChromeOS
22 // authentication mechanism. Includes credentials: 22 // authentication mechanism. Includes credentials:
23 // |username|, |password|, |auth_code| and |username_hash| which is returned 23 // |username|, |password|, |auth_code| and |username_hash| which is returned
24 // back once user homedir is mounted. |username_hash| is used to identify 24 // back once user homedir is mounted. |username_hash| is used to identify
25 // user homedir mount point. 25 // user homedir mount point.
26 struct UserContext { 26 struct UserContext {
27 // The authentication flow used during sign-in.
28 enum AuthFlow {
29 // Online authentication against GAIA. GAIA did not redirect to a SAML IdP.
30 AUTH_FLOW_GAIA_WITHOUT_SAML,
31 // Online authentication against GAIA. GAIA redirected to a SAML IdP.
32 AUTH_FLOW_GAIA_WITH_SAML,
33 // Offline authentication against a cached password.
34 AUTH_FLOW_OFFLINE
35 };
36
27 UserContext(); 37 UserContext();
28 UserContext(const std::string& username, 38 UserContext(const std::string& username,
29 const std::string& password, 39 const std::string& password,
30 const std::string& auth_code); 40 const std::string& auth_code);
31 UserContext(const std::string& username, 41 UserContext(const std::string& username,
32 const std::string& password, 42 const std::string& password,
33 const std::string& auth_code, 43 const std::string& auth_code,
34 const std::string& username_hash); 44 const std::string& username_hash);
35 UserContext(const std::string& username, 45 UserContext(const std::string& username,
36 const std::string& password, 46 const std::string& password,
37 const std::string& auth_code, 47 const std::string& auth_code,
38 const std::string& username_hash, 48 const std::string& username_hash,
39 bool using_oauth); 49 bool using_oauth,
50 AuthFlow auth_flow);
40 virtual ~UserContext(); 51 virtual ~UserContext();
41 bool operator==(const UserContext& context) const; 52 bool operator==(const UserContext& context) const;
42 std::string username; 53 std::string username;
43 std::string password; 54 std::string password;
44 std::string auth_code; 55 std::string auth_code;
45 std::string username_hash; 56 std::string username_hash;
46 bool using_oauth; 57 bool using_oauth;
58 AuthFlow auth_flow;
47 }; 59 };
48 60
49 // A class representing information about a previously logged in user. 61 // A class representing information about a previously logged in user.
50 // Each user has a canonical email (username), returned by |email()| and 62 // Each user has a canonical email (username), returned by |email()| and
51 // may have a different displayed email (in the raw form as entered by user), 63 // may have a different displayed email (in the raw form as entered by user),
52 // returned by |displayed_email()|. 64 // returned by |displayed_email()|.
53 // Displayed emails are for use in UI only, anywhere else users must be referred 65 // Displayed emails are for use in UI only, anywhere else users must be referred
54 // to by |email()|. 66 // to by |email()|.
55 class User { 67 class User {
56 public: 68 public:
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // Returns the URL of user image, if there is any. Currently only the profile 155 // Returns the URL of user image, if there is any. Currently only the profile
144 // image has a URL, for other images empty URL is returned. 156 // image has a URL, for other images empty URL is returned.
145 GURL image_url() const { return user_image_.url(); } 157 GURL image_url() const { return user_image_.url(); }
146 158
147 // True if user image is a stub (while real image is being loaded from file). 159 // True if user image is a stub (while real image is being loaded from file).
148 bool image_is_stub() const { return image_is_stub_; } 160 bool image_is_stub() const { return image_is_stub_; }
149 161
150 // True if image is being loaded from file. 162 // True if image is being loaded from file.
151 bool image_is_loading() const { return image_is_loading_; } 163 bool image_is_loading() const { return image_is_loading_; }
152 164
153 // OAuth token status for this user.
154 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; }
155
156 // The displayed user name. 165 // The displayed user name.
157 base::string16 display_name() const { return display_name_; } 166 base::string16 display_name() const { return display_name_; }
158 167
159 // The displayed (non-canonical) user email. 168 // The displayed (non-canonical) user email.
160 virtual std::string display_email() const; 169 virtual std::string display_email() const;
161 170
171 // OAuth token status for this user.
172 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; }
173
162 // True if the user's session can be locked (i.e. the user has a password with 174 // True if the user's session can be locked (i.e. the user has a password with
163 // which to unlock the session). 175 // which to unlock the session).
164 virtual bool can_lock() const; 176 virtual bool can_lock() const;
165 177
166 virtual std::string username_hash() const; 178 virtual std::string username_hash() const;
167 179
168 // True if current user is logged in. 180 // True if current user is logged in.
169 virtual bool is_logged_in() const; 181 virtual bool is_logged_in() const;
170 182
171 // True if current user is active within the current session. 183 // True if current user is active within the current session.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 216
205 void SetImage(const UserImage& user_image, int image_index); 217 void SetImage(const UserImage& user_image, int image_index);
206 218
207 void SetImageURL(const GURL& image_url); 219 void SetImageURL(const GURL& image_url);
208 220
209 // Sets a stub image until the next |SetImage| call. |image_index| may be 221 // Sets a stub image until the next |SetImage| call. |image_index| may be
210 // one of |kExternalImageIndex| or |kProfileImageIndex|. 222 // one of |kExternalImageIndex| or |kProfileImageIndex|.
211 // If |is_loading| is |true|, that means user image is being loaded from file. 223 // If |is_loading| is |true|, that means user image is being loaded from file.
212 void SetStubImage(int image_index, bool is_loading); 224 void SetStubImage(int image_index, bool is_loading);
213 225
214 void set_oauth_token_status(OAuthTokenStatus status) {
215 oauth_token_status_ = status;
216 }
217
218 void set_display_name(const base::string16& display_name) { 226 void set_display_name(const base::string16& display_name) {
219 display_name_ = display_name; 227 display_name_ = display_name;
220 } 228 }
221 229
222 void set_given_name(const base::string16& given_name) { given_name_ = given_na me; } 230 void set_given_name(const base::string16& given_name) { given_name_ = given_na me; }
223 231
224 void set_display_email(const std::string& display_email) { 232 void set_display_email(const std::string& display_email) {
225 display_email_ = display_email; 233 display_email_ = display_email;
226 } 234 }
227 235
228 const UserImage& user_image() const { return user_image_; } 236 const UserImage& user_image() const { return user_image_; }
229 237
238 void set_oauth_token_status(OAuthTokenStatus status) {
239 oauth_token_status_ = status;
240 }
241
230 void set_username_hash(const std::string& username_hash) { 242 void set_username_hash(const std::string& username_hash) {
231 username_hash_ = username_hash; 243 username_hash_ = username_hash;
232 } 244 }
233 245
234 void set_is_logged_in(bool is_logged_in) { 246 void set_is_logged_in(bool is_logged_in) {
235 is_logged_in_ = is_logged_in; 247 is_logged_in_ = is_logged_in;
236 } 248 }
237 249
238 void set_is_active(bool is_active) { 250 void set_is_active(bool is_active) {
239 is_active_ = is_active; 251 is_active_ = is_active;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 297
286 DISALLOW_COPY_AND_ASSIGN(User); 298 DISALLOW_COPY_AND_ASSIGN(User);
287 }; 299 };
288 300
289 // List of known users. 301 // List of known users.
290 typedef std::vector<User*> UserList; 302 typedef std::vector<User*> UserList;
291 303
292 } // namespace chromeos 304 } // namespace chromeos
293 305
294 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ 306 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/screen_locker.cc ('k') | chrome/browser/chromeos/login/user.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698