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

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

Issue 10831064: [cros] Remove redundant PNG enconding in UserImage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « no previous file | 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/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 namespace chromeos { 17 namespace chromeos {
18 18
19 // Fake username for the demo user. 19 // Fake username for the demo user.
20 extern const char kDemoUser[]; 20 extern const char kDemoUser[];
21 21
22 // Username for incognito login. 22 // Username for incognito login.
23 extern const char kGuestUser[]; 23 extern const char kGuestUser[];
24 24
25 extern const int kDefaultImagesCount;
26
25 // A class representing information about a previously logged in user. 27 // A class representing information about a previously logged in user.
26 // Each user has a canonical email (username), returned by |email()| and 28 // Each user has a canonical email (username), returned by |email()| and
27 // may have a different displayed email (in the raw form as entered by user), 29 // may have a different displayed email (in the raw form as entered by user),
28 // returned by |displayed_email()|. 30 // returned by |displayed_email()|.
29 // Displayed emails are for use in UI only, anywhere else users must be referred 31 // Displayed emails are for use in UI only, anywhere else users must be referred
30 // to by |email()|. 32 // to by |email()|.
31 class User { 33 class User {
32 public: 34 public:
33 // User OAuth token status according to the last check. 35 // User OAuth token status according to the last check.
34 typedef enum { 36 typedef enum {
(...skipping 22 matching lines...) Expand all
57 // Returns the human name to display for this user. 59 // Returns the human name to display for this user.
58 string16 GetDisplayName() const; 60 string16 GetDisplayName() const;
59 61
60 // Returns the account name part of the email. Use the display form of the 62 // Returns the account name part of the email. Use the display form of the
61 // email if available and use_display_name == true. Otherwise use canonical. 63 // email if available and use_display_name == true. Otherwise use canonical.
62 std::string GetAccountName(bool use_display_email) const; 64 std::string GetAccountName(bool use_display_email) const;
63 65
64 // The image for this user. 66 // The image for this user.
65 const gfx::ImageSkia& image() const { return user_image_.image(); } 67 const gfx::ImageSkia& image() const { return user_image_.image(); }
66 68
69 bool has_default_image() const {
70 return image_index_ >= 0 && image_index_ < kDefaultImagesCount;
Nikita (slow) 2012/07/31 01:57:39 nit: This doesn't seem like really "trivial" gette
71 }
72
67 int image_index() const { return image_index_; } 73 int image_index() const { return image_index_; }
68 bool has_raw_image() const { return user_image_.has_raw_image(); } 74 bool has_raw_image() const { return user_image_.has_raw_image(); }
69 // Returns raw representation of static user image. 75 // Returns raw representation of static user image.
70 const UserImage::RawImage& raw_image() const { 76 const UserImage::RawImage& raw_image() const {
71 return user_image_.raw_image(); 77 return user_image_.raw_image();
72 } 78 }
73 bool has_animated_image() const { return user_image_.has_animated_image(); } 79 bool has_animated_image() const { return user_image_.has_animated_image(); }
74 // Returns raw representation of animated user image. 80 // Returns raw representation of animated user image.
75 const UserImage::RawImage& animated_image() const { 81 const UserImage::RawImage& animated_image() const {
76 return user_image_.animated_image(); 82 return user_image_.animated_image();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 154
149 DISALLOW_COPY_AND_ASSIGN(User); 155 DISALLOW_COPY_AND_ASSIGN(User);
150 }; 156 };
151 157
152 // List of known users. 158 // List of known users.
153 typedef std::vector<User*> UserList; 159 typedef std::vector<User*> UserList;
154 160
155 } // namespace chromeos 161 } // namespace chromeos
156 162
157 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ 163 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/user.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698