#include "chrome/browser/web_applications/test/fake_web_app_ui_manager.h"
#include <optional>
#include <utility>
#include "base/containers/contains.h"
#include "base/files/file_path.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/bind.h"
#include "chrome/browser/ui/web_applications/web_app_run_on_os_login_notification.h"
#include "chrome/browser/web_applications/web_app_callback_app_identity.h"
#include "components/services/app_service/public/cpp/app_launch_util.h"
#include "components/webapps/browser/uninstall_result_code.h"
namespace web_app {
FakeWebAppUiManager::FakeWebAppUiManager() = default;
FakeWebAppUiManager::~FakeWebAppUiManager() = default;
void FakeWebAppUiManager::Start() { … }
void FakeWebAppUiManager::Shutdown() { … }
void FakeWebAppUiManager::SetNumWindowsForApp(const webapps::AppId& app_id,
size_t num_windows_for_app) { … }
void FakeWebAppUiManager::SetOnNotifyOnAllAppWindowsClosedCallback(
base::RepeatingCallback<void(webapps::AppId)> callback) { … }
void FakeWebAppUiManager::SetOnLaunchWebAppCallback(
OnLaunchWebAppCallback callback) { … }
WebAppUiManagerImpl* FakeWebAppUiManager::AsImpl() { … }
size_t FakeWebAppUiManager::GetNumWindowsForApp(const webapps::AppId& app_id) { … }
void FakeWebAppUiManager::NotifyOnAllAppWindowsClosed(
const webapps::AppId& app_id,
base::OnceClosure callback) { … }
bool FakeWebAppUiManager::CanAddAppToQuickLaunchBar() const { … }
void FakeWebAppUiManager::AddAppToQuickLaunchBar(const webapps::AppId& app_id) { … }
bool FakeWebAppUiManager::IsAppInQuickLaunchBar(
const webapps::AppId& app_id) const { … }
bool FakeWebAppUiManager::IsInAppWindow(
content::WebContents* web_contents) const { … }
const webapps::AppId* FakeWebAppUiManager::GetAppIdForWindow(
const content::WebContents* web_contents) const { … }
bool FakeWebAppUiManager::CanReparentAppTabToWindow(
const webapps::AppId& app_id,
bool shortcut_created) const { … }
Browser* FakeWebAppUiManager::ReparentAppTabToWindow(
content::WebContents* contents,
const webapps::AppId& app_id,
bool shortcut_created) { … }
void FakeWebAppUiManager::ShowWebAppIdentityUpdateDialog(
const std::string& app_id,
bool title_change,
bool icon_change,
const std::u16string& old_title,
const std::u16string& new_title,
const SkBitmap& old_icon,
const SkBitmap& new_icon,
content::WebContents* web_contents,
AppIdentityDialogCallback callback) { … }
void FakeWebAppUiManager::LaunchWebApp(apps::AppLaunchParams params,
LaunchWebAppWindowSetting launch_setting,
Profile& profile,
LaunchWebAppDebugValueCallback callback,
WithAppResources& lock) { … }
void FakeWebAppUiManager::WaitForFirstRunService(
Profile& profile,
FirstRunServiceCompletedCallback callback) { … }
#if BUILDFLAG(IS_CHROMEOS)
void FakeWebAppUiManager::MigrateLauncherState(
const webapps::AppId& from_app_id,
const webapps::AppId& to_app_id,
base::OnceClosure callback) {
std::move(callback).Run();
}
void FakeWebAppUiManager::DisplayRunOnOsLoginNotification(
const base::flat_map<webapps::AppId,
WebAppUiManager::RoolNotificationBehavior>& apps,
base::WeakPtr<Profile> profile) {
web_app::DisplayRunOnOsLoginNotification(apps, std::move(profile));
}
#endif
void FakeWebAppUiManager::NotifyAppRelaunchState(
const webapps::AppId& placeholder_app_id,
const webapps::AppId& final_app_id,
const std::u16string& final_app_name,
base::WeakPtr<Profile> profile,
AppRelaunchState relaunch_state) { … }
content::WebContents* FakeWebAppUiManager::CreateNewTab() { … }
bool FakeWebAppUiManager::IsWebContentsActiveTabInBrowser(
content::WebContents* web_contents) { … }
void FakeWebAppUiManager::TriggerInstallDialog(
content::WebContents* web_contents) { … }
void FakeWebAppUiManager::PresentUserUninstallDialog(
const webapps::AppId& app_id,
webapps::WebappUninstallSource uninstall_source,
BrowserWindow* parent_window,
UninstallCompleteCallback callback) { … }
void FakeWebAppUiManager::PresentUserUninstallDialog(
const webapps::AppId& app_id,
webapps::WebappUninstallSource uninstall_source,
gfx::NativeWindow parent_window,
UninstallCompleteCallback callback) { … }
void FakeWebAppUiManager::PresentUserUninstallDialog(
const webapps::AppId& app_id,
webapps::WebappUninstallSource uninstall_source,
gfx::NativeWindow parent_window,
UninstallCompleteCallback callback,
UninstallScheduledCallback scheduled_callback) { … }
void FakeWebAppUiManager::LaunchOrFocusIsolatedWebAppInstaller(
const base::FilePath& bundle_path) { … }
void FakeWebAppUiManager::MaybeCreateEnableSupportedLinksInfobar(
content::WebContents* web_contents,
const std::string& launch_name) { … }
void FakeWebAppUiManager::MaybeShowIPHPromoForAppsLaunchedViaLinkCapturing(
content::WebContents* web_contents,
Profile* profile,
const std::string& app_id) { … }
}