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

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

Issue 8773046: [cros] Display emails of users are stored in a separate dictionary in Local State. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 13 #include "third_party/skia/include/core/SkBitmap.h"
14 14
15 namespace chromeos { 15 namespace chromeos {
16 16
17 // A class representing information about a previously logged in user. 17 // A class representing information about a previously logged in user.
Nikita (slow) 2011/12/05 13:13:04 nit: Update comment how where email_ and where dis
Ivan Korotkov 2011/12/05 14:12:48 Done.
18 class User { 18 class User {
19 public: 19 public:
20 // User OAuth token status according to the last check. 20 // User OAuth token status according to the last check.
21 typedef enum { 21 typedef enum {
22 OAUTH_TOKEN_STATUS_UNKNOWN = 0, 22 OAUTH_TOKEN_STATUS_UNKNOWN = 0,
23 OAUTH_TOKEN_STATUS_INVALID = 1, 23 OAUTH_TOKEN_STATUS_INVALID = 1,
24 OAUTH_TOKEN_STATUS_VALID = 2, 24 OAUTH_TOKEN_STATUS_VALID = 2,
25 } OAuthTokenStatus; 25 } OAuthTokenStatus;
26 26
27 // Returned as |image_index| when user-selected file or photo is used as 27 // Returned as |image_index| when user-selected file or photo is used as
(...skipping 10 matching lines...) Expand all
38 std::string GetDisplayName() const; 38 std::string GetDisplayName() const;
39 39
40 // Tooltip contains user's display name and his email domain to distinguish 40 // Tooltip contains user's display name and his email domain to distinguish
41 // this user from the other one with the same display name. 41 // this user from the other one with the same display name.
42 std::string GetNameTooltip() const; 42 std::string GetNameTooltip() const;
43 43
44 // Returns true if some users have same display name. 44 // Returns true if some users have same display name.
45 bool NeedsNameTooltip() const; 45 bool NeedsNameTooltip() const;
46 46
47 // The image for this user. 47 // The image for this user.
48 void SetImage(const SkBitmap& image, int image_index);
49 const SkBitmap& image() const { return image_; } 48 const SkBitmap& image() const { return image_; }
50 int image_index() const { return image_index_; } 49 int image_index() const { return image_index_; }
51 50
52 // OAuth token status for this user. 51 // OAuth token status for this user.
53 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; } 52 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; }
54 void set_oauth_token_status(OAuthTokenStatus status) { 53
55 oauth_token_status_ = status; 54 // The displayed (non-canonical) user email.
56 } 55 std::string display_email() const { return display_email_; }
57 56
58 private: 57 private:
59 friend class UserManager; 58 friend class UserManager;
60 59
61 // Do not allow anyone else to create new User instances. 60 // Do not allow anyone else to create new User instances.
62 explicit User(const std::string& email); 61 explicit User(const std::string& email);
63 ~User(); 62 ~User();
64 63
64 // Setters are private so only UserManager can call them.
65 void SetImage(const SkBitmap& image, int image_index);
66
67 void set_oauth_token_status(OAuthTokenStatus status) {
68 oauth_token_status_ = status;
69 }
70
71 void set_display_email(const std::string& display_email) {
72 display_email_ = display_email;
73 }
74
65 std::string email_; 75 std::string email_;
76 // The displayed user email, defaults to |email_|.
77 std::string display_email_;
66 SkBitmap image_; 78 SkBitmap image_;
67 OAuthTokenStatus oauth_token_status_; 79 OAuthTokenStatus oauth_token_status_;
68 80
69 // Either index of a default image for the user, |kExternalImageIndex| or 81 // Either index of a default image for the user, |kExternalImageIndex| or
70 // |kProfileImageIndex|. 82 // |kProfileImageIndex|.
71 int image_index_; 83 int image_index_;
72 84
73 DISALLOW_COPY_AND_ASSIGN(User); 85 DISALLOW_COPY_AND_ASSIGN(User);
74 }; 86 };
75 87
76 // List of known users. 88 // List of known users.
77 typedef std::vector<User*> UserList; 89 typedef std::vector<User*> UserList;
78 90
79 } // namespace chromeos 91 } // namespace chromeos
80 92
81 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ 93 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698