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

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

Issue 11953021: Don't show the apps page on the NTP if the app launcher is installed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move getShouldShowApps message to onLoad. Created 7 years, 11 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
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_resource_cache.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 39f8aac43c4f4d8250eef538d9fdbbfa81ad4596..8bdee4bacc8596bbfa098a0424df57770e4169c4 100644
--- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
@@ -16,6 +16,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/extensions/app_launcher.h"
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/google/google_util.h"
#include "chrome/browser/policy/browser_policy_connector.h"
@@ -163,7 +164,8 @@ std::string GetNewTabBackgroundTilingCSS(
} // namespace
NTPResourceCache::NTPResourceCache(Profile* profile)
- : profile_(profile), is_swipe_tracking_from_scroll_events_enabled_(false) {
+ : profile_(profile), is_swipe_tracking_from_scroll_events_enabled_(false),
+ should_show_apps_page_(NewTabUI::ShouldShowApps()) {
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
content::Source<ThemeService>(
ThemeServiceFactory::GetForProfile(profile)));
@@ -192,6 +194,11 @@ bool NTPResourceCache::NewTabCacheNeedsRefresh() {
return true;
}
#endif
+ bool should_show_apps_page = !extensions::IsAppLauncherEnabled();
+ if (should_show_apps_page != should_show_apps_page_) {
+ should_show_apps_page_ = should_show_apps_page;
+ return true;
+ }
return false;
}
@@ -379,7 +386,6 @@ void NTPResourceCache::CreateNewTabHTML() {
l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_INSTALL_HINT_LABEL));
load_time_data.SetBoolean("isDiscoveryInNTPEnabled",
NewTabUI::IsDiscoveryInNTPEnabled());
- load_time_data.SetBoolean("showApps", NewTabUI::ShouldShowApps());
load_time_data.SetString("collapseSessionMenuItemText",
l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_COLLAPSE_SESSION));
load_time_data.SetString("expandSessionMenuItemText",
@@ -399,6 +405,7 @@ void NTPResourceCache::CreateNewTabHTML() {
// feature is enabled.
load_time_data.SetBoolean("isSwipeTrackingFromScrollEventsEnabled",
is_swipe_tracking_from_scroll_events_enabled_);
+ load_time_data.SetBoolean("showApps", should_show_apps_page_);
#if defined(OS_CHROMEOS)
load_time_data.SetString("expandMenu",
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_resource_cache.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698