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

Unified Diff: chrome/browser/ui/webui/ntp/new_tab_page_handler.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/new_tab_page_handler.h ('k') | chrome/browser/ui/webui/ntp/new_tab_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/ntp/new_tab_page_handler.cc
diff --git a/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc b/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc
index 3600116fffe86ae38eaad4e28dcf58a5983bfd39..8416cfafce3f1f36a5a0bdaf84a68d47568e14ee 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc
@@ -8,6 +8,7 @@
#include "base/bind_helpers.h"
#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
+#include "chrome/browser/extensions/app_launcher.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/profile_sync_service.h"
@@ -73,6 +74,9 @@ void NewTabPageHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback("logTimeToClick",
base::Bind(&NewTabPageHandler::HandleLogTimeToClick,
base::Unretained(this)));
+ web_ui()->RegisterMessageCallback("getShouldShowApps",
+ base::Bind(&NewTabPageHandler::HandleGetShouldShowApps,
+ base::Unretained(this)));
}
void NewTabPageHandler::HandleNotificationPromoClosed(const ListValue* args) {
@@ -167,6 +171,17 @@ void NewTabPageHandler::HandleLogTimeToClick(const ListValue* args) {
}
}
+void NewTabPageHandler::HandleGetShouldShowApps(const ListValue* args) {
+ extensions::UpdateIsAppLauncherEnabled(
+ base::Bind(&NewTabPageHandler::GotIsAppLauncherEnabled,
+ AsWeakPtr()));
+}
+
+void NewTabPageHandler::GotIsAppLauncherEnabled(bool is_enabled) {
+ base::FundamentalValue should_show_apps(!is_enabled);
+ web_ui()->CallJavascriptFunction("ntp.gotShouldShowApps", should_show_apps);
+}
+
// static
void NewTabPageHandler::RegisterUserPrefs(PrefServiceSyncable* prefs) {
// TODO(estade): should be syncable.
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_page_handler.h ('k') | chrome/browser/ui/webui/ntp/new_tab_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698