#include "chrome/browser/ui/views/web_apps/isolated_web_apps/isolated_web_app_installer_view_controller.h"
#include <memory>
#include <optional>
#include <string>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/time/time.h"
#include "base/uuid.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/views/web_apps/isolated_web_apps/callback_delayer.h"
#include "chrome/browser/ui/views/web_apps/isolated_web_apps/isolated_web_app_installer_model.h"
#include "chrome/browser/ui/views/web_apps/isolated_web_apps/isolated_web_app_installer_view.h"
#include "chrome/browser/ui/views/web_apps/isolated_web_apps/pref_observer.h"
#include "chrome/browser/web_applications/isolated_web_apps/install_isolated_web_app_command.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_install_source.h"
#include "chrome/browser/web_applications/isolated_web_apps/signed_web_bundle_metadata.h"
#include "chrome/browser/web_applications/web_app_command_scheduler.h"
#include "chrome/browser/web_applications/web_app_install_info.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/grit/generated_resources.h"
#include "components/strings/grit/components_strings.h"
#include "components/webapps/common/web_app_id.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/mojom/ui_base_types.mojom-shared.h"
#include "ui/base/ui_base_types.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/strings/grit/ui_strings.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
#include "ui/views/window/dialog_delegate.h"
#if BUILDFLAG(IS_CHROMEOS)
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "components/services/app_service/public/cpp/app_launch_util.h"
#include "ui/events/event_constants.h"
#else
#include "base/command_line.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/public/cpp/shelf_item.h"
#include "ash/public/cpp/shelf_model.h"
#include "ash/public/cpp/shelf_types.h"
#include "ash/webui/settings/public/constants/routes.mojom.h"
#include "chrome/browser/ui/ash/shelf/isolated_web_app_installer_shelf_item_controller.h"
#include "chrome/browser/ui/settings_window_manager_chromeos.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "ash/webui/settings/public/constants/routes.mojom.h"
#include "chrome/browser/ui/lacros/window_utility.h"
#include "chrome/common/webui_url_constants.h"
#include "chromeos/crosapi/mojom/lacros_shelf_item_tracker.mojom.h"
#include "chromeos/crosapi/mojom/url_handler.mojom.h"
#include "chromeos/lacros/lacros_service.h"
#include "url/gurl.h"
#endif
namespace web_app {
namespace {
constexpr base::TimeDelta kGetMetadataMinimumDelay = …;
constexpr base::TimeDelta kInstallationMinimumDelay = …;
constexpr double kProgressBarPausePercentage = …;
class OnCompleteDialogDelegate : public views::DialogDelegate { … };
std::string CreateRandomInstanceId() { … }
}
struct IsolatedWebAppInstallerViewController::InstallabilityCheckedVisitor { … };
IsolatedWebAppInstallerViewController::IsolatedWebAppInstallerViewController(
Profile* profile,
WebAppProvider* web_app_provider,
IsolatedWebAppInstallerModel* model,
std::unique_ptr<IsolatedWebAppsEnabledPrefObserver> pref_observer)
: … { … }
IsolatedWebAppInstallerViewController::
~IsolatedWebAppInstallerViewController() { … }
void IsolatedWebAppInstallerViewController::Start(
base::OnceClosure initialized_callback,
base::OnceClosure completion_callback) { … }
void IsolatedWebAppInstallerViewController::AddOrUpdateWindowToShelf() { … }
void IsolatedWebAppInstallerViewController::SetIcon(gfx::ImageSkia icon) { … }
void IsolatedWebAppInstallerViewController::SetViewForTesting(
IsolatedWebAppInstallerView* view) { … }
views::Widget* IsolatedWebAppInstallerViewController::GetWidgetForTesting() { … }
views::Widget*
IsolatedWebAppInstallerViewController::GetChildWidgetForTesting() { … }
void IsolatedWebAppInstallerViewController::Show() { … }
void IsolatedWebAppInstallerViewController::FocusWindow() { … }
bool IsolatedWebAppInstallerViewController::OnAcceptWrapper(
base::WeakPtr<IsolatedWebAppInstallerViewController> controller) { … }
bool IsolatedWebAppInstallerViewController::OnAccept() { … }
void IsolatedWebAppInstallerViewController::OnComplete() { … }
void IsolatedWebAppInstallerViewController::Close() { … }
void IsolatedWebAppInstallerViewController::OnPrefChanged(bool enabled) { … }
void IsolatedWebAppInstallerViewController::OnGetMetadataProgressUpdated(
double progress) { … }
void IsolatedWebAppInstallerViewController::OnInstallabilityChecked(
InstallabilityChecker::Result result) { … }
void IsolatedWebAppInstallerViewController::OnInstallProgressUpdated(
double progress) { … }
void IsolatedWebAppInstallerViewController::OnInstallComplete(
base::expected<InstallIsolatedWebAppCommandSuccess,
InstallIsolatedWebAppCommandError> result) { … }
void IsolatedWebAppInstallerViewController::OnShowMetadataLearnMoreClicked() { … }
void IsolatedWebAppInstallerViewController::OnSettingsLinkClicked() { … }
void IsolatedWebAppInstallerViewController::OnChildDialogCanceled() { … }
void IsolatedWebAppInstallerViewController::OnChildDialogAccepted() { … }
void IsolatedWebAppInstallerViewController::OnChildDialogDestroying() { … }
void IsolatedWebAppInstallerViewController::OnStepChanged() { … }
void IsolatedWebAppInstallerViewController::OnChildDialogChanged() { … }
std::unique_ptr<views::DialogDelegate>
IsolatedWebAppInstallerViewController::CreateDialogDelegate(
std::unique_ptr<views::View> contents_view) { … }
}