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-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-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-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-03-15 13:56:25 +00:00
|
|
|
dict.SetMethod("isPDFViewerEnabled", &IsPDFViewerEnabled);
|
2018-08-23 15:51:46 +00:00
|
|
|
dict.SetMethod("isFakeLocationProviderEnabled",
|
|
|
|
&IsFakeLocationProviderEnabled);
|
2018-11-09 03:42:34 +00:00
|
|
|
dict.SetMethod("isPrintingEnabled", &IsPrintingEnabled);
|
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
|
|
|
|
|
2023-02-09 01:31:38 +00:00
|
|
|
NODE_LINKED_BINDING_CONTEXT_AWARE(electron_common_features, Initialize)
|