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

Unified Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.cc

Issue 282103003: Moved IS_EPHEMERAL flag to extension prefs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix up file header Created 6 years, 7 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 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);
}
« no previous file with comments | « chrome/browser/ui/webui/extensions/extension_settings_handler.cc ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698