Update broken references to image assets
[chromium-blink-merge.git] / chrome / browser / extensions / extension_ui_util.cc
blob4cf4fa89775566d31d8bf15def03738d868f8219
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/extensions/extension_ui_util.h"
7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/common/extensions/extension_constants.h"
10 #include "chrome/common/pref_names.h"
11 #include "extensions/browser/extension_util.h"
12 #include "extensions/common/constants.h"
13 #include "extensions/common/extension.h"
15 namespace extensions {
17 namespace {
19 bool IsBlockedByPolicy(const Extension* app, content::BrowserContext* context) {
20 Profile* profile = Profile::FromBrowserContext(context);
21 DCHECK(profile);
23 return (app->id() == extensions::kWebStoreAppId ||
24 app->id() == extension_misc::kEnterpriseWebStoreAppId) &&
25 profile->GetPrefs()->GetBoolean(prefs::kHideWebStoreIcon);
28 } // namespace
30 namespace ui_util {
32 bool ShouldDisplayInAppLauncher(const Extension* extension,
33 content::BrowserContext* context) {
34 return CanDisplayInAppLauncher(extension, context) &&
35 !util::IsEphemeralApp(extension->id(), context);
38 bool CanDisplayInAppLauncher(const Extension* extension,
39 content::BrowserContext* context) {
40 return extension->ShouldDisplayInAppLauncher() &&
41 !IsBlockedByPolicy(extension, context);
44 bool ShouldDisplayInNewTabPage(const Extension* extension,
45 content::BrowserContext* context) {
46 return extension->ShouldDisplayInNewTabPage() &&
47 !IsBlockedByPolicy(extension, context) &&
48 !util::IsEphemeralApp(extension->id(), context);
51 bool ShouldDisplayInExtensionSettings(const Extension* extension,
52 content::BrowserContext* context) {
53 return extension->ShouldDisplayInExtensionSettings() &&
54 !util::IsEphemeralApp(extension->id(), context);
57 bool ShouldNotBeVisible(const Extension* extension,
58 content::BrowserContext* context) {
59 return extension->ShouldNotBeVisible() ||
60 util::IsEphemeralApp(extension->id(), context);
63 } // namespace ui_util
64 } // namespace extensions