Add StartInstance helper on CrashReporter

This commit is contained in:
Kevin Sawicki 2017-01-24 13:53:05 -08:00
parent 170c51ae85
commit 795b674996
5 changed files with 28 additions and 32 deletions

View file

@ -23,25 +23,6 @@ CrashReporter::CrashReporter() {
CrashReporter::~CrashReporter() {
}
void CrashReporter::StartWithOptions(const mate::Dictionary& options) {
std::string product_name;
options.Get("productName", &product_name);
std::string company_name;
options.Get("companyName", &company_name);
std::string submit_url;
options.Get("submitURL", &submit_url);
base::FilePath crashes_dir;
options.Get("crashesDirectory", &crashes_dir);
StringMap extra_parameters;
options.Get("extra", &extra_parameters);
extra_parameters["_productName"] = product_name;
extra_parameters["_companyName"] = company_name;
Start(product_name, company_name, submit_url, crashes_dir, true, false,
extra_parameters);
}
void CrashReporter::Start(const std::string& product_name,
const std::string& company_name,
const std::string& submit_url,
@ -113,4 +94,27 @@ CrashReporter* CrashReporter::GetInstance() {
}
#endif
void CrashReporter::StartInstance(const mate::Dictionary& options) {
auto reporter = GetInstance();
if (!reporter) return;
std::string product_name;
options.Get("productName", &product_name);
std::string company_name;
options.Get("companyName", &company_name);
std::string submit_url;
options.Get("submitURL", &submit_url);
base::FilePath crashes_dir;
options.Get("crashesDirectory", &crashes_dir);
StringMap extra_parameters;
options.Get("extra", &extra_parameters);
extra_parameters["_productName"] = product_name;
extra_parameters["_companyName"] = company_name;
reporter->Start(product_name, company_name, submit_url, crashes_dir, true,
false, extra_parameters);
}
} // namespace crash_reporter