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.
|
|
|
|
|
2018-10-01 20:00:53 +00:00
|
|
|
#include "electron/buildflags/buildflags.h"
|
2018-03-15 13:56:25 +00:00
|
|
|
#include "native_mate/dictionary.h"
|
2018-07-21 22:49:02 +00:00
|
|
|
// clang-format off
|
|
|
|
#include "atom/common/node_includes.h" // NOLINT(build/include_alpha)
|
|
|
|
// clang-format on
|
2018-03-15 13:56:25 +00:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2018-06-13 16:15:34 +00:00
|
|
|
bool IsDesktopCapturerEnabled() {
|
2018-10-01 20:00:53 +00:00
|
|
|
return BUILDFLAG(ENABLE_DESKTOP_CAPTURER);
|
2018-06-13 16:15:34 +00:00
|
|
|
}
|
|
|
|
|
2018-05-03 16:10:25 +00:00
|
|
|
bool IsOffscreenRenderingEnabled() {
|
2018-10-01 20:00:53 +00:00
|
|
|
return BUILDFLAG(ENABLE_OSR);
|
2018-05-03 16:10:25 +00:00
|
|
|
}
|
|
|
|
|
2018-03-15 13:56:25 +00:00
|
|
|
bool IsPDFViewerEnabled() {
|
2018-10-01 20:00:53 +00:00
|
|
|
return BUILDFLAG(ENABLE_PDF_VIEWER);
|
2018-03-15 13:56:25 +00:00
|
|
|
}
|
|
|
|
|
2018-08-23 15:51:46 +00:00
|
|
|
bool IsFakeLocationProviderEnabled() {
|
2018-10-01 20:00:53 +00:00
|
|
|
return BUILDFLAG(OVERRIDE_LOCATION_PROVIDER);
|
2018-08-23 15:51:46 +00:00
|
|
|
}
|
|
|
|
|
2018-08-26 23:03:46 +00:00
|
|
|
bool IsViewApiEnabled() {
|
2018-10-01 20:00:53 +00:00
|
|
|
return BUILDFLAG(ENABLE_VIEW_API);
|
2018-08-26 23:03:46 +00:00
|
|
|
}
|
|
|
|
|
2018-10-11 13:52:12 +00:00
|
|
|
bool IsTtsEnabled() {
|
|
|
|
return BUILDFLAG(ENABLE_TTS);
|
|
|
|
}
|
|
|
|
|
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-10-11 13:52:12 +00:00
|
|
|
dict.SetMethod("isTtsEnabled", &IsTtsEnabled);
|
2018-03-15 13:56:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_features, Initialize)
|