blob: 0c91f5994d14d66b0ea5ef19816148bd1fc65eb1 [file] [log] [blame]
// Copyright 2019 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.
#include "base/callback_forward.h"
#include "chrome/browser/web_applications/components/web_app_helpers.h"
enum class WebappInstallSource;
class Browser;
namespace content {
class WebContents;
namespace web_app {
enum class InstallResultCode;
// TODO(loyso): Rework these functions (API) once BookmarkAppHelper erased.
// Returns true if a WebApp installation is allowed for the current page.
bool CanCreateWebApp(const Browser* browser);
// Initiates install of a WebApp for the current page.
void CreateWebAppFromCurrentWebContents(Browser* browser,
bool force_shortcut_app);
using WebAppInstalledCallback =
base::OnceCallback<void(const AppId& app_id, InstallResultCode code)>;
// Starts install of a WebApp for a given |web_contents|, initiated from
// a promotional banner or omnibox install icon.
// Returns false if WebApps are disabled for the profile behind |web_contents|.
bool CreateWebAppFromManifest(content::WebContents* web_contents,
WebappInstallSource install_source,
WebAppInstalledCallback installed_callback);
void SetInstalledCallbackForTesting(WebAppInstalledCallback callback);
} // namespace web_app