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.
|
|
|
|
|
2013-11-13 09:29:35 +00:00
|
|
|
#include "common/api/atom_api_crash_reporter.h"
|
2013-06-01 07:57:37 +00:00
|
|
|
|
2013-11-13 09:29:35 +00:00
|
|
|
#include "common/crash_reporter/crash_reporter.h"
|
2013-09-24 01:41:54 +00:00
|
|
|
#include "common/v8_conversions.h"
|
2013-06-01 07:57:37 +00:00
|
|
|
#include "vendor/node/src/node.h"
|
|
|
|
#include "vendor/node/src/node_internals.h"
|
|
|
|
|
|
|
|
namespace atom {
|
|
|
|
|
|
|
|
namespace api {
|
|
|
|
|
|
|
|
// static
|
2013-11-14 05:33:09 +00:00
|
|
|
v8::Handle<v8::Value> CrashReporter::Start(const v8::Arguments& args) {
|
|
|
|
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
|
|
|
|
|
|
|
return v8::Undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
void CrashReporter::Initialize(v8::Handle<v8::Object> target) {
|
2013-11-14 05:33:09 +00:00
|
|
|
node::SetMethod(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)
|