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

Unified Diff: chrome/browser/ui/app_list/apps_model_builder.cc

Issue 12038067: Filter Web Store app from ChromeOS launcher according to policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: stop reusing AppListModel::Apps in test Created 7 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/apps_model_builder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/apps_model_builder.cc
diff --git a/chrome/browser/ui/app_list/apps_model_builder.cc b/chrome/browser/ui/app_list/apps_model_builder.cc
index 904787a7fab414bd0882bcc36fdbe03000a058a6..12b1e252f99cd0fe211ad773f71db20eb52e7aa6 100644
--- a/chrome/browser/ui/app_list/apps_model_builder.cc
+++ b/chrome/browser/ui/app_list/apps_model_builder.cc
@@ -17,6 +17,8 @@
#include "chrome/browser/ui/app_list/extension_app_item.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/extension_constants.h"
+#include "chrome/common/pref_names.h"
#include "content/public/browser/notification_service.h"
#include "ui/gfx/image/image_skia.h"
@@ -36,6 +38,16 @@ bool AppPrecedes(const ExtensionAppItem* app1, const ExtensionAppItem* app2) {
return false;
}
+bool ShouldDisplayInAppLauncher(Profile* profile,
+ scoped_refptr<const Extension> app) {
+ // If it's the web store, check the policy.
+ bool blocked_by_policy =
+ (app->id() == extension_misc::kWebStoreAppId ||
+ app->id() == extension_misc::kEnterpriseWebStoreAppId) &&
+ profile->GetPrefs()->GetBoolean(prefs::kHideWebStoreIcon);
+ return app->ShouldDisplayInAppLauncher() && !blocked_by_policy;
+}
+
} // namespace
AppsModelBuilder::AppsModelBuilder(Profile* profile,
@@ -117,7 +129,7 @@ void AppsModelBuilder::OnInstallFailure(const std::string& extension_id) {
void AppsModelBuilder::AddApps(const ExtensionSet* extensions, Apps* apps) {
for (ExtensionSet::const_iterator app = extensions->begin();
app != extensions->end(); ++app) {
- if ((*app)->ShouldDisplayInAppLauncher())
+ if (ShouldDisplayInAppLauncher(profile_, *app))
apps->push_back(new ExtensionAppItem(profile_,
(*app)->id(),
controller_,
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/apps_model_builder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698