1 // Copyright 2013 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_APP_CHROME_CRASH_REPORTER_CLIENT_H_
6 #define CHROME_APP_CHROME_CRASH_REPORTER_CLIENT_H_
8 #include "build/build_config.h"
9 #include "build/chromeos_buildflags.h"
11 #if !BUILDFLAG(IS_WIN)
15 #include "base/no_destructor.h"
16 #include "components/crash/core/app/crash_reporter_client.h"
18 class ChromeCrashReporterClient : public crash_reporter::CrashReporterClient {
22 ChromeCrashReporterClient(const ChromeCrashReporterClient&) = delete;
23 ChromeCrashReporterClient& operator=(const ChromeCrashReporterClient&) =
26 #if BUILDFLAG(IS_CHROMEOS_ASH)
27 // If true, processes of this type should pass crash-loop-before down to the
28 // crash reporter and to their children (if the children's type is a process
29 // type that wants crash-loop-before).
30 static bool ShouldPassCrashLoopBefore(const std::string& process_type);
33 // crash_reporter::CrashReporterClient implementation.
34 #if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_ANDROID)
35 void SetCrashReporterClientIdFromGUID(
36 const std::string& client_guid) override;
39 #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
40 void GetProductNameAndVersion(const char** product_name,
41 const char** version) override;
42 void GetProductNameAndVersion(std::string* product_name,
44 std::string* channel) override;
45 base::FilePath GetReporterLogFilename() override;
47 bool GetShouldDumpLargerDumps() override;
50 bool GetCrashDumpLocation(base::FilePath* crash_dir) override;
52 #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
53 bool GetCrashMetricsLocation(base::FilePath* metrics_dir) override;
56 bool IsRunningUnattended() override;
58 bool GetCollectStatsConsent() override;
61 bool ReportingIsEnforcedByPolicy(bool* breakpad_enabled) override;
64 #if BUILDFLAG(IS_ANDROID)
65 int GetAndroidMinidumpDescriptor() override;
68 #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
69 bool ShouldMonitorCrashHandlerExpensively() override;
72 bool EnableBreakpadForProcess(const std::string& process_type) override;
75 friend class base::NoDestructor<ChromeCrashReporterClient>;
77 ChromeCrashReporterClient();
78 ~ChromeCrashReporterClient() override;
81 #endif // BUILDFLAG(IS_WIN)
83 #endif // CHROME_APP_CHROME_CRASH_REPORTER_CLIENT_H_