Commit 679613fc authored by Alan Cutter's avatar Alan Cutter Committed by Commit Bot

Remove unused GetInstalledShortcutForUrl()

Bug: 910016
Change-Id: I520e44ab252c8afd2523bc96077fe5e8c36efcf5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2043174
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Reviewed-by: default avatarGlen Robertson <glenrob@chromium.org>
Cr-Commit-Position: refs/heads/master@{#739298}
parent de100774
...@@ -65,26 +65,6 @@ bool IsInNavigationScopeForLaunchUrl(const GURL& launch_url, const GURL& url) { ...@@ -65,26 +65,6 @@ bool IsInNavigationScopeForLaunchUrl(const GURL& launch_url, const GURL& url) {
base::StringPiece(url.spec()).substr(0, scope_str_length); base::StringPiece(url.spec()).substr(0, scope_str_length);
} }
const Extension* GetInstalledShortcutForUrl(Profile* profile, const GURL& url) {
const ExtensionPrefs* prefs = ExtensionPrefs::Get(profile);
web_app::AppRegistrar& registrar =
web_app::WebAppProviderBase::GetProviderBase(profile)->registrar();
for (scoped_refptr<const Extension> app :
ExtensionRegistry::Get(profile)->enabled_extensions()) {
if (!app->from_bookmark())
continue;
if (!BookmarkAppIsLocallyInstalled(prefs, app.get()))
continue;
if (!registrar.IsShortcutApp(app->id()))
continue;
const GURL launch_url = AppLaunchInfo::GetLaunchWebURL(app.get());
if (IsInNavigationScopeForLaunchUrl(launch_url, url))
return app.get();
}
return nullptr;
}
int CountUserInstalledBookmarkApps(content::BrowserContext* browser_context) { int CountUserInstalledBookmarkApps(content::BrowserContext* browser_context) {
// To avoid data races and inaccurate counting, ensure that ExtensionSystem is // To avoid data races and inaccurate counting, ensure that ExtensionSystem is
// always ready at this point. // always ready at this point.
......
...@@ -14,7 +14,6 @@ class BrowserContext; ...@@ -14,7 +14,6 @@ class BrowserContext;
} }
class GURL; class GURL;
class Profile;
namespace extensions { namespace extensions {
...@@ -43,10 +42,6 @@ bool BookmarkAppIsLocallyInstalled(const ExtensionPrefs* prefs, ...@@ -43,10 +42,6 @@ bool BookmarkAppIsLocallyInstalled(const ExtensionPrefs* prefs,
// it. https://www.w3.org/TR/appmanifest/#navigation-scope // it. https://www.w3.org/TR/appmanifest/#navigation-scope
bool IsInNavigationScopeForLaunchUrl(const GURL& launch_url, const GURL& url); 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(Profile* profile, const GURL& url);
// Count a number of all bookmark apps which are installed by user // Count a number of all bookmark apps which are installed by user
// (non default-installed apps). // (non default-installed apps).
int CountUserInstalledBookmarkApps(content::BrowserContext* browser_context); int CountUserInstalledBookmarkApps(content::BrowserContext* browser_context);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment