Index: chrome/browser/ui/webui/ntp/ntp_login_handler.cc |
diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc |
index b4420ba549bb8157c3e809a1532ba125387ca04b..4e8b4eec438edd1e8025507aaa2e30ca2ee3cabe 100644 |
--- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc |
+++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc |
@@ -186,17 +186,14 @@ void NTPLoginHandler::UpdateLogin() { |
// title bar and the full name can be ambiguous. |
if (cache.GetNumberOfProfiles() == 1) { |
string16 name = cache.GetGAIANameOfProfileAtIndex(profile_index); |
- header = ASCIIToUTF16("<span class='profile-name'>") + |
- net::EscapeForHTML(name) + |
- ASCIIToUTF16("</span>"); |
+ header = AddCSSClass(name, "profile-name"); |
const gfx::Image* image = |
cache.GetGAIAPictureOfProfileAtIndex(profile_index); |
if (image) |
icon_url = web_ui_util::GetImageDataUrl(GetGAIAPictureForNTP(*image)); |
} |
if (header.empty()) { |
- header = UTF8ToUTF16("<span class='profile-name'>" + |
- net::EscapeForHTML(username) + "</span>"); |
+ header = AddCSSClass(username, "profile-name"); |
} |
} |
} else if (SyncPromoUI::ShouldShowSyncPromo(profile) && |
@@ -204,9 +201,7 @@ void NTPLoginHandler::UpdateLogin() { |
PromoResourceService::CanShowNTPSignInPromo(profile))) { |
string16 signed_in_link = l10n_util::GetStringUTF16( |
IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_LINK); |
- signed_in_link = ASCIIToUTF16("<span class='link-span'>") + |
- net::EscapeForHTML(signed_in_link) + |
- ASCIIToUTF16("</span>"); |
+ signed_in_link = AddCSSClass(signed_in_link, "link-span"); |
header = l10n_util::GetStringFUTF16( |
IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_HEADER, |
l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); |
@@ -223,6 +218,18 @@ void NTPLoginHandler::UpdateLogin() { |
"updateLogin", header_value, sub_header_value, icon_url_value); |
} |
+string16 NTPLoginHandler::AddCSSClass(std::string display_string, |
James Hawkins
2011/12/12 19:09:18
This does not need to be on the NTPLoginHandler cl
James Hawkins
2011/12/12 19:09:18
Need a more descriptive (non-generic) name for the
Tyler Breisacher (Chromium)
2011/12/12 19:15:02
What would be a better class to put this in? Or sh
Tyler Breisacher (Chromium)
2011/12/12 19:15:02
I made two separate functions because "username" a
James Hawkins
2011/12/12 19:18:26
Not all functions need to live on an object, and i
James Hawkins
2011/12/12 19:18:26
UTF8ToUTF16
|
+ std::string css_class) { |
+ return UTF8ToUTF16("<span class='" + css_class + "'>" + |
+ net::EscapeForHTML(display_string) + "</span>"); |
+} |
+ |
+string16 NTPLoginHandler::AddCSSClass(string16 display_string, |
+ std::string css_class) { |
+ return UTF8ToUTF16("<span class='" + css_class + "'>") + |
+ net::EscapeForHTML(display_string) + UTF8ToUTF16("</span>"); |
+} |
+ |
// static |
bool NTPLoginHandler::ShouldShow(Profile* profile) { |
#if defined(OS_CHROMEOS) |