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 "chrome/browser/chromeos/login/default_user_images.h" | 8 #include "chrome/browser/chromeos/login/default_user_images.h" |
9 #include "chrome/browser/chromeos/login/user_manager.h" | 9 #include "chrome/browser/chromeos/login/user_manager.h" |
10 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 image_is_stub_ = false; | 54 image_is_stub_ = false; |
55 } | 55 } |
56 | 56 |
57 void User::SetStubImage(int image_index) { | 57 void User::SetStubImage(int image_index) { |
58 image_ = *ResourceBundle::GetSharedInstance(). | 58 image_ = *ResourceBundle::GetSharedInstance(). |
59 GetBitmapNamed(kStubImageResourceID); | 59 GetBitmapNamed(kStubImageResourceID); |
60 image_index_ = image_index; | 60 image_index_ = image_index; |
61 image_is_stub_ = true; | 61 image_is_stub_ = true; |
62 } | 62 } |
63 | 63 |
64 void User::SetWallpaperThumbnail(const SkBitmap& wallpaper_thumb) { | |
flackr
2012/05/09 21:26:16
You should probably change wallpaper_thumb to wall
bshe
2012/05/10 16:10:26
Done.
| |
65 wallpaper_thumb_ = wallpaper_thumb; | |
66 } | |
67 | |
64 std::string User::GetAccountName() const { | 68 std::string User::GetAccountName() const { |
65 return GetUserName(email_); | 69 return GetUserName(email_); |
66 } | 70 } |
67 | 71 |
68 std::string User::GetDisplayName() const { | 72 std::string User::GetDisplayName() const { |
69 return GetUserName(display_email_); | 73 return GetUserName(display_email_); |
70 } | 74 } |
71 | 75 |
72 bool User::NeedsNameTooltip() const { | 76 bool User::NeedsNameTooltip() const { |
73 return !UserManager::Get()->IsDisplayNameUnique(GetDisplayName()); | 77 return !UserManager::Get()->IsDisplayNameUnique(GetDisplayName()); |
74 } | 78 } |
75 | 79 |
76 std::string User::GetNameTooltip() const { | 80 std::string User::GetNameTooltip() const { |
77 const std::string& user_email = display_email_; | 81 const std::string& user_email = display_email_; |
78 size_t at_pos = user_email.rfind('@'); | 82 size_t at_pos = user_email.rfind('@'); |
79 if (at_pos == std::string::npos) { | 83 if (at_pos == std::string::npos) { |
80 NOTREACHED(); | 84 NOTREACHED(); |
81 return std::string(); | 85 return std::string(); |
82 } | 86 } |
83 size_t domain_start = at_pos + 1; | 87 size_t domain_start = at_pos + 1; |
84 std::string domain = user_email.substr(domain_start, | 88 std::string domain = user_email.substr(domain_start, |
85 user_email.length() - domain_start); | 89 user_email.length() - domain_start); |
86 return base::StringPrintf("%s (%s)", | 90 return base::StringPrintf("%s (%s)", |
87 GetDisplayName().c_str(), | 91 GetDisplayName().c_str(), |
88 domain.c_str()); | 92 domain.c_str()); |
89 } | 93 } |
90 | 94 |
91 } // namespace chromeos | 95 } // namespace chromeos |
OLD | NEW |