blob: 1b30f828d3f5724371424171203ae93ae01daef5 [file] [log] [blame]
[email protected]411f8ae2014-05-22 11:12:231// 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.
4
5#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_UI_UTIL_H_
6#define CHROME_BROWSER_EXTENSIONS_EXTENSION_UI_UTIL_H_
7
Adrian Elder66bf5122017-11-28 01:56:338#include "url/gurl.h"
9
[email protected]411f8ae2014-05-22 11:12:2310namespace content {
11class BrowserContext;
12}
13
David Bertoni3cd201f72018-11-15 21:37:2314class SkBitmap;
15
[email protected]411f8ae2014-05-22 11:12:2316namespace extensions {
17
18class Extension;
19
20namespace ui_util {
21
22// Returns true if the extension should be displayed in the app launcher.
23// Checks whether the extension is an ephemeral app or should be hidden due to
24// policy.
25bool ShouldDisplayInAppLauncher(const Extension* extension,
26 content::BrowserContext* context);
27
[email protected]0e5c10fa2014-06-11 17:14:5728// Returns true if the extension can be displayed in the app launcher.
29// Checks whether the extension should be hidden due to policy, but does not
30// exclude ephemeral apps.
31bool CanDisplayInAppLauncher(const Extension* extension,
32 content::BrowserContext* context);
33
[email protected]411f8ae2014-05-22 11:12:2334// Returns true if the extension should be displayed in the browser NTP.
35// Checks whether the extension is an ephemeral app or should be hidden due to
36// policy.
37bool ShouldDisplayInNewTabPage(const Extension* extension,
38 content::BrowserContext* context);
39
40// Returns true if the extension should be displayed in the extension
41// settings page (i.e. chrome://extensions). Checks whether the extension is
42// an ephemeral app.
43bool ShouldDisplayInExtensionSettings(const Extension* extension,
44 content::BrowserContext* context);
45
Adrian Elder66bf5122017-11-28 01:56:3346// If |url| is an extension URL, returns the name of the associated extension,
47// with whitespace collapsed. Otherwise, returns empty string. |context| is used
48// to get at the extension registry.
49base::string16 GetEnabledExtensionNameForUrl(const GURL& url,
50 content::BrowserContext* context);
51
David Bertoni3cd201f72018-11-15 21:37:2352// Returns true if the icon, rendered in the toolbar of the current context,
53// would be sufficiently visible to the user.
54bool IsRenderedIconSufficientlyVisibleForBrowserContext(
55 const SkBitmap& bitmap,
56 content::BrowserContext* browser_context);
57
[email protected]411f8ae2014-05-22 11:12:2358} // namespace ui_util
59} // namespace extensions
60
61#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UI_UTIL_H_