OLD | NEW |
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 #include "chrome/browser/chromeos/login/user.h" | 5 #include "chrome/browser/chromeos/login/user.h" |
6 | 6 |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/chromeos/login/default_user_images.h" | 9 #include "chrome/browser/chromeos/login/default_user_images.h" |
10 #include "chrome/browser/chromeos/login/user_manager.h" | 10 #include "chrome/browser/chromeos/login/user_manager.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 void User::SetImageURL(const GURL& image_url) { | 53 void User::SetImageURL(const GURL& image_url) { |
54 user_image_.set_url(image_url); | 54 user_image_.set_url(image_url); |
55 } | 55 } |
56 | 56 |
57 void User::SetStubImage(int image_index) { | 57 void User::SetStubImage(int image_index) { |
58 user_image_ = UserImage(); | 58 user_image_ = UserImage(); |
59 image_index_ = image_index; | 59 image_index_ = image_index; |
60 image_is_stub_ = true; | 60 image_is_stub_ = true; |
61 } | 61 } |
62 | 62 |
63 void User::SetWallpaperThumbnail(const SkBitmap& wallpaper_thumbnail) { | |
64 wallpaper_thumbnail_ = wallpaper_thumbnail; | |
65 } | |
66 | |
67 std::string User::GetAccountName(bool use_display_email) const { | 63 std::string User::GetAccountName(bool use_display_email) const { |
68 if (use_display_email && !display_email_.empty()) | 64 if (use_display_email && !display_email_.empty()) |
69 return GetUserName(display_email_); | 65 return GetUserName(display_email_); |
70 else | 66 else |
71 return GetUserName(email_); | 67 return GetUserName(email_); |
72 } | 68 } |
73 | 69 |
74 bool User::HasDefaultImage() const { | 70 bool User::HasDefaultImage() const { |
75 return image_index_ >= 0 && image_index_ < kDefaultImagesCount; | 71 return image_index_ >= 0 && image_index_ < kDefaultImagesCount; |
76 } | 72 } |
77 | 73 |
78 string16 User::GetDisplayName() const { | 74 string16 User::GetDisplayName() const { |
79 // Fallback to the email account name in case display name haven't been set. | 75 // Fallback to the email account name in case display name haven't been set. |
80 return display_name_.empty() ? | 76 return display_name_.empty() ? |
81 UTF8ToUTF16(GetAccountName(true)) : | 77 UTF8ToUTF16(GetAccountName(true)) : |
82 display_name_; | 78 display_name_; |
83 } | 79 } |
84 | 80 |
85 } // namespace chromeos | 81 } // namespace chromeos |
OLD | NEW |