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

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

Issue 9838064: Add a sign-in promo message to the Other Devices menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments, and only enable menu when tab sync is enabled. Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
index b18bf164902635747bebd44ac2b3618c2fff0b43..e4d648bfef3deccd209662fc084364e0619debf6 100644
--- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
@@ -289,10 +289,10 @@ void NTPResourceCache::CreateNewTabHTML() {
// (in GetLocalizedValues) and should have more legible names.
// Show the profile name in the title and most visited labels if the current
// profile is not the default.
+ PrefService* prefs = profile_->GetPrefs();
Dan Beam 2012/03/26 23:18:54 thanks for this, btw
Patrick Dubroy 2012/03/27 00:36:51 np.
DictionaryValue localized_strings;
localized_strings.SetString("bookmarkbarattached",
- profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar) ?
- "true" : "false");
+ prefs->GetBoolean(prefs::kShowBookmarkBar) ? "true" : "false");
localized_strings.SetString("hasattribution",
ThemeServiceFactory::GetForProfile(profile_)->HasCustomImage(
IDR_THEME_NTP_ATTRIBUTION) ?
@@ -349,6 +349,10 @@ void NTPResourceCache::CreateNewTabHTML() {
l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_LABEL));
localized_strings.SetString("otherSessionsEmpty",
l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_EMPTY));
+ localized_strings.SetString("otherSessionsLearnMoreUrl",
+ l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_LEARN_MORE_URL));
+ localized_strings.SetString("learnMore",
+ l10n_util::GetStringUTF16(IDS_LEARN_MORE));
localized_strings.SetString("webStoreLink",
GetUrlWithLang(GURL(extension_urls::GetWebstoreLaunchURL())));
localized_strings.SetBoolean("isWebStoreExperimentEnabled",
@@ -391,11 +395,11 @@ void NTPResourceCache::CreateNewTabHTML() {
// If the user has preferences for a start and end time for a custom logo,
// and the time now is between these two times, show the custom logo.
- if (profile_->GetPrefs()->FindPreference(prefs::kNtpCustomLogoStart) &&
- profile_->GetPrefs()->FindPreference(prefs::kNtpCustomLogoEnd)) {
+ if (prefs->FindPreference(prefs::kNtpCustomLogoStart) &&
+ prefs->FindPreference(prefs::kNtpCustomLogoEnd)) {
localized_strings.SetString("customlogo",
- InDateRange(profile_->GetPrefs()->GetDouble(prefs::kNtpCustomLogoStart),
- profile_->GetPrefs()->GetDouble(prefs::kNtpCustomLogoEnd)) ?
+ InDateRange(prefs->GetDouble(prefs::kNtpCustomLogoStart),
+ prefs->GetDouble(prefs::kNtpCustomLogoEnd)) ?
"true" : "false");
} else {
localized_strings.SetString("customlogo", "false");
@@ -405,7 +409,7 @@ void NTPResourceCache::CreateNewTabHTML() {
// the server, and this promo string exists, set the localized string.
if (PromoResourceService::CanShowNotificationPromo(profile_)) {
localized_strings.SetString("serverpromo",
- profile_->GetPrefs()->GetString(prefs::kNtpPromoLine));
+ prefs->GetString(prefs::kNtpPromoLine));
}
// Determine whether to show the menu for accessing tabs on other devices.
@@ -413,6 +417,8 @@ void NTPResourceCache::CreateNewTabHTML() {
switches::kDisableNTPOtherSessionsMenu);
localized_strings.SetBoolean("showOtherSessionsMenu",
show_other_sessions_menu);
+ localized_strings.SetBoolean("isUserSignedIn",
+ !prefs->GetString(prefs::kGoogleServicesUsername).empty());
// Load the new tab page appropriate for this build
std::string full_html;

Powered by Google App Engine
This is Rietveld 408576698