#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 {
[[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) { … }
class StateChangeObserverWrapper
: public base::RefCountedThreadSafe<StateChangeObserverWrapper> { … };
[[nodiscard]] std::pair<
base::RepeatingCallback<void(const UpdateService::UpdateState&)>,
base::OnceCallback<void(UpdateService::Result)>>
MakeStateChangeObserverCallbacks(
std::unique_ptr<mojo::Remote<mojom::StateChangeObserver>> observer) { … }
class UpdateServiceStubUntrusted : public mojom::UpdateService { … };
}
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)
: … { … }
}