2018-03-15 13:56:25 +00:00
|
|
|
// Copyright (c) 2018 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#include "atom/common/node_includes.h"
|
|
|
|
#include "native_mate/dictionary.h"
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2018-06-13 16:15:34 +00:00
|
|
|
bool IsDesktopCapturerEnabled() {
|
|
|
|
#if defined(ENABLE_DESKTOP_CAPTURER)
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-05-03 16:10:25 +00:00
|
|
|
bool IsOffscreenRenderingEnabled() {
|
|
|
|
#if defined(ENABLE_OSR)
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-03-15 13:56:25 +00:00
|
|
|
bool IsPDFViewerEnabled() {
|
|
|
|
#if defined(ENABLE_PDF_VIEWER)
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-08-23 15:51:46 +00:00
|
|
|
bool IsFakeLocationProviderEnabled() {
|
|
|
|
#if defined(OVERRIDE_LOCATION_PROVIDER)
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-08-26 23:03:46 +00:00
|
|
|
bool IsViewApiEnabled() {
|
|
|
|
#if defined(ENABLE_VIEW_API)
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-03-15 13:56:25 +00:00
|
|
|
void Initialize(v8::Local<v8::Object> exports,
|
|
|
|
v8::Local<v8::Value> unused,
|
|
|
|
v8::Local<v8::Context> context,
|
|
|
|
void* priv) {
|
|
|
|
mate::Dictionary dict(context->GetIsolate(), exports);
|
2018-06-13 16:15:34 +00:00
|
|
|
dict.SetMethod("isDesktopCapturerEnabled", &IsDesktopCapturerEnabled);
|
2018-05-03 16:10:25 +00:00
|
|
|
dict.SetMethod("isOffscreenRenderingEnabled", &IsOffscreenRenderingEnabled);
|
2018-03-15 13:56:25 +00:00
|
|
|
dict.SetMethod("isPDFViewerEnabled", &IsPDFViewerEnabled);
|
2018-08-23 15:51:46 +00:00
|
|
|
dict.SetMethod("isFakeLocationProviderEnabled",
|
|
|
|
&IsFakeLocationProviderEnabled);
|
2018-08-26 23:03:46 +00:00
|
|
|
dict.SetMethod("isViewApiEnabled", &IsViewApiEnabled);
|
2018-03-15 13:56:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_features, Initialize)
|