2013-06-01 07:57:37 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2014-03-16 00:30:26 +00:00
|
|
|
#include "atom/common/api/atom_api_crash_reporter.h"
|
2013-06-01 07:57:37 +00:00
|
|
|
|
2014-03-16 01:13:06 +00:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
|
2014-03-16 00:30:26 +00:00
|
|
|
#include "atom/common/crash_reporter/crash_reporter.h"
|
|
|
|
#include "atom/common/v8/native_type_conversions.h"
|
2013-12-11 07:48:19 +00:00
|
|
|
|
2014-03-16 00:30:26 +00:00
|
|
|
#include "atom/common/v8/node_common.h"
|
2013-06-01 07:57:37 +00:00
|
|
|
|
|
|
|
namespace atom {
|
|
|
|
|
|
|
|
namespace api {
|
|
|
|
|
|
|
|
// static
|
2013-12-11 07:48:19 +00:00
|
|
|
void CrashReporter::Start(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
2013-11-14 05:33:09 +00:00
|
|
|
std::string product_name, company_name, submit_url;
|
|
|
|
bool auto_submit, skip_system;
|
2013-11-18 10:27:50 +00:00
|
|
|
std::map<std::string, std::string> dict;
|
2013-11-14 05:33:09 +00:00
|
|
|
if (!FromV8Arguments(args, &product_name, &company_name, &submit_url,
|
2013-11-18 10:27:50 +00:00
|
|
|
&auto_submit, &skip_system, &dict))
|
2013-11-14 05:33:09 +00:00
|
|
|
return node::ThrowTypeError("Bad argument");
|
2013-06-01 07:57:37 +00:00
|
|
|
|
2013-11-14 05:33:09 +00:00
|
|
|
crash_reporter::CrashReporter::GetInstance()->Start(
|
2013-11-18 10:27:50 +00:00
|
|
|
product_name, company_name, submit_url, auto_submit, skip_system, dict);
|
2013-06-01 07:57:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
void CrashReporter::Initialize(v8::Handle<v8::Object> target) {
|
2013-12-11 07:48:19 +00:00
|
|
|
NODE_SET_METHOD(target, "start", Start);
|
2013-06-01 07:57:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace api
|
|
|
|
|
|
|
|
} // namespace atom
|
|
|
|
|
2013-11-13 09:29:35 +00:00
|
|
|
NODE_MODULE(atom_common_crash_reporter, atom::api::CrashReporter::Initialize)
|