skyostil | c3c9701 | 2017-02-15 10:37:27 | [diff] [blame] | 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/content/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 | |
| 21 | void set_crash_dumps_dir(const base::FilePath& dir) { |
| 22 | crash_dumps_dir_ = dir; |
| 23 | } |
| 24 | const base::FilePath& crash_dumps_dir() const { return crash_dumps_dir_; } |
| 25 | |
| 26 | #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 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 | base::FilePath GetReporterLogFilename() override; |
| 33 | #endif // defined(OS_POSIX) && !defined(OS_MACOSX) |
| 34 | |
| 35 | #if defined(OS_WIN) |
| 36 | bool GetCrashDumpLocation(base::string16* crash_dir) override; |
| 37 | #else |
| 38 | bool GetCrashDumpLocation(base::FilePath* crash_dir) override; |
| 39 | #endif |
| 40 | |
| 41 | bool EnableBreakpadForProcess(const std::string& process_type) override; |
| 42 | |
| 43 | private: |
| 44 | base::FilePath crash_dumps_dir_; |
| 45 | |
| 46 | DISALLOW_COPY_AND_ASSIGN(HeadlessCrashReporterClient); |
| 47 | }; |
| 48 | |
| 49 | } // namespace headless |
| 50 | |
| 51 | #endif // HEADLESS_LIB_HEADLESS_CRASH_REPORTER_CLIENT_H_ |