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

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

Issue 12985002: Add a new App launcher promo to the apps page / NTP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 35c8db44d9b331ebf569f1d768786fd711f54a85..561369918690c8448ed4657041e14546556776ac 100644
--- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
@@ -8,6 +8,7 @@
#include <vector>
#include "apps/app_launcher.h"
+#include "apps/pref_names.h"
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/memory/ref_counted_memory.h"
@@ -180,12 +181,17 @@ NTPResourceCache::NTPResourceCache(Profile* profile)
base::Unretained(this));
// Watch for pref changes that cause us to need to invalidate the HTML cache.
- pref_change_registrar_.Init(profile_->GetPrefs());
- pref_change_registrar_.Add(prefs::kSyncAcknowledgedSyncTypes, callback);
- pref_change_registrar_.Add(prefs::kShowBookmarkBar, callback);
- pref_change_registrar_.Add(prefs::kNtpShownPage, callback);
- pref_change_registrar_.Add(prefs::kSyncPromoShowNTPBubble, callback);
- pref_change_registrar_.Add(prefs::kHideWebStoreIcon, callback);
+ profile_pref_change_registrar_.Init(profile_->GetPrefs());
+ profile_pref_change_registrar_.Add(prefs::kSyncAcknowledgedSyncTypes,
+ callback);
+ profile_pref_change_registrar_.Add(prefs::kShowBookmarkBar, callback);
+ profile_pref_change_registrar_.Add(prefs::kNtpShownPage, callback);
+ profile_pref_change_registrar_.Add(prefs::kSyncPromoShowNTPBubble, callback);
+ profile_pref_change_registrar_.Add(prefs::kHideWebStoreIcon, callback);
+
+ local_state_pref_change_registrar_.Init(g_browser_process->local_state());
+ local_state_pref_change_registrar_.Add(apps::prefs::kShowAppLauncherPromo,
+ callback);
}
NTPResourceCache::~NTPResourceCache() {}
@@ -321,6 +327,7 @@ void NTPResourceCache::CreateNewTabHTML() {
// Show the profile name in the title and most visited labels if the current
// profile is not the default.
PrefService* prefs = profile_->GetPrefs();
+ PrefService* local_state = g_browser_process->local_state();
DictionaryValue load_time_data;
load_time_data.SetBoolean("bookmarkbarattached",
prefs->GetBoolean(prefs::kShowBookmarkBar));
@@ -328,6 +335,9 @@ void NTPResourceCache::CreateNewTabHTML() {
ThemeServiceFactory::GetForProfile(profile_)->HasCustomImage(
IDR_THEME_NTP_ATTRIBUTION));
load_time_data.SetBoolean("showMostvisited", should_show_most_visited_page_);
+ load_time_data.SetBoolean(
+ "showAppLauncherPromo",
+ local_state->GetBoolean(apps::prefs::kShowAppLauncherPromo));
load_time_data.SetBoolean("showRecentlyClosed",
should_show_recently_closed_menu_);
load_time_data.SetString("title",
@@ -406,6 +416,8 @@ void NTPResourceCache::CreateNewTabHTML() {
l10n_util::GetStringUTF16(IDS_NEW_TAB_PAGE_SWITCHER_CHANGE_TITLE));
load_time_data.SetString("page_switcher_same_title",
l10n_util::GetStringUTF16(IDS_NEW_TAB_PAGE_SWITCHER_SAME_TITLE));
+ load_time_data.SetString("appsPromoTitle",
+ l10n_util::GetStringUTF16(IDS_NEW_TAB_PAGE_APPS_PROMO_TITLE));
// On Mac OS X 10.7+, horizontal scrolling can be treated as a back or
// forward gesture. Pass through a flag that indicates whether or not that
// feature is enabled.

Powered by Google App Engine
This is Rietveld 408576698