chromium/chrome/browser/ui/webui/app_home/app_home_page_handler.cc

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/webui/app_home/app_home_page_handler.h"

#include "base/check_deref.h"
#include "base/containers/flat_set.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ref.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/apps/app_service/app_icon_source.h"
#include "chrome/browser/apps/app_service/app_launch_params.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/app_service/browser_app_launcher.h"
#include "chrome/browser/extensions/bookmark_app_util.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_ui_util.h"
#include "chrome/browser/extensions/launch_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/apps/app_info_dialog.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/extensions/extension_enable_flow.h"
#include "chrome/browser/ui/tab_dialogs.h"
#include "chrome/browser/ui/webui/app_home/app_home.mojom-shared.h"
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
#include "chrome/browser/web_applications/extension_status_utils.h"
#include "chrome/browser/web_applications/locks/app_lock.h"
#include "chrome/browser/web_applications/mojom/user_display_mode.mojom.h"
#include "chrome/browser/web_applications/proto/web_app_install_state.pb.h"
#include "chrome/browser/web_applications/web_app.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_provider.h"
#include "chrome/browser/web_applications/web_app_registrar.h"
#include "chrome/browser/web_applications/web_app_sync_bridge.h"
#include "chrome/browser/web_applications/web_app_ui_manager.h"
#include "chrome/browser/web_applications/web_app_utils.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_metrics.h"
#include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
#include "chrome/grit/generated_resources.h"
#include "components/webapps/browser/uninstall_result_code.h"
#include "content/public/browser/web_ui.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "net/base/url_util.h"
#include "third_party/blink/public/mojom/manifest/display_mode.mojom-shared.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/window_open_disposition_utils.h"
#include "url/gurl.h"

static_assert;

WebUI;
Extension;
ExtensionRegistry;
ExtensionSet;

namespace webapps {

namespace {

const int kWebAppIconSize =;

// Query string for showing the deprecation dialog with deletion options.
const char kDeprecationDialogQueryString[] =;
// Query string for showing the force installed apps deprecation dialog.
// Should match with kChromeUIAppsWithForceInstalledDeprecationDialogURL.
const char kForceInstallDialogQueryString[] =;

// The Youtube app is incorrectly hardcoded to be a 'bookmark app'. However, it
// is a platform app.
// TODO(crbug.com/40124309): Remove this hack once the youtube app is fixed.
bool IsYoutubeExtension(const std::string& extension_id) {}

}  // namespace

AppHomePageHandler::AppHomePageHandler(
    content::WebUI* web_ui,
    Profile* profile,
    mojo::PendingReceiver<app_home::mojom::PageHandler> receiver,
    mojo::PendingRemote<app_home::mojom::Page> page)
    :{}

AppHomePageHandler::~AppHomePageHandler() {}

Browser* AppHomePageHandler::GetCurrentBrowser() {}

void AppHomePageHandler::LoadDeprecatedAppsDialogIfRequired() {}

void AppHomePageHandler::LaunchAppInternal(
    const std::string& app_id,
    extension_misc::AppLaunchBucket launch_bucket,
    app_home::mojom::ClickEventPtr click_event) {}

void AppHomePageHandler::SetUserDisplayMode(
    const std::string& app_id,
    web_app::mojom::UserDisplayMode user_display_mode) {}

app_home::mojom::AppInfoPtr AppHomePageHandler::GetApp(
    const webapps::AppId& app_id) {}

void AppHomePageHandler::ShowWebAppSettings(const std::string& app_id) {}

void AppHomePageHandler::ShowExtensionAppSettings(
    const extensions::Extension* extension) {}

void AppHomePageHandler::CreateWebAppShortcut(const std::string& app_id,
                                              base::OnceClosure done) {}

void AppHomePageHandler::CreateExtensionAppShortcut(
    const extensions::Extension* extension,
    base::OnceClosure done) {}

app_home::mojom::AppInfoPtr AppHomePageHandler::CreateAppInfoPtrFromWebApp(
    const webapps::AppId& app_id) {}

app_home::mojom::AppInfoPtr AppHomePageHandler::CreateAppInfoPtrFromExtension(
    const Extension* extension) {}

void AppHomePageHandler::FillWebAppInfoList(
    std::vector<app_home::mojom::AppInfoPtr>* result) {}

void AppHomePageHandler::FillExtensionInfoList(
    std::vector<app_home::mojom::AppInfoPtr>* result) {}

void AppHomePageHandler::OnExtensionUninstallDialogClosed(
    bool did_start_uninstall,
    const std::u16string& error) {}

void AppHomePageHandler::ResetExtensionDialogState() {}

void AppHomePageHandler::UninstallWebApp(const std::string& web_app_id) {}

extensions::ExtensionUninstallDialog*
AppHomePageHandler::CreateExtensionUninstallDialog() {}

void AppHomePageHandler::UninstallExtensionApp(const Extension* extension) {}

void AppHomePageHandler::ExtensionRemoved(const Extension* extension) {}

void AppHomePageHandler::OnWebAppWillBeUninstalled(
    const webapps::AppId& app_id) {}

void AppHomePageHandler::OnWebAppInstalled(const webapps::AppId& app_id) {}

void AppHomePageHandler::OnWebAppInstallManagerDestroyed() {}

void AppHomePageHandler::OnExtensionLoaded(
    content::BrowserContext* browser_context,
    const extensions::Extension* extension) {}

void AppHomePageHandler::OnExtensionUnloaded(
    content::BrowserContext* browser_context,
    const Extension* extension,
    extensions::UnloadedExtensionReason reason) {}

void AppHomePageHandler::OnExtensionUninstalled(
    content::BrowserContext* browser_context,
    const Extension* extension,
    extensions::UninstallReason reason) {}

void AppHomePageHandler::PromptToEnableExtensionApp(
    const std::string& extension_app_id) {}

void AppHomePageHandler::ExtensionEnableFlowFinished() {}

void AppHomePageHandler::ExtensionEnableFlowAborted(bool user_initiated) {}

void AppHomePageHandler::GetApps(GetAppsCallback callback) {}

void AppHomePageHandler::GetDeprecationLinkString(
    GetDeprecationLinkStringCallback callback) {}

void AppHomePageHandler::OnWebAppRunOnOsLoginModeChanged(
    const webapps::AppId& app_id,
    web_app::RunOnOsLoginMode run_on_os_login_mode) {}

void AppHomePageHandler::OnWebAppUserDisplayModeChanged(
    const webapps::AppId& app_id,
    web_app::mojom::UserDisplayMode user_display_mode) {}

void AppHomePageHandler::OnWebAppInstalledWithOsHooks(
    const webapps::AppId& app_id) {}

void AppHomePageHandler::OnAppRegistrarDestroyed() {}

void AppHomePageHandler::UninstallApp(const std::string& app_id) {}

void AppHomePageHandler::ShowAppSettings(const std::string& app_id) {}

void AppHomePageHandler::CreateAppShortcut(const std::string& app_id,
                                           CreateAppShortcutCallback callback) {}

void AppHomePageHandler::LaunchApp(const std::string& app_id,
                                   app_home::mojom::ClickEventPtr click_event) {}

void AppHomePageHandler::SetRunOnOsLoginMode(
    const std::string& app_id,
    web_app::RunOnOsLoginMode run_on_os_login_mode) {}

void AppHomePageHandler::LaunchDeprecatedAppDialog() {}

void AppHomePageHandler::InstallAppLocally(const std::string& app_id) {}

}  // namespace webapps