chromium/chrome/enterprise_companion/app/app.h

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

#ifndef CHROME_ENTERPRISE_COMPANION_APP_APP_H_
#define CHROME_ENTERPRISE_COMPANION_APP_APP_H_

#include <memory>

#include "build/build_config.h"
#include "chrome/enterprise_companion/enterprise_companion_client.h"
#include "chrome/enterprise_companion/enterprise_companion_status.h"
#include "chrome/enterprise_companion/installer.h"
#include "chrome/enterprise_companion/lock.h"
#include "mojo/public/cpp/platform/named_platform_channel.h"

namespace enterprise_companion {

class App {};

// Creates an App which runs the EnterpriseCompanion IPC server process.
std::unique_ptr<App> CreateAppServer();

// Creates an App which instructs the running server to exit, if present.
std::unique_ptr<App> CreateAppShutdown(
    const mojo::NamedPlatformChannel::ServerName& server_name =
        GetServerName());

// Creates an App which instructs the running server to fetch policies, if
// present.
std::unique_ptr<App> CreateAppFetchPolicies(
    const mojo::NamedPlatformChannel::ServerName& server_name =
        GetServerName());

std::unique_ptr<App> CreateAppInstall(
    base::OnceCallback<EnterpriseCompanionStatus()> shutdown_remote_task =
        base::BindOnce([] {};

#if BUILDFLAG(IS_MAC)
// Creates an App which handles network requests for another process. If
// the current process is running as root, the app will set the process' uid and
// gid to nobody.
std::unique_ptr<App> CreateAppNetWorker();
#endif

}  // namespace enterprise_companion

#endif  // CHROME_ENTERPRISE_COMPANION_APP_APP_H_