1 // Copyright 2017 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef HEADLESS_LIB_HEADLESS_CRASH_REPORTER_CLIENT_H_ 6 #define HEADLESS_LIB_HEADLESS_CRASH_REPORTER_CLIENT_H_ 7 8 #include "base/files/file_path.h" 9 #include "base/macros.h" 10 #include "base/strings/string16.h" 11 #include "build/build_config.h" 12 #include "components/crash/core/app/crash_reporter_client.h" 13 14 namespace headless { 15 16 class HeadlessCrashReporterClient : public crash_reporter::CrashReporterClient { 17 public: 18 HeadlessCrashReporterClient(); 19 ~HeadlessCrashReporterClient() override; 20 set_crash_dumps_dir(const base::FilePath & dir)21 void set_crash_dumps_dir(const base::FilePath& dir) { 22 crash_dumps_dir_ = dir; 23 } crash_dumps_dir()24 const base::FilePath& crash_dumps_dir() const { return crash_dumps_dir_; } 25 26 #if defined(OS_POSIX) && !defined(OS_MAC) 27 // Returns a textual description of the product type and version to include 28 // in the crash report. 29 void GetProductNameAndVersion(const char** product_name, 30 const char** version) override; 31 32 void GetProductNameAndVersion(std::string* product_name, 33 std::string* version, 34 std::string* channel) override; 35 36 base::FilePath GetReporterLogFilename() override; 37 #endif // defined(OS_POSIX) && !defined(OS_MAC) 38 39 #if defined(OS_WIN) 40 bool GetCrashDumpLocation(base::string16* crash_dir) override; 41 #else 42 bool GetCrashDumpLocation(base::FilePath* crash_dir) override; 43 #endif 44 45 bool EnableBreakpadForProcess(const std::string& process_type) override; 46 47 private: 48 base::FilePath crash_dumps_dir_; 49 50 DISALLOW_COPY_AND_ASSIGN(HeadlessCrashReporterClient); 51 }; 52 53 } // namespace headless 54 55 #endif // HEADLESS_LIB_HEADLESS_CRASH_REPORTER_CLIENT_H_ 56