chromium/chrome/updater/app/server/posix/update_service_stub.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/updater/app/server/posix/update_service_stub.h"

#include <iterator>
#include <memory>
#include <utility>
#include <vector>

#include "base/check.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_forward.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
#include "base/ranges/algorithm.h"
#include "base/sequence_checker.h"
#include "base/version.h"
#include "chrome/updater/app/server/posix/mojom/updater_service.mojom-forward.h"
#include "chrome/updater/ipc/ipc_names.h"
#include "chrome/updater/ipc/ipc_security.h"
#include "chrome/updater/registration_data.h"
#include "components/named_mojo_ipc_server/connection_info.h"
#include "components/named_mojo_ipc_server/endpoint_options.h"
#include "components/named_mojo_ipc_server/named_mojo_ipc_server.h"
#include "mojo/public/cpp/bindings/remote.h"

namespace updater {
namespace {

// Helper functions for converting between mojom types and their native
// counterparts.
[[nodiscard]] updater::RegistrationRequest MakeRegistrationRequest(
    const mojom::RegistrationRequestPtr& mojom) {}

[[nodiscard]] mojom::AppStatePtr MakeMojoAppState(
    const updater::UpdateService::AppState& app_state) {}

[[nodiscard]] mojom::UpdateStatePtr MakeMojoUpdateState(
    const updater::UpdateService::UpdateState& update_state) {}

// A thin wrapper around a StateChangeObserver remote to allow for refcounting.
class StateChangeObserverWrapper
    : public base::RefCountedThreadSafe<StateChangeObserverWrapper> {};

// Binds a callback that forwards state change callbacks and the OnComplete
// callback to a StateChangeObserver.
[[nodiscard]] std::pair<
    base::RepeatingCallback<void(const UpdateService::UpdateState&)>,
    base::OnceCallback<void(UpdateService::Result)>>
MakeStateChangeObserverCallbacks(
    std::unique_ptr<mojo::Remote<mojom::StateChangeObserver>> observer) {}

// UpdateServiceStubUntrusted only forwards certain safe calls to its underlying
// UpdateService.
class UpdateServiceStubUntrusted : public mojom::UpdateService {};

}  // namespace

UpdateServiceStub::UpdateServiceStub(scoped_refptr<updater::UpdateService> impl,
                                     UpdaterScope scope,
                                     base::RepeatingClosure task_start_listener,
                                     base::RepeatingClosure task_end_listener)
    :{}

UpdateServiceStub::~UpdateServiceStub() = default;

void UpdateServiceStub::GetVersion(GetVersionCallback callback) {}

void UpdateServiceStub::FetchPolicies(FetchPoliciesCallback callback) {}

void UpdateServiceStub::RegisterApp(mojom::RegistrationRequestPtr request,
                                    RegisterAppCallback callback) {}

void UpdateServiceStub::GetAppStates(GetAppStatesCallback callback) {}

void UpdateServiceStub::RunPeriodicTasks(RunPeriodicTasksCallback callback) {}

void UpdateServiceStub::UpdateAll(UpdateAllCallback callback) {}

void UpdateServiceStub::Update(
    const std::string& app_id,
    const std::string& install_data_index,
    UpdateService::Priority priority,
    UpdateService::PolicySameVersionUpdate policy_same_version_update,
    bool do_update_check_only,
    UpdateCallback callback) {}

void UpdateServiceStub::Install(mojom::RegistrationRequestPtr registration,
                                const std::string& client_install_data,
                                const std::string& install_data_index,
                                UpdateService::Priority priority,
                                InstallCallback callback) {}

void UpdateServiceStub::CancelInstalls(const std::string& app_id) {}

void UpdateServiceStub::RunInstaller(const std::string& app_id,
                                     const ::base::FilePath& installer_path,
                                     const std::string& install_args,
                                     const std::string& install_data,
                                     const std::string& install_settings,
                                     RunInstallerCallback callback) {}

void UpdateServiceStub::CheckForUpdate(
    const std::string& app_id,
    UpdateService::Priority priority,
    UpdateService::PolicySameVersionUpdate policy_same_version_update,
    UpdateCallback callback) {}

UpdateServiceStub::UpdateServiceStub(
    scoped_refptr<updater::UpdateService> impl,
    UpdaterScope scope,
    base::RepeatingClosure task_start_listener,
    base::RepeatingClosure task_end_listener,
    base::RepeatingClosure endpoint_created_listener_for_testing)
    :{}

}  // namespace updater