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; |