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 17a710d32c6ac7b2e6eb29c9a8da09e2a5270de6..261d1b003dd0cb400bb9228b808664de4035153e 100644 |
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc |
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc |
@@ -21,6 +21,7 @@ |
#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/extensions/crx_installer.h" |
#include "chrome/browser/extensions/extension_service.h" |
+#include "chrome/browser/extensions/extension_ui_util.h" |
#include "chrome/browser/extensions/launch_util.h" |
#include "chrome/browser/favicon/favicon_service_factory.h" |
#include "chrome/browser/profiles/profile.h" |
@@ -72,14 +73,6 @@ using extensions::UnloadedExtensionInfo; |
namespace { |
-bool ShouldDisplayInNewTabPage(const Extension* app, PrefService* prefs) { |
- bool blocked_by_policy = |
- (app->id() == extension_misc::kWebStoreAppId || |
- app->id() == extension_misc::kEnterpriseWebStoreAppId) && |
- prefs->GetBoolean(prefs::kHideWebStoreIcon); |
- return app->ShouldDisplayInNewTabPage() && !blocked_by_policy; |
-} |
- |
void RecordAppLauncherPromoHistogram( |
apps::AppLauncherPromoHistogramValues value) { |
DCHECK_LT(value, apps::APP_LAUNCHER_PROMO_MAX); |
@@ -266,9 +259,10 @@ void AppLauncherHandler::Observe(int type, |
if (!extension->is_app()) |
return; |
- PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
- if (!ShouldDisplayInNewTabPage(extension, prefs)) |
+ if (!extensions::ui_util::ShouldDisplayInNewTabPage( |
+ extension, Profile::FromWebUI(web_ui()))) { |
return; |
+ } |
scoped_ptr<base::DictionaryValue> app_info(GetAppInfo(extension)); |
if (app_info.get()) { |
@@ -307,9 +301,10 @@ void AppLauncherHandler::Observe(int type, |
if (!extension->is_app()) |
return; |
- PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
- if (!ShouldDisplayInNewTabPage(extension, prefs)) |
+ if (!extensions::ui_util::ShouldDisplayInNewTabPage( |
+ extension, Profile::FromWebUI(web_ui()))) { |
return; |
+ } |
scoped_ptr<base::DictionaryValue> app_info(GetAppInfo(extension)); |
if (app_info.get()) { |
@@ -368,12 +363,14 @@ void AppLauncherHandler::FillAppDictionary(base::DictionaryValue* dictionary) { |
base::AutoReset<bool> auto_reset(&ignore_changes_, true); |
base::ListValue* list = new base::ListValue(); |
- PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
+ Profile* profile = Profile::FromWebUI(web_ui()); |
+ PrefService* prefs = profile->GetPrefs(); |
for (std::set<std::string>::iterator it = visible_apps_.begin(); |
it != visible_apps_.end(); ++it) { |
const Extension* extension = extension_service_->GetInstalledExtension(*it); |
- if (extension && ShouldDisplayInNewTabPage(extension, prefs)) { |
+ if (extension && extensions::ui_util::ShouldDisplayInNewTabPage( |
+ extension, profile)) { |
base::DictionaryValue* app_info = GetAppInfo(extension); |
list->Append(app_info); |
} |