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..a7082f8b77e9eaac9a4ae4c51feeab217819bc7e 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" |
@@ -63,6 +64,29 @@ using extensions::ExtensionPrefs; |
const net::UnescapeRule::Type kUnescapeRules = |
net::UnescapeRule::NORMAL | net::UnescapeRule::URL_SPECIAL_CHARS; |
+AppsPagePresenceHandler::AppsPagePresenceHandler() {} |
+ |
+AppsPagePresenceHandler::~AppsPagePresenceHandler() {} |
+ |
+void AppsPagePresenceHandler::RegisterMessages() { |
+ web_ui()->RegisterMessageCallback("getShouldShowApps", |
+ base::Bind(&AppsPagePresenceHandler::HandleGetShouldShowApps, |
+ base::Unretained(this))); |
+} |
+ |
+void AppsPagePresenceHandler::HandleGetShouldShowApps(const ListValue* args) { |
+ extensions::GetIsAppLauncherEnabled( |
+ base::Bind(&AppsPagePresenceHandler::GotIsAppLauncherEnabled, |
+ base::Unretained(this))); |
+} |
+ |
+void AppsPagePresenceHandler::GotIsAppLauncherEnabled(bool is_enabled) { |
+ PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
+ prefs->SetBoolean(prefs::kNtpShouldShowAppsPage, !is_enabled); |
+ base::FundamentalValue should_show_apps(!is_enabled); |
+ web_ui()->CallJavascriptFunction("ntp.gotShouldShowApps", should_show_apps); |
+} |
+ |
AppLauncherHandler::AppInstallInfo::AppInstallInfo() {} |
AppLauncherHandler::AppInstallInfo::~AppInstallInfo() {} |
@@ -779,6 +803,9 @@ void AppLauncherHandler::OnPreferenceChanged() { |
void AppLauncherHandler::RegisterUserPrefs(PrefServiceSyncable* pref_service) { |
pref_service->RegisterListPref(prefs::kNtpAppPageNames, |
PrefServiceSyncable::SYNCABLE_PREF); |
+ pref_service->RegisterBooleanPref(prefs::kNtpShouldShowAppsPage, |
+ true, |
Evan Stade
2013/01/23 23:34:24
shouldn't this default to NewTabUI::ShouldShowApps
jeremya
2013/01/24 02:40:04
It should probably default to the result of just t
|
+ PrefServiceSyncable::UNSYNCABLE_PREF); |
} |
void AppLauncherHandler::CleanupAfterUninstall() { |