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-11-09 03:42:34 +00:00
|
|
|
#include "printing/buildflags/buildflags.h"
|
2019-12-05 09:46:34 +00:00
|
|
|
#include "shell/common/gin_helper/dictionary.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/common/node_includes.h"
|
2018-03-15 13:56:25 +00:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2020-03-10 09:39:40 +00:00
|
|
|
bool IsBuiltinSpellCheckerEnabled() {
|
|
|
|
return BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2019-09-18 16:52:06 +00:00
|
|
|
bool IsRemoteModuleEnabled() {
|
|
|
|
return BUILDFLAG(ENABLE_REMOTE_MODULE);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2019-01-11 16:02:06 +00:00
|
|
|
bool IsRunAsNodeEnabled() {
|
|
|
|
return BUILDFLAG(ENABLE_RUN_AS_NODE);
|
|
|
|
}
|
|
|
|
|
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() {
|
2020-03-28 06:44:57 +00:00
|
|
|
return BUILDFLAG(ENABLE_VIEWS_API);
|
2018-08-26 23:03:46 +00:00
|
|
|
}
|
|
|
|
|
2018-10-11 13:52:12 +00:00
|
|
|
bool IsTtsEnabled() {
|
|
|
|
return BUILDFLAG(ENABLE_TTS);
|
|
|
|
}
|
|
|
|
|
2018-11-09 03:42:34 +00:00
|
|
|
bool IsPrintingEnabled() {
|
|
|
|
return BUILDFLAG(ENABLE_PRINTING);
|
|
|
|
}
|
|
|
|
|
2019-07-24 23:01:08 +00:00
|
|
|
bool IsExtensionsEnabled() {
|
|
|
|
return BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS);
|
|
|
|
}
|
|
|
|
|
2019-08-22 10:17:50 +00:00
|
|
|
bool IsPictureInPictureEnabled() {
|
|
|
|
return BUILDFLAG(ENABLE_PICTURE_IN_PICTURE);
|
|
|
|
}
|
|
|
|
|
2019-03-30 00:32:52 +00:00
|
|
|
bool IsComponentBuild() {
|
|
|
|
#if defined(COMPONENT_BUILD)
|
|
|
|
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) {
|
2019-12-05 09:46:34 +00:00
|
|
|
gin_helper::Dictionary dict(context->GetIsolate(), exports);
|
2020-03-10 09:39:40 +00:00
|
|
|
dict.SetMethod("isBuiltinSpellCheckerEnabled", &IsBuiltinSpellCheckerEnabled);
|
2018-06-13 16:15:34 +00:00
|
|
|
dict.SetMethod("isDesktopCapturerEnabled", &IsDesktopCapturerEnabled);
|
2018-05-03 16:10:25 +00:00
|
|
|
dict.SetMethod("isOffscreenRenderingEnabled", &IsOffscreenRenderingEnabled);
|
2019-09-18 16:52:06 +00:00
|
|
|
dict.SetMethod("isRemoteModuleEnabled", &IsRemoteModuleEnabled);
|
2018-03-15 13:56:25 +00:00
|
|
|
dict.SetMethod("isPDFViewerEnabled", &IsPDFViewerEnabled);
|
2019-01-11 16:02:06 +00:00
|
|
|
dict.SetMethod("isRunAsNodeEnabled", &IsRunAsNodeEnabled);
|
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-11-09 03:42:34 +00:00
|
|
|
dict.SetMethod("isPrintingEnabled", &IsPrintingEnabled);
|
2019-08-22 10:17:50 +00:00
|
|
|
dict.SetMethod("isPictureInPictureEnabled", &IsPictureInPictureEnabled);
|
2019-03-30 00:32:52 +00:00
|
|
|
dict.SetMethod("isComponentBuild", &IsComponentBuild);
|
2019-07-24 23:01:08 +00:00
|
|
|
dict.SetMethod("isExtensionsEnabled", &IsExtensionsEnabled);
|
2018-03-15 13:56:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2020-02-14 11:25:39 +00:00
|
|
|
NODE_LINKED_MODULE_CONTEXT_AWARE(electron_common_features, Initialize)
|