#include "chrome/browser/ui/webui/app_management/web_app_settings_page_handler.h"
#include "base/notimplemented.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/apps/link_capturing/link_capturing_features.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/app_management/app_management_page_handler_base.h"
#include "chrome/browser/web_applications/app_service/web_app_publisher_helper.h"
#include "chrome/browser/web_applications/web_app_command_scheduler.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/url_formatter/elide_url.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "ui/webui/resources/cr_components/app_management/app_management.mojom.h"
#if BUILDFLAG(IS_WIN)
#include "base/win/default_apps_util.h"
#endif
#if BUILDFLAG(IS_MAC)
#include "base/mac/mac_util.h"
#include "chrome/browser/web_applications/os_integration/mac/web_app_shortcut_mac.h"
#endif
namespace {
std::vector<std::string> GetSupportedLinks(const std::string& app_id,
web_app::WebAppProvider& provider) { … }
std::string GetFormattedOrigin(const webapps::AppId& app_id,
web_app::WebAppProvider& provider) { … }
std::vector<std::string> GetScopeExtensions(const webapps::AppId& app_id,
web_app::WebAppProvider& provider) { … }
web_app::RunOnOsLoginMode ConvertOsLoginModeToWebAppConstants(
apps::RunOnOsLoginMode login_mode) { … }
}
WebAppSettingsPageHandler::WebAppSettingsPageHandler(
mojo::PendingReceiver<app_management::mojom::PageHandler> receiver,
mojo::PendingRemote<app_management::mojom::Page> page,
Profile* profile,
AppManagementPageHandlerBase::Delegate& delegate)
: … { … }
WebAppSettingsPageHandler::~WebAppSettingsPageHandler() = default;
void WebAppSettingsPageHandler::GetSubAppToParentMap(
GetSubAppToParentMapCallback callback) { … }
void WebAppSettingsPageHandler::GetExtensionAppPermissionMessages(
const std::string& app_id,
GetExtensionAppPermissionMessagesCallback callback) { … }
void WebAppSettingsPageHandler::SetPinned(const std::string& app_id,
bool pinned) { … }
void WebAppSettingsPageHandler::SetResizeLocked(const std::string& app_id,
bool locked) { … }
void WebAppSettingsPageHandler::Uninstall(const std::string& app_id) { … }
void WebAppSettingsPageHandler::SetPreferredApp(const std::string& app_id,
bool is_preferred_app) { … }
void WebAppSettingsPageHandler::GetOverlappingPreferredApps(
const std::string& app_id,
GetOverlappingPreferredAppsCallback callback) { … }
void WebAppSettingsPageHandler::UpdateAppSize(const std::string& app_id) { … }
void WebAppSettingsPageHandler::SetWindowMode(const std::string& app_id,
apps::WindowMode window_mode) { … }
void WebAppSettingsPageHandler::SetRunOnOsLoginMode(
const std::string& app_id,
apps::RunOnOsLoginMode run_on_os_login_mode) { … }
void WebAppSettingsPageHandler::ShowDefaultAppAssociationsUi() { … }
void WebAppSettingsPageHandler::OpenStorePage(const std::string& app_id) { … }
void WebAppSettingsPageHandler::SetAppLocale(const std::string& app_id,
const std::string& locale_tag) { … }
#if BUILDFLAG(IS_MAC)
void WebAppSettingsPageHandler::OpenSystemNotificationSettings(
const std::string& app_id) {
base::mac::OpenSystemSettingsPane(
base::mac::SystemSettingsPane::kNotifications,
web_app::GetBundleIdentifierForShim(app_id));
}
#endif
void WebAppSettingsPageHandler::OnAppRegistrarDestroyed() { … }
void WebAppSettingsPageHandler::OnWebAppFileHandlerApprovalStateChanged(
const webapps::AppId& app_id) { … }
void WebAppSettingsPageHandler::OnWebAppUserLinkCapturingPreferencesChanged(
const webapps::AppId& app_id,
bool is_preferred) { … }
app_management::mojom::AppPtr WebAppSettingsPageHandler::CreateApp(
const std::string& app_id) { … }