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

Unified Diff: chrome/browser/ui/webui/ntp/ntp_login_handler.cc

Issue 8921008: Follow-up to bug 102685 (r113862) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Following suggestions from Evan Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3795673dc3e979e4d13ff3227ae341e3ce483cd4 100644
--- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
@@ -61,6 +61,13 @@ SkBitmap GetGAIAPictureForNTP(const gfx::Image& image) {
return canvas.ExtractBitmap();
}
+// Put the display_string into a span with the given CSS class.
James Hawkins 2011/12/12 23:24:41 s/Put/Puts/
James Hawkins 2011/12/12 23:24:41 s/display_string/|display_string|/
Tyler Breisacher (Chromium) 2011/12/12 23:37:42 Done.
Tyler Breisacher (Chromium) 2011/12/12 23:37:42 Or, |content| since I renamed it based on estade's
+string16 CreateSpanWithClass(const string16& content,
+ const std::string& css_class) {
+ return ASCIIToUTF16("<span class='" + css_class + "'>") +
+ net::EscapeForHTML(content) + ASCIIToUTF16("</span>");
+}
+
} // namespace
NTPLoginHandler::NTPLoginHandler() {
@@ -186,27 +193,21 @@ 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 = CreateSpanWithClass(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>");
- }
+ if (header.empty())
+ header = CreateSpanWithClass(UTF8ToUTF16(username), "profile-name");
}
} else if (SyncPromoUI::ShouldShowSyncPromo(profile) &&
(SyncPromoUI::UserHasSeenSyncPromoAtStartup(profile) ||
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 = CreateSpanWithClass(signed_in_link, "link-span");
header = l10n_util::GetStringFUTF16(
IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_HEADER,
l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698