blob: af9c20ae2fd0bf7544e7a68f22fd107cd44a5a86 [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace content {
class BrowserContext;
class GURL;
namespace extensions {
class Extension;
class ExtensionPrefs;
// Sets an extension pref to indicate whether the hosted app is locally
// installed or not. When apps are not locally installed they will appear in the
// app launcher, but will act like normal web pages when launched. For example
// they will never open in standalone windows. They will also have different
// commands available to them reflecting the fact that they aren't fully
// installed.
void SetBookmarkAppIsLocallyInstalled(content::BrowserContext* context,
const Extension* extension,
bool is_locally_installed);
// Gets whether the bookmark app is locally installed. Defaults to true if the
// extension pref that stores this isn't set.
// Note this can be called for hosted apps which should use the default.
bool BookmarkAppIsLocallyInstalled(content::BrowserContext* context,
const Extension* extension);
bool BookmarkAppIsLocallyInstalled(const ExtensionPrefs* prefs,
const Extension* extension);
// Returns true if a bookmark or hosted app from a given URL is already
// installed and enabled.
bool BookmarkOrHostedAppInstalled(content::BrowserContext* browser_context,
const GURL& url);
// Generates a scope based on |launch_url| and checks if the |url| falls under
// it.
bool IsInNavigationScopeForLaunchUrl(const GURL& launch_url, const GURL& url);
// Finds the first Shortcut App (a non-PWA Bookmark App) with |url| in its
// scope, returns nullptr if there are none.
const Extension* GetInstalledShortcutForUrl(
content::BrowserContext* browser_context,
const GURL& url);
// Count a number of all bookmark apps which are installed by user
// (non default-installed apps).
int CountUserInstalledBookmarkApps(content::BrowserContext* browser_context);
} // namespace extensions