#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/sequence_checker.h"
#include "base/threading/sequence_bound.h"
#include "chrome/enterprise_companion/app/app.h"
#include "chrome/enterprise_companion/dm_client.h"
#include "chrome/enterprise_companion/enterprise_companion_service.h"
#include "chrome/enterprise_companion/enterprise_companion_service_stub.h"
#include "chrome/enterprise_companion/enterprise_companion_status.h"
#include "chrome/enterprise_companion/event_logger.h"
#include "chrome/enterprise_companion/lock.h"
#include "chrome/enterprise_companion/mojom/enterprise_companion.mojom.h"
#include "chrome/enterprise_companion/url_loader_factory_provider.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#if !BUILDFLAG(IS_MAC)
#include "base/threading/thread.h"
#endif
#if BUILDFLAG(IS_WIN)
#include <windows.h>
#include <atlsecurity.h>
#include "chrome/updater/util/win_util.h"
#include "chrome/updater/win/scoped_handle.h"
#endif
namespace enterprise_companion {
namespace {
#if BUILDFLAG(IS_WIN)
bool IsSystemProcess() {
CAccessToken current_process_token;
if (!current_process_token.GetProcessToken(TOKEN_QUERY,
::GetCurrentProcess())) {
PLOG(ERROR) << "CAccessToken::GetProcessToken failed";
return false;
}
CSid logon_sid;
if (!current_process_token.GetUser(&logon_sid)) {
PLOG(ERROR) << "CAccessToken::GetUser failed";
return false;
}
return logon_sid == Sids::System();
}
#endif
class AppServer : public App { … };
}
std::unique_ptr<App> CreateAppServer() { … }
}