crash_reporter_mac.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Copyright (c) 2013 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ATOM_COMMON_CRASH_REPORTER_CRASH_REPORTER_MAC_H_
  5. #define ATOM_COMMON_CRASH_REPORTER_CRASH_REPORTER_MAC_H_
  6. #include <map>
  7. #include <string>
  8. #include <vector>
  9. #include "atom/common/crash_reporter/crash_reporter.h"
  10. #include "base/compiler_specific.h"
  11. #include "base/strings/string_piece.h"
  12. #include "crashpad/client/crash_report_database.h"
  13. #include "crashpad/client/simple_string_dictionary.h"
  14. namespace base {
  15. template <typename T>
  16. struct DefaultSingletonTraits;
  17. }
  18. namespace crash_reporter {
  19. class CrashReporterMac : public CrashReporter {
  20. public:
  21. static CrashReporterMac* GetInstance();
  22. void InitBreakpad(const std::string& product_name,
  23. const std::string& version,
  24. const std::string& company_name,
  25. const std::string& submit_url,
  26. const base::FilePath& crashes_dir,
  27. bool upload_to_server,
  28. bool skip_system_crash_handler) override;
  29. void SetUploadParameters() override;
  30. void SetUploadToServer(bool upload_to_server) override;
  31. bool GetUploadToServer() override;
  32. void AddExtraParameter(const std::string& key,
  33. const std::string& value) override;
  34. void RemoveExtraParameter(const std::string& key) override;
  35. std::map<std::string, std::string> GetParameters() const override;
  36. private:
  37. friend struct base::DefaultSingletonTraits<CrashReporterMac>;
  38. CrashReporterMac();
  39. ~CrashReporterMac() override;
  40. void SetUploadsEnabled(bool enable_uploads);
  41. void SetCrashKeyValue(const base::StringPiece& key,
  42. const base::StringPiece& value);
  43. std::vector<UploadReportResult> GetUploadedReports(
  44. const base::FilePath& crashes_dir) override;
  45. std::unique_ptr<crashpad::SimpleStringDictionary> simple_string_dictionary_;
  46. std::unique_ptr<crashpad::CrashReportDatabase> database_;
  47. DISALLOW_COPY_AND_ASSIGN(CrashReporterMac);
  48. };
  49. } // namespace crash_reporter
  50. #endif // ATOM_COMMON_CRASH_REPORTER_CRASH_REPORTER_MAC_H_