chromium/chrome/enterprise_companion/global_constants.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_GLOBAL_CONSTANTS_H_
#define CHROME_ENTERPRISE_COMPANION_GLOBAL_CONSTANTS_H_

#include <optional>

#include "base/time/time.h"
#include "build/build_config.h"

#if BUILDFLAG(IS_WIN)
#include <string>
#endif

namespace base {
class FilePath;
}

class GURL;

namespace enterprise_companion {

// JSON keys for defining overrides. All values are expected to be strings
// unless otherwise noted.
extern const char kCrashUploadUrlKey[];
extern const char kDMEncryptedReportingUrlKey[];
extern const char kDMRealtimeReportingUrlKey[];
extern const char kDMServerUrlKey[];
extern const char kEventLoggingUrlKey[];
// The minimum timeout for the event logger's transmissions in integer seconds.
extern const char kEventLoggerMinTimeoutSecKey[];
#if BUILDFLAG(IS_WIN)
extern const char kNamedPipeSecurityDescriptorKey[];
#endif

// Constants for the application which may be overridden in test builds via a
// JSON file at the path returned by `GetOverridesFilePath`. See above for
// recognized keys.
class GlobalConstants {};

// Returns the path to the overrides JSON file.
std::optional<base::FilePath> GetOverridesFilePath();

// Returns the global constants singleton for the process. Initializes constants
// and applies overrides (in test builds) on the first invocation.
const GlobalConstants* GetGlobalConstants();

}  // namespace enterprise_companion

#endif  // CHROME_ENTERPRISE_COMPANION_GLOBAL_CONSTANTS_H_