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-04-29 13:57:05 +00:00
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2014-03-16 00:30:26 +00:00
|
|
|
#include "atom/common/platform_util.h"
|
2014-04-17 05:45:14 +00:00
|
|
|
#include "atom/common/native_mate_converters/file_path_converter.h"
|
2014-04-22 15:07:21 +00:00
|
|
|
#include "atom/common/native_mate_converters/gurl_converter.h"
|
2014-04-17 05:45:14 +00:00
|
|
|
#include "atom/common/node_includes.h"
|
2015-09-07 08:29:54 +00:00
|
|
|
#include "native_mate/dictionary.h"
|
2013-04-29 13:57:05 +00:00
|
|
|
|
2014-04-15 07:41:26 +00:00
|
|
|
namespace {
|
|
|
|
|
2016-02-17 17:05:21 +00:00
|
|
|
bool OpenExternal(const GURL& url, mate::Arguments* args) {
|
|
|
|
bool activate = true;
|
|
|
|
if (args->Length() == 2) {
|
|
|
|
mate::Dictionary options;
|
|
|
|
if (args->GetNext(&options)) {
|
|
|
|
options.Get("activate", &activate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return platform_util::OpenExternal(url, activate);
|
|
|
|
}
|
|
|
|
|
2015-05-22 11:11:22 +00:00
|
|
|
void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|
|
|
v8::Local<v8::Context> context, void* priv) {
|
2014-06-29 12:48:44 +00:00
|
|
|
mate::Dictionary dict(context->GetIsolate(), exports);
|
2014-04-16 07:31:59 +00:00
|
|
|
dict.SetMethod("showItemInFolder", &platform_util::ShowItemInFolder);
|
|
|
|
dict.SetMethod("openItem", &platform_util::OpenItem);
|
2016-02-17 17:05:21 +00:00
|
|
|
dict.SetMethod("openExternal", &OpenExternal);
|
2014-04-16 07:31:59 +00:00
|
|
|
dict.SetMethod("moveItemToTrash", &platform_util::MoveItemToTrash);
|
|
|
|
dict.SetMethod("beep", &platform_util::Beep);
|
2013-04-29 13:57:05 +00:00
|
|
|
}
|
|
|
|
|
2014-04-15 07:41:26 +00:00
|
|
|
} // namespace
|
2013-04-29 13:57:05 +00:00
|
|
|
|
2014-06-29 12:48:44 +00:00
|
|
|
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_shell, Initialize)
|