#include "chrome/browser/ui/web_applications/web_app_dialog_utils.h"
#include <memory>
#include <utility>
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/no_destructor.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/web_applications/web_app_dialogs.h"
#include "chrome/browser/web_applications/mojom/user_display_mode.mojom.h"
#include "chrome/browser/web_applications/web_app_command_manager.h"
#include "chrome/browser/web_applications/web_app_command_scheduler.h"
#include "chrome/browser/web_applications/web_app_constants.h"
#include "chrome/browser/web_applications/web_app_helpers.h"
#include "chrome/browser/web_applications/web_app_install_info.h"
#include "chrome/browser/web_applications/web_app_install_manager.h"
#include "chrome/browser/web_applications/web_app_install_params.h"
#include "chrome/browser/web_applications/web_app_install_utils.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/browser/web_applications/web_app_utils.h"
#include "chrome/common/chrome_features.h"
#include "components/webapps/browser/banners/app_banner_manager.h"
#include "components/webapps/browser/banners/web_app_banner_data.h"
#include "components/webapps/browser/features.h"
#include "components/webapps/browser/installable/installable_data.h"
#include "components/webapps/browser/installable/installable_metrics.h"
#include "components/webapps/browser/installable/ml_install_operation_tracker.h"
#include "components/webapps/browser/installable/ml_installability_promoter.h"
#include "content/public/browser/navigation_entry.h"
#if BUILDFLAG(IS_CHROMEOS)
#include "components/metrics/structured/structured_events.h"
#include "components/metrics/structured/structured_metrics_client.h"
#endif
namespace web_app {
namespace {
#if BUILDFLAG(IS_CHROMEOS)
namespace cros_events = metrics::structured::events::v2::cr_os_events;
#endif
void OnWebAppInstallShowInstallDialog(
WebAppInstallFlow flow,
webapps::WebappInstallSource install_source,
PwaInProductHelpState iph_state,
std::unique_ptr<webapps::MlInstallOperationTracker> install_tracker,
std::vector<webapps::Screenshot> screenshots,
content::WebContents* initiator_web_contents,
std::unique_ptr<WebAppInstallInfo> web_app_info,
WebAppInstallationAcceptanceCallback web_app_acceptance_callback) { … }
WebAppInstalledCallback& GetInstalledCallbackForTesting() { … }
void OnWebAppInstalled(WebAppInstalledCallback callback,
const webapps::AppId& installed_app_id,
webapps::InstallResultCode code) { … }
}
bool CanCreateWebApp(const Browser* browser) { … }
bool CanPopOutWebApp(Profile* profile) { … }
void CreateWebAppFromCurrentWebContents(Browser* browser,
WebAppInstallFlow flow) { … }
bool CreateWebAppFromManifest(content::WebContents* web_contents,
webapps::WebappInstallSource install_source,
WebAppInstalledCallback installed_callback,
PwaInProductHelpState iph_state) { … }
void SetInstalledCallbackForTesting(WebAppInstalledCallback callback) { … }
}