#include "chrome/enterprise_companion/crash_client.h"
#include <cstddef>
#include <cstdint>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include "base/base_paths.h"
#include "base/check.h"
#include "base/command_line.h"
#include "base/debug/dump_without_crashing.h"
#include "base/environment.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/no_destructor.h"
#include "base/path_service.h"
#include "base/sequence_checker.h"
#include "chrome/enterprise_companion/enterprise_companion.h"
#include "chrome/enterprise_companion/enterprise_companion_branding.h"
#include "chrome/enterprise_companion/enterprise_companion_client.h"
#include "chrome/enterprise_companion/enterprise_companion_version.h"
#include "chrome/enterprise_companion/global_constants.h"
#include "chrome/enterprise_companion/installer_paths.h"
#include "third_party/crashpad/crashpad/client/crash_report_database.h"
#include "third_party/crashpad/crashpad/client/crashpad_client.h"
#include "third_party/crashpad/crashpad/client/crashpad_info.h"
#include "third_party/crashpad/crashpad/client/settings.h"
#include "third_party/crashpad/crashpad/client/simulate_crash.h"
#include "third_party/crashpad/crashpad/handler/handler_main.h"
#include "third_party/crashpad/crashpad/util/misc/tri_state.h"
#include "url/gurl.h"
#if BUILDFLAG(IS_WIN)
#include <windows.h>
#include <iterator>
#include "base/ranges/algorithm.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/wrapped_window_proc.h"
namespace {
int __cdecl HandleWinProcException(EXCEPTION_POINTERS* exception_pointers) {
crashpad::CrashpadClient::DumpAndCrash(exception_pointers);
return EXCEPTION_CONTINUE_SEARCH;
}
}
#endif
namespace enterprise_companion {
namespace {
constexpr char kNoRateLimitSwitch[] = …;
constexpr char kUsageStatsEnabledEnvVar[] = …;
constexpr char kUsageStatsEnabledEnvVarValueEnabled[] = …;
#if BUILDFLAG(IS_MAC)
constexpr char kResetCrashHandlerPortSwitch[] =
"reset-own-crash-exception-port-to-system-default";
#endif
bool ShouldEnableCrashUploads() { … }
std::vector<std::string> MakeCrashHandlerArgs() { … }
class CrashClient { … };
}
std::optional<base::FilePath> GetDefaultCrashDatabasePath() { … }
bool InitializeCrashReporting(
std::optional<base::FilePath> crash_database_path) { … }
int CrashReporterMain() { … }
}