2014-10-31 18:17:05 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc.
|
2014-04-25 09:49:37 +00:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
2013-07-04 07:54:34 +00:00
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2013-11-13 09:29:35 +00:00
|
|
|
#ifndef ATOM_COMMON_CRASH_REPORTER_CRASH_REPORTER_H_
|
|
|
|
#define ATOM_COMMON_CRASH_REPORTER_CRASH_REPORTER_H_
|
2013-07-04 07:54:34 +00:00
|
|
|
|
2013-11-14 10:02:15 +00:00
|
|
|
#include <map>
|
2013-07-04 07:54:34 +00:00
|
|
|
#include <string>
|
2015-06-03 03:31:34 +00:00
|
|
|
#include <utility>
|
2015-06-03 01:47:42 +00:00
|
|
|
#include <vector>
|
2013-07-04 07:54:34 +00:00
|
|
|
|
2016-10-05 20:31:16 +00:00
|
|
|
#include "base/files/file_path.h"
|
2016-03-08 04:38:49 +00:00
|
|
|
#include "base/macros.h"
|
2013-07-04 07:54:34 +00:00
|
|
|
|
|
|
|
namespace crash_reporter {
|
|
|
|
|
|
|
|
class CrashReporter {
|
|
|
|
public:
|
2013-11-18 10:27:50 +00:00
|
|
|
typedef std::map<std::string, std::string> StringMap;
|
2015-06-03 03:31:34 +00:00
|
|
|
typedef std::pair<int, std::string> UploadReportResult; // upload-date, id
|
2013-11-18 10:27:50 +00:00
|
|
|
|
2013-11-14 05:33:09 +00:00
|
|
|
static CrashReporter* GetInstance();
|
|
|
|
|
2013-11-19 04:19:23 +00:00
|
|
|
void Start(const std::string& product_name,
|
2013-11-14 05:33:09 +00:00
|
|
|
const std::string& company_name,
|
|
|
|
const std::string& submit_url,
|
2016-10-06 17:39:57 +00:00
|
|
|
const base::FilePath& crashes_dir,
|
2016-11-22 08:30:20 +00:00
|
|
|
bool upload_to_server,
|
2013-11-18 10:27:50 +00:00
|
|
|
bool skip_system_crash_handler,
|
|
|
|
const StringMap& extra_parameters);
|
2013-11-14 05:33:09 +00:00
|
|
|
|
2015-06-05 10:50:52 +00:00
|
|
|
virtual std::vector<CrashReporter::UploadReportResult> GetUploadedReports(
|
2016-10-06 17:39:57 +00:00
|
|
|
const base::FilePath& crashes_dir);
|
2016-10-05 23:15:49 +00:00
|
|
|
|
2016-11-22 08:30:20 +00:00
|
|
|
virtual void SetUploadToServer(bool upload_to_server);
|
|
|
|
virtual bool GetUploadToServer();
|
2016-11-08 00:18:49 +00:00
|
|
|
|
2013-11-14 05:33:09 +00:00
|
|
|
protected:
|
|
|
|
CrashReporter();
|
|
|
|
virtual ~CrashReporter();
|
|
|
|
|
|
|
|
virtual void InitBreakpad(const std::string& product_name,
|
|
|
|
const std::string& version,
|
|
|
|
const std::string& company_name,
|
|
|
|
const std::string& submit_url,
|
2016-10-06 17:39:57 +00:00
|
|
|
const base::FilePath& crashes_dir,
|
2016-11-22 08:30:20 +00:00
|
|
|
bool upload_to_server,
|
2015-09-28 06:52:55 +00:00
|
|
|
bool skip_system_crash_handler);
|
|
|
|
virtual void SetUploadParameters();
|
2013-11-14 05:33:09 +00:00
|
|
|
|
2013-11-14 10:02:15 +00:00
|
|
|
StringMap upload_parameters_;
|
2013-11-14 05:33:09 +00:00
|
|
|
bool is_browser_;
|
2013-07-04 07:54:34 +00:00
|
|
|
|
|
|
|
private:
|
2013-11-18 10:27:50 +00:00
|
|
|
void SetUploadParameters(const StringMap& parameters);
|
|
|
|
|
2013-11-14 05:33:09 +00:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(CrashReporter);
|
2013-07-04 07:54:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace crash_reporter
|
|
|
|
|
2013-11-13 09:29:35 +00:00
|
|
|
#endif // ATOM_COMMON_CRASH_REPORTER_CRASH_REPORTER_H_
|