2013-11-14 05:33:09 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
2014-04-25 09:49:37 +00:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
2013-11-14 05:33:09 +00:00
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2014-03-16 00:30:26 +00:00
|
|
|
#include "atom/common/crash_reporter/crash_reporter.h"
|
2013-11-14 05:33:09 +00:00
|
|
|
|
2014-03-16 00:30:26 +00:00
|
|
|
#include "atom/browser/browser.h"
|
|
|
|
#include "atom/common/atom_version.h"
|
2014-03-16 01:37:04 +00:00
|
|
|
#include "base/command_line.h"
|
2013-11-14 05:33:09 +00:00
|
|
|
#include "content/public/common/content_switches.h"
|
|
|
|
|
|
|
|
namespace crash_reporter {
|
|
|
|
|
|
|
|
CrashReporter::CrashReporter() {
|
2013-11-18 10:27:50 +00:00
|
|
|
const CommandLine& command = *CommandLine::ForCurrentProcess();
|
|
|
|
is_browser_ = command.GetSwitchValueASCII(switches::kProcessType).empty();
|
2013-11-14 05:33:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CrashReporter::~CrashReporter() {
|
|
|
|
}
|
|
|
|
|
2013-11-19 04:19:23 +00:00
|
|
|
void CrashReporter::Start(const std::string& product_name,
|
2013-11-14 05:33:09 +00:00
|
|
|
const std::string& company_name,
|
|
|
|
const std::string& submit_url,
|
|
|
|
bool auto_submit,
|
2013-11-18 10:27:50 +00:00
|
|
|
bool skip_system_crash_handler,
|
|
|
|
const StringMap& extra_parameters) {
|
|
|
|
SetUploadParameters(extra_parameters);
|
|
|
|
|
2013-11-18 10:03:41 +00:00
|
|
|
InitBreakpad(product_name, ATOM_VERSION_STRING, company_name, submit_url,
|
|
|
|
auto_submit, skip_system_crash_handler);
|
2013-11-14 05:33:09 +00:00
|
|
|
}
|
|
|
|
|
2013-11-18 10:27:50 +00:00
|
|
|
void CrashReporter::SetUploadParameters(const StringMap& parameters) {
|
|
|
|
upload_parameters_ = parameters;
|
|
|
|
upload_parameters_["process_type"] = is_browser_ ? "browser" : "renderer";
|
2013-11-18 10:37:32 +00:00
|
|
|
|
|
|
|
// Setting platform dependent parameters.
|
|
|
|
SetUploadParameters();
|
2013-11-14 10:02:15 +00:00
|
|
|
}
|
|
|
|
|
2013-11-14 05:33:09 +00:00
|
|
|
} // namespace crash_reporter
|