chromium/chrome/browser/web_applications/isolated_web_apps/isolated_web_app_installation_manager.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/web_applications/isolated_web_apps/isolated_web_app_installation_manager.h"

#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>

#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/overloaded.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/strcat.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/types/expected.h"
#include "base/types/expected_macros.h"
#include "chrome/browser/profiles/keep_alive/profile_keep_alive_types.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/web_applications/extensions_manager.h"
#include "chrome/browser/web_applications/isolated_web_apps/garbage_collect_storage_partitions_command.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_features.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_install_source.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_source.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_url_info.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_provider.h"
#include "chrome/browser/web_applications/web_app_utils.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "components/keep_alive_registry/keep_alive_registry.h"
#include "components/keep_alive_registry/keep_alive_types.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_thread.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace web_app {

namespace {

MaybeIwaInstallSource;

void OnGetBundlePathFromCommandLine(
    base::OnceCallback<void(MaybeIwaInstallSource)> callback,
    MaybeIwaInstallSource proxy_url,
    MaybeIwaInstallSource bundle_path) {}

void GetBundlePathFromCommandLine(
    const base::CommandLine& command_line,
    base::OnceCallback<void(MaybeIwaInstallSource)> callback) {}

base::expected<url::Origin, std::string> ValidateProxyOrigin(const GURL& gurl) {}

MaybeIwaInstallSource GetProxyUrlFromCommandLine(
    const base::CommandLine& command_line) {}

}  // namespace

IsolatedWebAppInstallationManager::IsolatedWebAppInstallationManager(
    Profile& profile)
    :{}

IsolatedWebAppInstallationManager::~IsolatedWebAppInstallationManager() =
    default;

void IsolatedWebAppInstallationManager::SetProvider(
    base::PassKey<WebAppProvider>,
    WebAppProvider& provider) {}

void IsolatedWebAppInstallationManager::Start() {}

void IsolatedWebAppInstallationManager::InstallIsolatedWebAppFromDevModeProxy(
    const GURL& gurl,
    InstallSurface install_surface,
    base::OnceCallback<void(MaybeInstallIsolatedWebAppCommandSuccess)>
        callback) {}

void IsolatedWebAppInstallationManager::InstallIsolatedWebAppFromDevModeBundle(
    const base::FilePath& path,
    InstallSurface install_surface,
    base::OnceCallback<void(MaybeInstallIsolatedWebAppCommandSuccess)>
        callback) {}

// static
bool IsolatedWebAppInstallationManager::HasIwaInstallSwitch(
    const base::CommandLine& command_line) {}

// static
void IsolatedWebAppInstallationManager::MaybeInstallIwaFromCommandLine(
    const base::CommandLine& command_line,
    Profile& profile) {}

// static
void IsolatedWebAppInstallationManager::
    GetIsolatedWebAppInstallSourceFromCommandLine(
        const base::CommandLine& command_line,
        base::OnceCallback<void(MaybeIwaInstallSource)> callback) {}

// static
IsolatedWebAppInstallSource
IsolatedWebAppInstallationManager::CreateInstallSource(
    absl::variant<base::FilePath, url::Origin> source,
    InstallSurface surface) {}

void IsolatedWebAppInstallationManager::InstallFromCommandLine(
    const base::CommandLine& command_line,
    std::unique_ptr<ScopedKeepAlive> keep_alive,
    std::unique_ptr<ScopedProfileKeepAlive> optional_profile_keep_alive,
    base::TaskPriority task_priority) {}

void IsolatedWebAppInstallationManager::InstallIsolatedWebAppFromInstallSource(
    MaybeIwaInstallSource install_source,
    base::OnceCallback<void(MaybeInstallIsolatedWebAppCommandSuccess)>
        callback) {}

void IsolatedWebAppInstallationManager::InstallIsolatedWebAppFromInstallSource(
    std::unique_ptr<ScopedKeepAlive> keep_alive,
    std::unique_ptr<ScopedProfileKeepAlive> optional_profile_keep_alive,
    MaybeIwaInstallSource install_source,
    base::OnceCallback<void(MaybeInstallIsolatedWebAppCommandSuccess)>
        callback) {}

void IsolatedWebAppInstallationManager::
    OnGetIsolatedWebAppInstallSourceFromCommandLine(
        std::unique_ptr<ScopedKeepAlive> keep_alive,
        std::unique_ptr<ScopedProfileKeepAlive> optional_profile_keep_alive,
        MaybeIwaInstallSource install_source) {}

void IsolatedWebAppInstallationManager::OnGetIsolatedWebAppUrlInfo(
    std::unique_ptr<ScopedKeepAlive> keep_alive,
    std::unique_ptr<ScopedProfileKeepAlive> optional_profile_keep_alive,
    const IsolatedWebAppInstallSource& install_source,
    base::OnceCallback<void(MaybeInstallIsolatedWebAppCommandSuccess)> callback,
    base::expected<IsolatedWebAppUrlInfo, std::string> url_info) {}

void IsolatedWebAppInstallationManager::OnInstallIsolatedWebApp(
    base::OnceCallback<void(MaybeInstallIsolatedWebAppCommandSuccess)> callback,
    base::expected<InstallIsolatedWebAppCommandSuccess,
                   InstallIsolatedWebAppCommandError> result) {}

void IsolatedWebAppInstallationManager::ReportInstallationResult(
    MaybeInstallIsolatedWebAppCommandSuccess result) {}

void IsolatedWebAppInstallationManager::MaybeScheduleGarbageCollection() {}

}  // namespace web_app