electron/atom/common/api/features.cc
Alexey Kuzmin dee9aef975 Add "enable_desktop_capturer" build flag (#13133)
* Make it possible to disable a module for a renderer

* Put DesktopCapturer API under a build flag

The name is "enable_desktop_capturer".
Enabled by default.
2018-06-13 11:15:34 -05:00

46 lines
1.1 KiB
C++

// 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 {
bool IsDesktopCapturerEnabled() {
#if defined(ENABLE_DESKTOP_CAPTURER)
return true;
#else
return false;
#endif
}
bool IsOffscreenRenderingEnabled() {
#if defined(ENABLE_OSR)
return true;
#else
return false;
#endif
}
bool IsPDFViewerEnabled() {
#if defined(ENABLE_PDF_VIEWER)
return true;
#else
return false;
#endif
}
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);
dict.SetMethod("isDesktopCapturerEnabled", &IsDesktopCapturerEnabled);
dict.SetMethod("isOffscreenRenderingEnabled", &IsOffscreenRenderingEnabled);
dict.SetMethod("isPDFViewerEnabled", &IsPDFViewerEnabled);
}
} // namespace
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_features, Initialize)