[email protected] | 411f8ae | 2014-05-22 11:12:23 | [diff] [blame] | 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. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_UI_UTIL_H_ |
| 6 | #define CHROME_BROWSER_EXTENSIONS_EXTENSION_UI_UTIL_H_ |
| 7 | |
Adrian Elder | 66bf512 | 2017-11-28 01:56:33 | [diff] [blame] | 8 | #include "url/gurl.h" |
| 9 | |
[email protected] | 411f8ae | 2014-05-22 11:12:23 | [diff] [blame] | 10 | namespace content { |
| 11 | class BrowserContext; |
| 12 | } |
| 13 | |
David Bertoni | 3cd201f7 | 2018-11-15 21:37:23 | [diff] [blame] | 14 | class SkBitmap; |
| 15 | |
[email protected] | 411f8ae | 2014-05-22 11:12:23 | [diff] [blame] | 16 | namespace extensions { |
| 17 | |
| 18 | class Extension; |
| 19 | |
| 20 | namespace 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. |
| 25 | bool ShouldDisplayInAppLauncher(const Extension* extension, |
| 26 | content::BrowserContext* context); |
| 27 | |
[email protected] | 0e5c10fa | 2014-06-11 17:14:57 | [diff] [blame] | 28 | // 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. |
| 31 | bool CanDisplayInAppLauncher(const Extension* extension, |
| 32 | content::BrowserContext* context); |
| 33 | |
[email protected] | 411f8ae | 2014-05-22 11:12:23 | [diff] [blame] | 34 | // 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. |
| 37 | bool 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. |
| 43 | bool ShouldDisplayInExtensionSettings(const Extension* extension, |
| 44 | content::BrowserContext* context); |
| 45 | |
Adrian Elder | 66bf512 | 2017-11-28 01:56:33 | [diff] [blame] | 46 | // 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. |
| 49 | base::string16 GetEnabledExtensionNameForUrl(const GURL& url, |
| 50 | content::BrowserContext* context); |
| 51 | |
David Bertoni | 3cd201f7 | 2018-11-15 21:37:23 | [diff] [blame] | 52 | // Returns true if the icon, rendered in the toolbar of the current context, |
| 53 | // would be sufficiently visible to the user. |
| 54 | bool IsRenderedIconSufficientlyVisibleForBrowserContext( |
| 55 | const SkBitmap& bitmap, |
| 56 | content::BrowserContext* browser_context); |
| 57 | |
[email protected] | 411f8ae | 2014-05-22 11:12:23 | [diff] [blame] | 58 | } // namespace ui_util |
| 59 | } // namespace extensions |
| 60 | |
| 61 | #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UI_UTIL_H_ |