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

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

Issue 10448105: Revert "Added support for animated/nonanimated user image. There are no" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "chrome/browser/chromeos/login/user_image.h"
14 #include "third_party/skia/include/core/SkBitmap.h" 13 #include "third_party/skia/include/core/SkBitmap.h"
15 #include "ui/gfx/image/image_skia.h" 14 #include "ui/gfx/image/image_skia.h"
16 15
17 // The demo user is represented by a domainless username. 16 // The demo user is represented by a domainless username.
18 const char kDemoUser[] = "demouser"; 17 const char kDemoUser[] = "demouser";
19 18
20 namespace chromeos { 19 namespace chromeos {
21 20
22 // A class representing information about a previously logged in user. 21 // A class representing information about a previously logged in user.
23 // Each user has a canonical email (username), returned by |email()| and 22 // Each user has a canonical email (username), returned by |email()| and
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 std::string GetAccountName() const; 56 std::string GetAccountName() const;
58 57
59 // Tooltip contains user's display name and his email domain to distinguish 58 // Tooltip contains user's display name and his email domain to distinguish
60 // this user from the other one with the same display name. 59 // this user from the other one with the same display name.
61 std::string GetNameTooltip() const; 60 std::string GetNameTooltip() const;
62 61
63 // Returns true if some users have same display name. 62 // Returns true if some users have same display name.
64 bool NeedsNameTooltip() const; 63 bool NeedsNameTooltip() const;
65 64
66 // The image for this user. 65 // The image for this user.
67 const gfx::ImageSkia& image() const { return user_image_.image(); } 66 const gfx::ImageSkia& image() const { return image_; }
68 int image_index() const { return image_index_; } 67 int image_index() const { return image_index_; }
69 bool has_animated_image() const { return user_image_.has_animated_image(); }
70
71 bool GetAnimatedImage(UserImage::RawImage* raw_image) const;
72 68
73 // The thumbnail of user custom wallpaper. 69 // The thumbnail of user custom wallpaper.
74 const SkBitmap& wallpaper_thumbnail() const { return wallpaper_thumbnail_; } 70 const SkBitmap& wallpaper_thumbnail() const { return wallpaper_thumbnail_; }
75 71
76 // True if user image is a stub (while real image is being loaded from file). 72 // True if user image is a stub (while real image is being loaded from file).
77 bool image_is_stub() const { return image_is_stub_; } 73 bool image_is_stub() const { return image_is_stub_; }
78 74
79 // OAuth token status for this user. 75 // OAuth token status for this user.
80 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; } 76 OAuthTokenStatus oauth_token_status() const { return oauth_token_status_; }
81 77
82 // The displayed (non-canonical) user email. 78 // The displayed (non-canonical) user email.
83 std::string display_email() const { return display_email_; } 79 std::string display_email() const { return display_email_; }
84 80
85 bool is_demo_user() const { return is_demo_user_; } 81 bool is_demo_user() const { return is_demo_user_; }
86 bool is_guest() const { return is_guest_; } 82 bool is_guest() const { return is_guest_; }
87 83
88 private: 84 private:
89 friend class UserManagerImpl; 85 friend class UserManagerImpl;
90 friend class MockUserManager; 86 friend class MockUserManager;
91 friend class UserManagerTest; 87 friend class UserManagerTest;
92 88
93 // Do not allow anyone else to create new User instances. 89 // Do not allow anyone else to create new User instances.
94 User(const std::string& email, bool is_guest); 90 User(const std::string& email, bool is_guest);
95 ~User(); 91 ~User();
96 92
97 // Setters are private so only UserManager can call them. 93 // Setters are private so only UserManager can call them.
98 void SetImage(const UserImage& user_image, int image_index); 94 void SetImage(const gfx::ImageSkia& image, int image_index);
99
100 // Sets a stub image until the next |SetImage| call. |image_index| may be 95 // Sets a stub image until the next |SetImage| call. |image_index| may be
101 // one of |kExternalImageIndex| or |kProfileImageIndex|. 96 // one of |kExternalImageIndex| or |kProfileImageIndex|.
102 void SetStubImage(int image_index); 97 void SetStubImage(int image_index);
103 98
104 // Set thumbnail of user custom wallpaper. 99 // Set thumbnail of user custom wallpaper.
105 void SetWallpaperThumbnail(const SkBitmap& wallpaper_thumbnail); 100 void SetWallpaperThumbnail(const SkBitmap& wallpaper_thumbnail);
106 101
107 void set_oauth_token_status(OAuthTokenStatus status) { 102 void set_oauth_token_status(OAuthTokenStatus status) {
108 oauth_token_status_ = status; 103 oauth_token_status_ = status;
109 } 104 }
110 105
111 void set_display_email(const std::string& display_email) { 106 void set_display_email(const std::string& display_email) {
112 display_email_ = display_email; 107 display_email_ = display_email;
113 } 108 }
114 109
115 std::string email_; 110 std::string email_;
116 // The displayed user email, defaults to |email_|. 111 // The displayed user email, defaults to |email_|.
117 std::string display_email_; 112 std::string display_email_;
118 UserImage user_image_; 113 gfx::ImageSkia image_;
119 OAuthTokenStatus oauth_token_status_; 114 OAuthTokenStatus oauth_token_status_;
120 SkBitmap wallpaper_thumbnail_; 115 SkBitmap wallpaper_thumbnail_;
121 116
122 // Either index of a default image for the user, |kExternalImageIndex| or 117 // Either index of a default image for the user, |kExternalImageIndex| or
123 // |kProfileImageIndex|. 118 // |kProfileImageIndex|.
124 int image_index_; 119 int image_index_;
125 120
126 // True if current user image is a stub set by a |SetStubImage| call. 121 // True if current user image is a stub set by a |SetStubImage| call.
127 bool image_is_stub_; 122 bool image_is_stub_;
128 123
129 // Is this a guest account? 124 // Is this a guest account?
130 bool is_guest_; 125 bool is_guest_;
131 126
132 // Is this a demo user account? 127 // Is this a demo user account?
133 bool is_demo_user_; 128 bool is_demo_user_;
134 129
135 DISALLOW_COPY_AND_ASSIGN(User); 130 DISALLOW_COPY_AND_ASSIGN(User);
136 }; 131 };
137 132
138 // List of known users. 133 // List of known users.
139 typedef std::vector<User*> UserList; 134 typedef std::vector<User*> UserList;
140 135
141 } // namespace chromeos 136 } // namespace chromeos
142 137
143 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ 138 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/mock_user_manager.h ('k') | chrome/browser/chromeos/login/user.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698