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

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

Issue 9580023: Enable user change background image in settings page in Aura build. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: More refactor Created 8 years, 9 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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 14 matching lines...) Expand all
25 // to by |email()|. 25 // to by |email()|.
26 class User { 26 class User {
27 public: 27 public:
28 // User OAuth token status according to the last check. 28 // User OAuth token status according to the last check.
29 typedef enum { 29 typedef enum {
30 OAUTH_TOKEN_STATUS_UNKNOWN = 0, 30 OAUTH_TOKEN_STATUS_UNKNOWN = 0,
31 OAUTH_TOKEN_STATUS_INVALID = 1, 31 OAUTH_TOKEN_STATUS_INVALID = 1,
32 OAUTH_TOKEN_STATUS_VALID = 2, 32 OAUTH_TOKEN_STATUS_VALID = 2,
33 } OAuthTokenStatus; 33 } OAuthTokenStatus;
34 34
35 static const int kDefaultWallpaperIndex = 0;
flackr 2012/03/05 16:16:03 Comment.
35 // Returned as |image_index| when user-selected file or photo is used as 36 // Returned as |image_index| when user-selected file or photo is used as
36 // user image. 37 // user image.
37 static const int kExternalImageIndex = -1; 38 static const int kExternalImageIndex = -1;
38 // Returned as |image_index| when user profile image is used as user image. 39 // Returned as |image_index| when user profile image is used as user image.
39 static const int kProfileImageIndex = -2; 40 static const int kProfileImageIndex = -2;
40 static const int kInvalidImageIndex = -3; 41 static const int kInvalidImageIndex = -3;
41 42
42 // The email the user used to log in. 43 // The email the user used to log in.
43 const std::string& email() const { return email_; } 44 const std::string& email() const { return email_; }
44 45
45 // Returns the name to display for this user. 46 // Returns the name to display for this user.
46 std::string GetDisplayName() const; 47 std::string GetDisplayName() const;
47 // Returns the account name part of the email. 48 // Returns the account name part of the email.
48 std::string GetAccountName() const; 49 std::string GetAccountName() const;
49 50
50 // Tooltip contains user's display name and his email domain to distinguish 51 // Tooltip contains user's display name and his email domain to distinguish
51 // this user from the other one with the same display name. 52 // this user from the other one with the same display name.
52 std::string GetNameTooltip() const; 53 std::string GetNameTooltip() const;
53 54
54 // Returns true if some users have same display name. 55 // Returns true if some users have same display name.
55 bool NeedsNameTooltip() const; 56 bool NeedsNameTooltip() const;
56 57
57 // The image for this user. 58 // The image for this user.
58 const SkBitmap& image() const { return image_; } 59 const SkBitmap& image() const { return image_; }
59 int image_index() const { return image_index_; } 60 int image_index() const { return image_index_; }
60 61
62 int wallpaper_index() const {return wallpaper_index_;}
flackr 2012/03/05 16:16:03 Comment
bshe 2012/03/06 01:33:27 The function doesn't seem to work after user logou
63
61 // True if user image is a stub (while real image is being loaded from file). 64 // True if user image is a stub (while real image is being loaded from file).
62 bool image_is_stub() const { return image_is_stub_; } 65 bool image_is_stub() const { return image_is_stub_; }
63 66
64 // OAuth token status for this user. 67 // OAuth token status for this user.
65 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; } 68 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; }
66 69
67 // The displayed (non-canonical) user email. 70 // The displayed (non-canonical) user email.
68 std::string display_email() const { return display_email_; } 71 std::string display_email() const { return display_email_; }
69 72
70 bool is_guest() const { return is_guest_; } 73 bool is_guest() const { return is_guest_; }
71 74
72 private: 75 private:
73 friend class UserManager; 76 friend class UserManager;
74 77
75 // Do not allow anyone else to create new User instances. 78 // Do not allow anyone else to create new User instances.
76 User(const std::string& email, bool is_guest); 79 User(const std::string& email, bool is_guest);
77 ~User(); 80 ~User();
78 81
82 void SetWallpaper(int wallpaper_index);
flackr 2012/03/05 16:16:03 Comment.
83
79 // Setters are private so only UserManager can call them. 84 // Setters are private so only UserManager can call them.
80 void SetImage(const SkBitmap& image, int image_index); 85 void SetImage(const SkBitmap& image, int image_index);
81 // Sets a stub image until the next |SetImage| call. |image_index| may be 86 // Sets a stub image until the next |SetImage| call. |image_index| may be
82 // one of |kExternalImageIndex| or |kProfileImageIndex|. 87 // one of |kExternalImageIndex| or |kProfileImageIndex|.
83 void SetStubImage(int image_index); 88 void SetStubImage(int image_index);
84 89
85 void set_oauth_token_status(OAuthTokenStatus status) { 90 void set_oauth_token_status(OAuthTokenStatus status) {
86 oauth_token_status_ = status; 91 oauth_token_status_ = status;
87 } 92 }
88 93
89 void set_display_email(const std::string& display_email) { 94 void set_display_email(const std::string& display_email) {
90 display_email_ = display_email; 95 display_email_ = display_email;
91 } 96 }
92 97
93 std::string email_; 98 std::string email_;
94 // The displayed user email, defaults to |email_|. 99 // The displayed user email, defaults to |email_|.
95 std::string display_email_; 100 std::string display_email_;
96 SkBitmap image_; 101 SkBitmap image_;
97 OAuthTokenStatus oauth_token_status_; 102 OAuthTokenStatus oauth_token_status_;
98 103
99 // Either index of a default image for the user, |kExternalImageIndex| or 104 // Either index of a default image for the user, |kExternalImageIndex| or
100 // |kProfileImageIndex|. 105 // |kProfileImageIndex|.
101 int image_index_; 106 int image_index_;
102 107
108 int wallpaper_index_;
flackr 2012/03/05 16:16:03 Comment.
109
103 // True if current user image is a stub set by a |SetStubImage| call. 110 // True if current user image is a stub set by a |SetStubImage| call.
104 bool image_is_stub_; 111 bool image_is_stub_;
105 112
106 // Is this a guest account? 113 // Is this a guest account?
107 bool is_guest_; 114 bool is_guest_;
108 115
109 DISALLOW_COPY_AND_ASSIGN(User); 116 DISALLOW_COPY_AND_ASSIGN(User);
110 }; 117 };
111 118
112 // List of known users. 119 // List of known users.
113 typedef std::vector<User*> UserList; 120 typedef std::vector<User*> UserList;
114 121
115 } // namespace chromeos 122 } // namespace chromeos
116 123
117 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ 124 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698