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

Unified Diff: chrome/browser/ui/webui/ntp/app_launcher_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: pref -> app_launcher 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
Index: chrome/browser/ui/webui/ntp/app_launcher_handler.cc
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index 37776021fd2801686dd4a596748d8782ea1aff32..fbb53c1ac5177d779d1b18cd6be382ce9f163083 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -14,6 +14,7 @@
#include "base/metrics/histogram.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
+#include "chrome/browser/extensions/app_launcher.h"
#include "chrome/browser/extensions/app_notification.h"
#include "chrome/browser/extensions/app_notification_manager.h"
#include "chrome/browser/extensions/crx_installer.h"
@@ -178,6 +179,9 @@ void AppLauncherHandler::RegisterMessages() {
registrar_.Add(this, chrome::NOTIFICATION_APP_INSTALLED_TO_NTP,
content::Source<WebContents>(web_ui()->GetWebContents()));
+ web_ui()->RegisterMessageCallback("getShouldShowApps",
+ base::Bind(&AppLauncherHandler::HandleGetShouldShowApps,
+ base::Unretained(this)));
web_ui()->RegisterMessageCallback("getApps",
base::Bind(&AppLauncherHandler::HandleGetApps,
base::Unretained(this)));
@@ -390,6 +394,17 @@ DictionaryValue* AppLauncherHandler::GetAppInfo(const Extension* extension) {
return app_info;
}
+void AppLauncherHandler::HandleGetShouldShowApps(const ListValue* args) {
+ extensions::UpdateIsAppLauncherEnabled(
+ base::Bind(&AppLauncherHandler::GotIsAppLauncherEnabled,
+ base::Unretained(this)));
Evan Stade 2013/01/24 18:40:17 this doesn't seem right. You need to pass a weak p
jeremya 2013/01/25 00:06:19 Done.
+}
+
+void AppLauncherHandler::GotIsAppLauncherEnabled(bool is_enabled) {
+ base::FundamentalValue should_show_apps(!is_enabled);
+ web_ui()->CallJavascriptFunction("ntp.gotShouldShowApps", should_show_apps);
+}
+
void AppLauncherHandler::HandleGetApps(const ListValue* args) {
DictionaryValue dictionary;

Powered by Google App Engine
This is Rietveld 408576698