diff --git a/BUILD.gn b/BUILD.gn index aa57a50ba9e..8ad5300bb61 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1,5 +1,6 @@ import("build/asar.gni") import("build/npm.gni") +import("buildflags/buildflags.gni") import("electron_paks.gni") import("filenames.gni") import("//build/config/locales.gni") @@ -30,22 +31,6 @@ electron_project_name = branding.project_name electron_product_name = branding.product_name electron_mac_bundle_id = branding.mac_bundle_id -declare_args() { - enable_desktop_capturer = true - enable_run_as_node = true - enable_osr = true - enable_view_api = false - - # Provide a fake location provider for mocking - # the geolocation responses. Disable it if you - # need to test with chromium's location provider. - # Should not be enabled for release build. - enable_fake_location_provider = !is_official_build - - # Enable flash plugin support. - enable_pepper_flash = true -} - if (is_mas_build) { assert(is_mac, "It doesn't make sense to build a MAS build on a non-mac platform") @@ -58,25 +43,6 @@ config("branding") { ] } -config("features") { - defines = [] - if (enable_desktop_capturer) { - defines += [ "ENABLE_DESKTOP_CAPTURER=1" ] - } - if (enable_run_as_node) { - defines += [ "ENABLE_RUN_AS_NODE=1" ] - } - if (enable_osr) { - defines += [ "ENABLE_OSR=1" ] - } - if (enable_view_api) { - defines += [ "ENABLE_VIEW_API" ] - } - if (enable_pepper_flash) { - defines += [ "ENABLE_PEPPER_FLASH" ] - } -} - npm_action("atom_browserify_sandbox") { deps = [ ":atom_js2c_copy", @@ -95,7 +61,7 @@ npm_action("atom_browserify_sandbox") { "-r", "./lib/sandboxed_renderer/api/exports/child_process.js:child_process", "-t", - "aliasify" + "aliasify", ] inputs = [ @@ -209,14 +175,12 @@ static_library("electron_lib") { configs += [ "//v8:external_startup_data" ] configs += [ "//third_party/electron_node:node_internals" ] - public_configs = [ - ":branding", - ":features", - ] + public_configs = [ ":branding" ] deps = [ ":atom_js2c", "brightray", + "buildflags", "chromium_src:chrome", "native_mate", "//base", @@ -307,7 +271,6 @@ static_library("electron_lib") { } if (enable_fake_location_provider) { - defines += [ "OVERRIDE_LOCATION_PROVIDER" ] sources += [ "atom/browser/fake_location_provider.cc", "atom/browser/fake_location_provider.h", @@ -530,7 +493,10 @@ if (is_mac) { mac_framework_bundle("electron_framework") { output_name = electron_framework_name framework_version = electron_framework_version - framework_contents = [ "Resources", "Libraries" ] + framework_contents = [ + "Resources", + "Libraries", + ] public_deps = [ ":electron_lib", ] @@ -671,11 +637,11 @@ if (is_mac) { } else { windows_manifest("electron_app_manifest") { sources = [ + "atom/browser/resources/win/disable_window_filtering.manifest", + "atom/browser/resources/win/dpi_aware.manifest", as_invoker_manifest, common_controls_manifest, default_compatibility_manifest, - "atom/browser/resources/win/dpi_aware.manifest", - "atom/browser/resources/win/disable_window_filtering.manifest", ] } diff --git a/atom/app/atom_content_client.cc b/atom/app/atom_content_client.cc index 9749b0f90a1..2cecf5ff50e 100644 --- a/atom/app/atom_content_client.cc +++ b/atom/app/atom_content_client.cc @@ -18,6 +18,7 @@ #include "content/public/common/content_constants.h" #include "content/public/common/pepper_plugin_info.h" #include "content/public/common/user_agent.h" +#include "electron/buildflags/buildflags.h" #include "ppapi/shared_impl/ppapi_permissions.h" #include "ui/base/l10n/l10n_util.h" #include "url/url_constants.h" @@ -30,10 +31,10 @@ #include "media/base/video_codecs.h" #endif // defined(WIDEVINE_CDM_AVAILABLE) -#if defined(ENABLE_PDF_VIEWER) +#if BUILDFLAG(ENABLE_PDF_VIEWER) #include "atom/common/atom_constants.h" #include "pdf/pdf.h" -#endif // defined(ENABLE_PDF_VIEWER) +#endif // BUILDFLAG(ENABLE_PDF_VIEWER) namespace atom { @@ -74,7 +75,7 @@ bool IsWidevineAvailable(base::FilePath* cdm_path, } #endif // defined(WIDEVINE_CDM_AVAILABLE) -#if defined(ENABLE_PEPPER_FLASH) +#if BUILDFLAG(ENABLE_PEPPER_FLASH) content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path, const std::string& version) { content::PepperPluginInfo plugin; @@ -127,10 +128,10 @@ void AddPepperFlashFromCommandLine( plugins->push_back(CreatePepperFlashInfo(flash_path, flash_version)); } -#endif // defined(ENABLE_PEPPER_FLASH) +#endif // BUILDFLAG(ENABLE_PEPPER_FLASH) void ComputeBuiltInPlugins(std::vector* plugins) { -#if defined(ENABLE_PDF_VIEWER) +#if BUILDFLAG(ENABLE_PDF_VIEWER) content::PepperPluginInfo pdf_info; pdf_info.is_internal = true; pdf_info.is_out_of_process = true; @@ -147,7 +148,7 @@ void ComputeBuiltInPlugins(std::vector* plugins) { chrome_pdf::PPP_ShutdownModule; pdf_info.permissions = ppapi::PERMISSION_PRIVATE | ppapi::PERMISSION_DEV; plugins->push_back(pdf_info); -#endif // defined(ENABLE_PDF_VIEWER) +#endif // BUILDFLAG(ENABLE_PDF_VIEWER) } void ConvertStringWithSeparatorToVector(std::vector* vec, @@ -198,9 +199,9 @@ void AtomContentClient::AddAdditionalSchemes(Schemes* schemes) { void AtomContentClient::AddPepperPlugins( std::vector* plugins) { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); -#if defined(ENABLE_PEPPER_FLASH) +#if BUILDFLAG(ENABLE_PEPPER_FLASH) AddPepperFlashFromCommandLine(command_line, plugins); -#endif // defined(ENABLE_PEPPER_FLASH) +#endif // BUILDFLAG(ENABLE_PEPPER_FLASH) ComputeBuiltInPlugins(plugins); } diff --git a/atom/app/atom_library_main.h b/atom/app/atom_library_main.h index 2c7a27caa20..71207f0fd79 100644 --- a/atom/app/atom_library_main.h +++ b/atom/app/atom_library_main.h @@ -6,12 +6,13 @@ #define ATOM_APP_ATOM_LIBRARY_MAIN_H_ #include "build/build_config.h" +#include "electron/buildflags/buildflags.h" #if defined(OS_MACOSX) extern "C" { __attribute__((visibility("default"))) int AtomMain(int argc, char* argv[]); -#ifdef ENABLE_RUN_AS_NODE +#if BUILDFLAG(ENABLE_RUN_AS_NODE) __attribute__((visibility("default"))) int AtomInitializeICUandStartNode( int argc, char* argv[]); diff --git a/atom/app/atom_library_main.mm b/atom/app/atom_library_main.mm index 57a519fcd0d..f1bf7bb97a8 100644 --- a/atom/app/atom_library_main.mm +++ b/atom/app/atom_library_main.mm @@ -23,7 +23,7 @@ int AtomMain(int argc, char* argv[]) { return content::ContentMain(params); } -#ifdef ENABLE_RUN_AS_NODE +#if BUILDFLAG(ENABLE_RUN_AS_NODE) int AtomInitializeICUandStartNode(int argc, char* argv[]) { base::AtExitManager atexit_manager; base::mac::ScopedNSAutoreleasePool pool; diff --git a/atom/app/atom_main.cc b/atom/app/atom_main.cc index fc77100d9ac..d9baf0dd993 100644 --- a/atom/app/atom_main.cc +++ b/atom/app/atom_main.cc @@ -35,14 +35,14 @@ #include "atom/common/atom_command_line.h" #include "base/at_exit.h" #include "base/i18n/icu_util.h" +#include "electron/buildflags/buildflags.h" namespace { -#ifdef ENABLE_RUN_AS_NODE +#if BUILDFLAG(ENABLE_RUN_AS_NODE) const char kRunAsNode[] = "ELECTRON_RUN_AS_NODE"; #endif -#if defined(ENABLE_RUN_AS_NODE) || defined(OS_WIN) bool IsEnvSet(const char* name) { #if defined(OS_WIN) size_t required_size; @@ -53,7 +53,6 @@ bool IsEnvSet(const char* name) { return indicator && indicator[0] != '\0'; #endif } -#endif } // namespace @@ -93,7 +92,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) { } #endif -#ifdef ENABLE_RUN_AS_NODE +#if BUILDFLAG(ENABLE_RUN_AS_NODE) bool run_as_node = IsEnvSet(kRunAsNode); #else bool run_as_node = false; @@ -120,7 +119,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) { atexit([]() { OnThreadExit(nullptr, DLL_THREAD_DETACH, nullptr); }); #endif -#ifdef ENABLE_RUN_AS_NODE +#if BUILDFLAG(ENABLE_RUN_AS_NODE) if (run_as_node) { std::vector argv(arguments.argc); std::transform( @@ -156,7 +155,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) { #elif defined(OS_LINUX) // defined(OS_WIN) int main(int argc, char* argv[]) { -#ifdef ENABLE_RUN_AS_NODE +#if BUILDFLAG(ENABLE_RUN_AS_NODE) if (IsEnvSet(kRunAsNode)) { base::i18n::InitializeICU(); base::AtExitManager atexit_manager; @@ -175,7 +174,7 @@ int main(int argc, char* argv[]) { #else // defined(OS_LINUX) int main(int argc, char* argv[]) { -#ifdef ENABLE_RUN_AS_NODE +#if BUILDFLAG(ENABLE_RUN_AS_NODE) if (IsEnvSet(kRunAsNode)) { return AtomInitializeICUandStartNode(argc, argv); } diff --git a/atom/app/node_main.cc b/atom/app/node_main.cc index 0a5d00115bb..4cc5d1d022e 100644 --- a/atom/app/node_main.cc +++ b/atom/app/node_main.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#ifdef ENABLE_RUN_AS_NODE - #include "atom/app/node_main.h" #include @@ -119,5 +117,3 @@ int NodeMain(int argc, char* argv[]) { } } // namespace atom - -#endif // ENABLE_RUN_AS_NODE diff --git a/atom/app/node_main.h b/atom/app/node_main.h index 68fe25f6df6..b02b7cd5aca 100644 --- a/atom/app/node_main.h +++ b/atom/app/node_main.h @@ -5,14 +5,10 @@ #ifndef ATOM_APP_NODE_MAIN_H_ #define ATOM_APP_NODE_MAIN_H_ -#ifdef ENABLE_RUN_AS_NODE - namespace atom { int NodeMain(int argc, char* argv[]); } // namespace atom -#endif // ENABLE_RUN_AS_NODE - #endif // ATOM_APP_NODE_MAIN_H_ diff --git a/atom/browser/api/atom_api_top_level_window.cc b/atom/browser/api/atom_api_top_level_window.cc index bbd414cb7f2..b2a15f9855a 100644 --- a/atom/browser/api/atom_api_top_level_window.cc +++ b/atom/browser/api/atom_api_top_level_window.cc @@ -19,6 +19,7 @@ #include "atom/common/native_mate_converters/string16_converter.h" #include "atom/common/native_mate_converters/value_converter.h" #include "atom/common/options_switches.h" +#include "electron/buildflags/buildflags.h" #include "native_mate/handle.h" #include "native_mate/persistent_dictionary.h" @@ -79,7 +80,7 @@ TopLevelWindow::TopLevelWindow(v8::Isolate* isolate, if (options.Get("parent", &parent) && !parent.IsEmpty()) parent_window_.Reset(isolate, parent.ToV8()); -#if defined(ENABLE_OSR) +#if BUILDFLAG(ENABLE_OSR) // Offscreen windows are always created frameless. mate::Dictionary web_preferences; bool offscreen; diff --git a/atom/browser/api/atom_api_view.cc b/atom/browser/api/atom_api_view.cc index 888b2aa7682..af907d5abcc 100644 --- a/atom/browser/api/atom_api_view.cc +++ b/atom/browser/api/atom_api_view.cc @@ -23,7 +23,7 @@ View::~View() { delete view_; } -#if defined(ENABLE_VIEW_API) +#if BUILDFLAG(ENABLE_VIEW_API) void View::SetLayoutManager(mate::Handle layout_manager) { layout_manager_.Reset(isolate(), layout_manager->GetWrapper()); view()->SetLayoutManager(layout_manager->TakeOver()); @@ -53,7 +53,7 @@ mate::WrappableBase* View::New(mate::Arguments* args) { void View::BuildPrototype(v8::Isolate* isolate, v8::Local prototype) { prototype->SetClassName(mate::StringToV8(isolate, "View")); -#if defined(ENABLE_VIEW_API) +#if BUILDFLAG(ENABLE_VIEW_API) mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate()) .SetMethod("setLayoutManager", &View::SetLayoutManager) .SetMethod("addChildView", &View::AddChildView) diff --git a/atom/browser/api/atom_api_view.h b/atom/browser/api/atom_api_view.h index f86fb6fc17b..30f2b5399b7 100644 --- a/atom/browser/api/atom_api_view.h +++ b/atom/browser/api/atom_api_view.h @@ -9,6 +9,7 @@ #include #include "atom/browser/api/views/atom_api_layout_manager.h" +#include "electron/buildflags/buildflags.h" #include "native_mate/handle.h" #include "ui/views/view.h" @@ -23,7 +24,7 @@ class View : public mate::TrackableObject { static void BuildPrototype(v8::Isolate* isolate, v8::Local prototype); -#if defined(ENABLE_VIEW_API) +#if BUILDFLAG(ENABLE_VIEW_API) void SetLayoutManager(mate::Handle layout_manager); void AddChildView(mate::Handle view); void AddChildViewAt(mate::Handle view, size_t index); diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index fb1b3cb730d..35b6d14ea53 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -21,11 +21,6 @@ #include "atom/browser/lib/bluetooth_chooser.h" #include "atom/browser/native_window.h" #include "atom/browser/net/atom_network_delegate.h" -#if defined(ENABLE_OSR) -#include "atom/browser/osr/osr_output_device.h" -#include "atom/browser/osr/osr_render_widget_host_view.h" -#include "atom/browser/osr/osr_web_contents_view.h" -#endif #include "atom/browser/ui/drag_util.h" #include "atom/browser/web_contents_permission_helper.h" #include "atom/browser/web_contents_preferences.h" @@ -91,6 +86,12 @@ #include "ui/display/screen.h" #include "ui/events/base_event_utils.h" +#if BUILDFLAG(ENABLE_OSR) +#include "atom/browser/osr/osr_output_device.h" +#include "atom/browser/osr/osr_render_widget_host_view.h" +#include "atom/browser/osr/osr_web_contents_view.h" +#endif + #if !defined(OS_MACOSX) #include "ui/aura/window.h" #endif @@ -237,7 +238,7 @@ struct Converter { *out = Type::BROWSER_VIEW; } else if (type == "webview") { *out = Type::WEB_VIEW; -#if defined(ENABLE_OSR) +#if BUILDFLAG(ENABLE_OSR) } else if (type == "offscreen") { *out = Type::OFF_SCREEN; #endif @@ -338,7 +339,7 @@ WebContents::WebContents(v8::Isolate* isolate, type_ = BACKGROUND_PAGE; else if (options.Get("isBrowserView", &b) && b) type_ = BROWSER_VIEW; -#if defined(ENABLE_OSR) +#if BUILDFLAG(ENABLE_OSR) else if (options.Get(options::kOffscreen, &b) && b) type_ = OFF_SCREEN; #endif @@ -372,7 +373,7 @@ WebContents::WebContents(v8::Isolate* isolate, new WebViewGuestDelegate(embedder_->web_contents(), this)); params.guest_delegate = guest_delegate_.get(); -#if defined(ENABLE_OSR) +#if BUILDFLAG(ENABLE_OSR) if (embedder_ && embedder_->IsOffScreen()) { auto* view = new OffScreenWebContentsView( false, base::Bind(&WebContents::OnPaint, base::Unretained(this))); @@ -384,7 +385,7 @@ WebContents::WebContents(v8::Isolate* isolate, } else { #endif web_contents = content::WebContents::Create(params); -#if defined(ENABLE_OSR) +#if BUILDFLAG(ENABLE_OSR) } } else if (IsOffScreen()) { bool transparent = false; @@ -1605,7 +1606,7 @@ void WebContents::SendInputEvent(v8::Isolate* isolate, blink::WebMouseEvent mouse_event; if (mate::ConvertFromV8(isolate, input_event, &mouse_event)) { if (IsOffScreen()) { -#if defined(ENABLE_OSR) +#if BUILDFLAG(ENABLE_OSR) GetOffScreenRenderWidgetHostView()->SendMouseEvent(mouse_event); #endif } else { @@ -1625,7 +1626,7 @@ void WebContents::SendInputEvent(v8::Isolate* isolate, blink::WebMouseWheelEvent mouse_wheel_event; if (mate::ConvertFromV8(isolate, input_event, &mouse_wheel_event)) { if (IsOffScreen()) { -#if defined(ENABLE_OSR) +#if BUILDFLAG(ENABLE_OSR) GetOffScreenRenderWidgetHostView()->SendMouseWheelEvent( mouse_wheel_event); #endif @@ -1757,77 +1758,50 @@ void WebContents::AttachToIframe(content::WebContents* embedder_web_contents, } bool WebContents::IsOffScreen() const { -#if defined(ENABLE_OSR) +#if BUILDFLAG(ENABLE_OSR) return type_ == OFF_SCREEN; #else return false; #endif } +#if BUILDFLAG(ENABLE_OSR) void WebContents::OnPaint(const gfx::Rect& dirty_rect, const SkBitmap& bitmap) { Emit("paint", dirty_rect, gfx::Image::CreateFrom1xBitmap(bitmap)); } void WebContents::StartPainting() { - if (!IsOffScreen()) - return; - -#if defined(ENABLE_OSR) auto* osr_wcv = GetOffScreenWebContentsView(); if (osr_wcv) osr_wcv->SetPainting(true); -#endif } void WebContents::StopPainting() { - if (!IsOffScreen()) - return; - -#if defined(ENABLE_OSR) auto* osr_wcv = GetOffScreenWebContentsView(); if (osr_wcv) osr_wcv->SetPainting(false); -#endif } bool WebContents::IsPainting() const { - if (!IsOffScreen()) - return false; - -#if defined(ENABLE_OSR) auto* osr_wcv = GetOffScreenWebContentsView(); return osr_wcv && osr_wcv->IsPainting(); -#else - return false; -#endif } void WebContents::SetFrameRate(int frame_rate) { - if (!IsOffScreen()) - return; - -#if defined(ENABLE_OSR) auto* osr_wcv = GetOffScreenWebContentsView(); if (osr_wcv) osr_wcv->SetFrameRate(frame_rate); -#endif } int WebContents::GetFrameRate() const { - if (!IsOffScreen()) - return 0; - -#if defined(ENABLE_OSR) auto* osr_wcv = GetOffScreenWebContentsView(); return osr_wcv ? osr_wcv->GetFrameRate() : 0; -#else - return 0; -#endif } +#endif void WebContents::Invalidate() { if (IsOffScreen()) { -#if defined(ENABLE_OSR) +#if BUILDFLAG(ENABLE_OSR) auto* osr_rwhv = GetOffScreenRenderWidgetHostView(); if (osr_rwhv) osr_rwhv->Invalidate(); @@ -2064,11 +2038,13 @@ void WebContents::BuildPrototype(v8::Isolate* isolate, .SetMethod("isGuest", &WebContents::IsGuest) .SetMethod("attachToIframe", &WebContents::AttachToIframe) .SetMethod("isOffscreen", &WebContents::IsOffScreen) +#if BUILDFLAG(ENABLE_OSR) .SetMethod("startPainting", &WebContents::StartPainting) .SetMethod("stopPainting", &WebContents::StopPainting) .SetMethod("isPainting", &WebContents::IsPainting) .SetMethod("setFrameRate", &WebContents::SetFrameRate) .SetMethod("getFrameRate", &WebContents::GetFrameRate) +#endif .SetMethod("invalidate", &WebContents::Invalidate) .SetMethod("setZoomLevel", &WebContents::SetZoomLevel) .SetMethod("_getZoomLevel", &WebContents::GetZoomLevel) diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 8c6d225e300..f9804d2ccf3 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -20,6 +20,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/common/favicon_url.h" +#include "electron/buildflags/buildflags.h" #include "native_mate/handle.h" #include "printing/backend/print_backend.h" #include "ui/gfx/image/image.h" @@ -49,7 +50,7 @@ class WebContentsZoomController; class WebViewGuestDelegate; class FrameSubscriber; -#if defined(ENABLE_OSR) +#if BUILDFLAG(ENABLE_OSR) class OffScreenWebContentsView; class OffScreenRenderWidgetHostView; #endif @@ -208,12 +209,14 @@ class WebContents : public mate::TrackableObject, // Methods for offscreen rendering bool IsOffScreen() const; +#if BUILDFLAG(ENABLE_OSR) void OnPaint(const gfx::Rect& dirty_rect, const SkBitmap& bitmap); void StartPainting(); void StopPainting(); bool IsPainting() const; void SetFrameRate(int frame_rate); int GetFrameRate() const; +#endif void Invalidate(); gfx::Size GetSizeForNewRenderView(content::WebContents*) const override; @@ -416,7 +419,7 @@ class WebContents : public mate::TrackableObject, uint32_t GetNextRequestId() { return ++request_id_; } -#if defined(ENABLE_OSR) +#if BUILDFLAG(ENABLE_OSR) OffScreenWebContentsView* GetOffScreenWebContentsView() const; OffScreenRenderWidgetHostView* GetOffScreenRenderWidgetHostView() const; #endif diff --git a/atom/browser/atom_browser_client.cc b/atom/browser/atom_browser_client.cc index 576da03427e..2f9b79e644a 100644 --- a/atom/browser/atom_browser_client.cc +++ b/atom/browser/atom_browser_client.cc @@ -52,6 +52,7 @@ #include "content/public/common/url_constants.h" #include "content/public/common/web_preferences.h" #include "device/geolocation/public/cpp/location_provider.h" +#include "electron/buildflags/buildflags.h" #include "net/base/escape.h" #include "net/ssl/ssl_cert_request_info.h" #include "ppapi/host/ppapi_host.h" @@ -69,13 +70,13 @@ #include "net/ssl/client_cert_store.h" #endif -#if defined(ENABLE_PEPPER_FLASH) +#if BUILDFLAG(ENABLE_PEPPER_FLASH) #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h" -#endif // defined(ENABLE_PEPPER_FLASH) +#endif // BUILDFLAG(ENABLE_PEPPER_FLASH) -#if defined(OVERRIDE_LOCATION_PROVIDER) +#if BUILDFLAG(OVERRIDE_LOCATION_PROVIDER) #include "atom/browser/fake_location_provider.h" -#endif // defined(OVERRIDE_LOCATION_PROVIDER) +#endif // BUILDFLAG(OVERRIDE_LOCATION_PROVIDER) using content::BrowserThread; @@ -360,7 +361,7 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches( } void AtomBrowserClient::DidCreatePpapiPlugin(content::BrowserPpapiHost* host) { -#if defined(ENABLE_PEPPER_FLASH) +#if BUILDFLAG(ENABLE_PEPPER_FLASH) host->GetPpapiHost()->AddHostFactoryFilter( base::WrapUnique(new ChromeBrowserPepperHostFactory(host))); #endif @@ -510,7 +511,7 @@ std::unique_ptr AtomBrowserClient::CreateClientCertStore( std::unique_ptr AtomBrowserClient::OverrideSystemLocationProvider() { -#if defined(OVERRIDE_LOCATION_PROVIDER) +#if BUILDFLAG(OVERRIDE_LOCATION_PROVIDER) return std::make_unique(); #else return nullptr; diff --git a/atom/browser/atom_browser_main_parts.cc b/atom/browser/atom_browser_main_parts.cc index 73b339de2e9..a321a2e69f8 100644 --- a/atom/browser/atom_browser_main_parts.cc +++ b/atom/browser/atom_browser_main_parts.cc @@ -23,6 +23,7 @@ #include "content/public/browser/child_process_security_policy.h" #include "content/public/common/result_codes.h" #include "content/public/common/service_manager_connection.h" +#include "electron/buildflags/buildflags.h" #include "services/device/public/mojom/constants.mojom.h" #include "services/service_manager/public/cpp/connector.h" #include "ui/base/idle/idle.h" @@ -33,9 +34,9 @@ #include "ui/events/devices/x11/touch_factory_x11.h" #endif -#if defined(ENABLE_PDF_VIEWER) +#if BUILDFLAG(ENABLE_PDF_VIEWER) #include "atom/browser/atom_web_ui_controller_factory.h" -#endif // defined(ENABLE_PDF_VIEWER) +#endif // BUILDFLAG(ENABLE_PDF_VIEWER) #if defined(OS_MACOSX) #include "atom/browser/ui/cocoa/views_delegate_mac.h" @@ -206,10 +207,10 @@ void AtomBrowserMainParts::PreMainMessageLoopRun() { base::Bind(&v8::Isolate::LowMemoryNotification, base::Unretained(js_env_->isolate()))); -#if defined(ENABLE_PDF_VIEWER) +#if BUILDFLAG(ENABLE_PDF_VIEWER) content::WebUIControllerFactory::RegisterFactory( AtomWebUIControllerFactory::GetInstance()); -#endif // defined(ENABLE_PDF_VIEWER) +#endif // BUILDFLAG(ENABLE_PDF_VIEWER) brightray::BrowserMainParts::PreMainMessageLoopRun(); bridge_task_runner_->MessageLoopIsReady(); diff --git a/atom/browser/atom_resource_dispatcher_host_delegate.cc b/atom/browser/atom_resource_dispatcher_host_delegate.cc index 0a59a0dc8f4..8ae84be2820 100644 --- a/atom/browser/atom_resource_dispatcher_host_delegate.cc +++ b/atom/browser/atom_resource_dispatcher_host_delegate.cc @@ -10,15 +10,16 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/render_frame_host.h" +#include "electron/buildflags/buildflags.h" #include "net/base/escape.h" #include "url/gurl.h" -#if defined(ENABLE_PDF_VIEWER) +#if BUILDFLAG(ENABLE_PDF_VIEWER) #include "atom/common/atom_constants.h" #include "base/strings/stringprintf.h" #include "content/public/browser/stream_info.h" #include "net/url_request/url_request.h" -#endif // defined(ENABLE_PDF_VIEWER) +#endif // BUILDFLAG(ENABLE_PDF_VIEWER) using content::BrowserThread; @@ -26,7 +27,7 @@ namespace atom { namespace { -#if defined(ENABLE_PDF_VIEWER) +#if BUILDFLAG(ENABLE_PDF_VIEWER) void OnPdfResourceIntercepted( const GURL& original_url, int render_process_host_id, @@ -65,7 +66,7 @@ void OnPdfResourceIntercepted( params.frame_tree_node_id = frame_host->GetFrameTreeNodeId(); web_contents->GetController().LoadURLWithParams(params); } -#endif // defined(ENABLE_PDF_VIEWER) +#endif // BUILDFLAG(ENABLE_PDF_VIEWER) } // namespace @@ -76,7 +77,7 @@ bool AtomResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream( const std::string& mime_type, GURL* origin, std::string* payload) { -#if defined(ENABLE_PDF_VIEWER) +#if BUILDFLAG(ENABLE_PDF_VIEWER) const content::ResourceRequestInfo* info = content::ResourceRequestInfo::ForRequest(request); @@ -96,7 +97,7 @@ bool AtomResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream( info->GetWebContentsGetterForRequest())); return true; } -#endif // defined(ENABLE_PDF_VIEWER) +#endif // BUILDFLAG(ENABLE_PDF_VIEWER) return false; } diff --git a/atom/browser/atom_web_ui_controller_factory.cc b/atom/browser/atom_web_ui_controller_factory.cc index b4e8c1b130a..2dde2cec055 100644 --- a/atom/browser/atom_web_ui_controller_factory.cc +++ b/atom/browser/atom_web_ui_controller_factory.cc @@ -6,14 +6,16 @@ #include -#if defined(ENABLE_PDF_VIEWER) +#include "electron/buildflags/buildflags.h" + +#if BUILDFLAG(ENABLE_PDF_VIEWER) #include "atom/browser/ui/webui/pdf_viewer_ui.h" #include "atom/common/atom_constants.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "content/public/browser/web_contents.h" #include "net/base/escape.h" -#endif // defined(ENABLE_PDF_VIEWER) +#endif // BUILDFLAG(ENABLE_PDF_VIEWER) namespace atom { @@ -29,11 +31,11 @@ AtomWebUIControllerFactory::~AtomWebUIControllerFactory() {} content::WebUI::TypeID AtomWebUIControllerFactory::GetWebUIType( content::BrowserContext* browser_context, const GURL& url) const { -#if defined(ENABLE_PDF_VIEWER) +#if BUILDFLAG(ENABLE_PDF_VIEWER) if (url.host() == kPdfViewerUIHost) { return const_cast(this); } -#endif // defined(ENABLE_PDF_VIEWER) +#endif // BUILDFLAG(ENABLE_PDF_VIEWER) return content::WebUI::kNoWebUI; } @@ -53,7 +55,7 @@ bool AtomWebUIControllerFactory::UseWebUIBindingsForURL( content::WebUIController* AtomWebUIControllerFactory::CreateWebUIControllerForURL(content::WebUI* web_ui, const GURL& url) const { -#if defined(ENABLE_PDF_VIEWER) +#if BUILDFLAG(ENABLE_PDF_VIEWER) if (url.host() == kPdfViewerUIHost) { base::StringPairs toplevel_params; base::SplitStringIntoKeyValuePairs(url.query(), '=', '&', &toplevel_params); @@ -75,7 +77,7 @@ AtomWebUIControllerFactory::CreateWebUIControllerForURL(content::WebUI* web_ui, auto browser_context = web_ui->GetWebContents()->GetBrowserContext(); return new PdfViewerUI(browser_context, web_ui, src); } -#endif // defined(ENABLE_PDF_VIEWER) +#endif // BUILDFLAG(ENABLE_PDF_VIEWER) return nullptr; } diff --git a/atom/browser/ui/autofill_popup.cc b/atom/browser/ui/autofill_popup.cc index f7bd98dacb9..a24319a8a44 100644 --- a/atom/browser/ui/autofill_popup.cc +++ b/atom/browser/ui/autofill_popup.cc @@ -9,6 +9,7 @@ #include "atom/browser/native_window_views.h" #include "atom/browser/ui/autofill_popup.h" #include "atom/common/api/api_messages.h" +#include "electron/buildflags/buildflags.h" #include "ui/display/display.h" #include "ui/display/screen.h" #include "ui/gfx/geometry/point.h" @@ -17,7 +18,7 @@ #include "ui/gfx/geometry/vector2d.h" #include "ui/gfx/text_utils.h" -#if defined(ENABLE_OSR) +#if BUILDFLAG(ENABLE_OSR) #include "atom/browser/osr/osr_render_widget_host_view.h" #include "atom/browser/osr/osr_view_proxy.h" #endif @@ -135,7 +136,7 @@ void AutofillPopup::CreateView(content::RenderFrameHost* frame_host, view_ = new AutofillPopupView(this, parent->GetWidget()); view_->Show(); -#if defined(ENABLE_OSR) +#if BUILDFLAG(ENABLE_OSR) if (offscreen) { auto* rwhv = frame_host->GetView(); if (embedder_frame_host != nullptr) { diff --git a/atom/browser/ui/views/autofill_popup_view.cc b/atom/browser/ui/views/autofill_popup_view.cc index 0265570b96b..5f4aee2dbc8 100644 --- a/atom/browser/ui/views/autofill_popup_view.cc +++ b/atom/browser/ui/views/autofill_popup_view.cc @@ -44,7 +44,7 @@ AutofillPopupView::~AutofillPopupView() { RemoveObserver(); -#if defined(ENABLE_OSR) +#if BUILDFLAG(ENABLE_OSR) if (view_proxy_.get()) { view_proxy_->ResetView(); } @@ -226,7 +226,7 @@ void AutofillPopupView::DoUpdateBoundsAndRedrawPopup() { return; GetWidget()->SetBounds(popup_->popup_bounds_); -#if defined(ENABLE_OSR) +#if BUILDFLAG(ENABLE_OSR) if (view_proxy_.get()) { view_proxy_->SetBounds(popup_->popup_bounds_in_view()); } @@ -240,7 +240,7 @@ void AutofillPopupView::OnPaint(gfx::Canvas* canvas) { gfx::Canvas* draw_canvas = canvas; SkBitmap bitmap; -#if defined(ENABLE_OSR) +#if BUILDFLAG(ENABLE_OSR) std::unique_ptr paint_canvas; if (view_proxy_.get()) { bitmap.allocN32Pixels(popup_->popup_bounds_in_view().width(), @@ -260,7 +260,7 @@ void AutofillPopupView::OnPaint(gfx::Canvas* canvas) { DrawAutofillEntry(draw_canvas, i, line_rect); } -#if defined(ENABLE_OSR) +#if BUILDFLAG(ENABLE_OSR) if (view_proxy_.get()) { view_proxy_->SetBounds(popup_->popup_bounds_in_view()); view_proxy_->SetBitmap(bitmap); diff --git a/atom/browser/ui/views/autofill_popup_view.h b/atom/browser/ui/views/autofill_popup_view.h index 548a5b47442..cf901479a44 100644 --- a/atom/browser/ui/views/autofill_popup_view.h +++ b/atom/browser/ui/views/autofill_popup_view.h @@ -9,18 +9,20 @@ #include "atom/browser/ui/autofill_popup.h" -#if defined(ENABLE_OSR) -#include "atom/browser/osr/osr_view_proxy.h" -#endif #include "base/optional.h" #include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/render_widget_host.h" +#include "electron/buildflags/buildflags.h" #include "ui/accessibility/ax_node_data.h" #include "ui/views/drag_controller.h" #include "ui/views/focus/widget_focus_manager.h" #include "ui/views/widget/widget_delegate.h" #include "ui/views/widget/widget_observer.h" +#if BUILDFLAG(ENABLE_OSR) +#include "atom/browser/osr/osr_view_proxy.h" +#endif + namespace atom { const int kPopupBorderThickness = 1; @@ -137,7 +139,7 @@ class AutofillPopupView : public views::WidgetDelegateView, // The index of the currently selected line base::Optional selected_line_; -#if defined(ENABLE_OSR) +#if BUILDFLAG(ENABLE_OSR) std::unique_ptr view_proxy_; #endif diff --git a/atom/browser/ui/webui/pdf_viewer_handler.h b/atom/browser/ui/webui/pdf_viewer_handler.h index f2cef7787c5..7d9d45317fa 100644 --- a/atom/browser/ui/webui/pdf_viewer_handler.h +++ b/atom/browser/ui/webui/pdf_viewer_handler.h @@ -5,10 +5,6 @@ #ifndef ATOM_BROWSER_UI_WEBUI_PDF_VIEWER_HANDLER_H_ #define ATOM_BROWSER_UI_WEBUI_PDF_VIEWER_HANDLER_H_ -#ifndef ENABLE_PDF_VIEWER -#error("This header can only be used when enable_pdf_viewer gyp flag is enabled") // NOLINT -#endif // defined(ENABLE_PDF_VIEWER) - #include #include diff --git a/atom/browser/ui/webui/pdf_viewer_ui.h b/atom/browser/ui/webui/pdf_viewer_ui.h index 5f58d73b5f8..f50a5800bde 100644 --- a/atom/browser/ui/webui/pdf_viewer_ui.h +++ b/atom/browser/ui/webui/pdf_viewer_ui.h @@ -5,10 +5,6 @@ #ifndef ATOM_BROWSER_UI_WEBUI_PDF_VIEWER_UI_H_ #define ATOM_BROWSER_UI_WEBUI_PDF_VIEWER_UI_H_ -#ifndef ENABLE_PDF_VIEWER -#error("This header can only be used when enable_pdf_viewer gyp flag is enabled") // NOLINT -#endif // defined(ENABLE_PDF_VIEWER) - #include #include diff --git a/atom/common/api/features.cc b/atom/common/api/features.cc index 6913249f40b..6256c504b8d 100644 --- a/atom/common/api/features.cc +++ b/atom/common/api/features.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. +#include "electron/buildflags/buildflags.h" #include "native_mate/dictionary.h" // clang-format off #include "atom/common/node_includes.h" // NOLINT(build/include_alpha) @@ -10,43 +11,23 @@ namespace { bool IsDesktopCapturerEnabled() { -#if defined(ENABLE_DESKTOP_CAPTURER) - return true; -#else - return false; -#endif + return BUILDFLAG(ENABLE_DESKTOP_CAPTURER); } bool IsOffscreenRenderingEnabled() { -#if defined(ENABLE_OSR) - return true; -#else - return false; -#endif + return BUILDFLAG(ENABLE_OSR); } bool IsPDFViewerEnabled() { -#if defined(ENABLE_PDF_VIEWER) - return true; -#else - return false; -#endif + return BUILDFLAG(ENABLE_PDF_VIEWER); } bool IsFakeLocationProviderEnabled() { -#if defined(OVERRIDE_LOCATION_PROVIDER) - return true; -#else - return false; -#endif + return BUILDFLAG(OVERRIDE_LOCATION_PROVIDER); } bool IsViewApiEnabled() { -#if defined(ENABLE_VIEW_API) - return true; -#else - return false; -#endif + return BUILDFLAG(ENABLE_VIEW_API); } void Initialize(v8::Local exports, diff --git a/atom/common/atom_constants.cc b/atom/common/atom_constants.cc index f5188983cc0..ad4d2523694 100644 --- a/atom/common/atom_constants.cc +++ b/atom/common/atom_constants.cc @@ -24,13 +24,13 @@ const char kSecureProtocolDescription[] = "The connection to this site is using a strong protocol version " "and cipher suite."; -#if defined(ENABLE_PDF_VIEWER) +#if BUILDFLAG(ENABLE_PDF_VIEWER) const char kPdfPluginMimeType[] = "application/x-google-chrome-pdf"; const char kPdfPluginPath[] = "chrome://pdf-viewer/"; const char kPdfPluginSrc[] = "src"; const char kPdfViewerUIOrigin[] = "chrome://pdf-viewer/"; const char kPdfViewerUIHost[] = "pdf-viewer"; -#endif // defined(ENABLE_PDF_VIEWER) +#endif // BUILDFLAG(ENABLE_PDF_VIEWER) } // namespace atom diff --git a/atom/common/atom_constants.h b/atom/common/atom_constants.h index 7ad948f43f9..93bd592588e 100644 --- a/atom/common/atom_constants.h +++ b/atom/common/atom_constants.h @@ -5,6 +5,8 @@ #ifndef ATOM_COMMON_ATOM_CONSTANTS_H_ #define ATOM_COMMON_ATOM_CONSTANTS_H_ +#include "electron/buildflags/buildflags.h" + namespace atom { // Header to ignore CORS. @@ -20,7 +22,7 @@ extern const char kValidCertificateDescription[]; extern const char kSecureProtocol[]; extern const char kSecureProtocolDescription[]; -#if defined(ENABLE_PDF_VIEWER) +#if BUILDFLAG(ENABLE_PDF_VIEWER) // The MIME type used for the PDF plugin. extern const char kPdfPluginMimeType[]; extern const char kPdfPluginPath[]; @@ -29,7 +31,7 @@ extern const char kPdfPluginSrc[]; // Constants for PDF viewer webui. extern const char kPdfViewerUIOrigin[]; extern const char kPdfViewerUIHost[]; -#endif // defined(ENABLE_PDF_VIEWER) +#endif // BUILDFLAG(ENABLE_PDF_VIEWER) } // namespace atom diff --git a/atom/common/node_bindings.cc b/atom/common/node_bindings.cc index c4cdf5692f1..5abe5d7208f 100644 --- a/atom/common/node_bindings.cc +++ b/atom/common/node_bindings.cc @@ -23,6 +23,7 @@ #include "base/trace_event/trace_event.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/content_paths.h" +#include "electron/buildflags/buildflags.h" #include "native_mate/dictionary.h" #include "atom/common/node_includes.h" @@ -81,10 +82,10 @@ // implementation when calling the NODE_BUILTIN_MODULE_CONTEXT_AWARE. #define V(modname) void _register_##modname(); ELECTRON_BUILTIN_MODULES(V) -#if defined(ENABLE_VIEW_API) +#if BUILDFLAG(ENABLE_VIEW_API) ELECTRON_VIEW_MODULES(V) #endif -#if defined(ENABLE_DESKTOP_CAPTURER) +#if BUILDFLAG(ENABLE_DESKTOP_CAPTURER) ELECTRON_DESKTOP_CAPTURER_MODULE(V) #endif #undef V @@ -182,10 +183,10 @@ NodeBindings::~NodeBindings() { void NodeBindings::RegisterBuiltinModules() { #define V(modname) _register_##modname(); ELECTRON_BUILTIN_MODULES(V) -#if defined(ENABLE_VIEW_API) +#if BUILDFLAG(ENABLE_VIEW_API) ELECTRON_VIEW_MODULES(V) #endif -#if defined(ENABLE_DESKTOP_CAPTURER) +#if BUILDFLAG(ENABLE_DESKTOP_CAPTURER) ELECTRON_DESKTOP_CAPTURER_MODULE(V) #endif #undef V diff --git a/atom/renderer/renderer_client_base.cc b/atom/renderer/renderer_client_base.cc index 4c2b0eea979..6bcc52a6c2b 100644 --- a/atom/renderer/renderer_client_base.cc +++ b/atom/renderer/renderer_client_base.cc @@ -25,6 +25,7 @@ #include "content/public/common/content_switches.h" #include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_view.h" +#include "electron/buildflags/buildflags.h" #include "native_mate/dictionary.h" #include "third_party/blink/public/web/blink.h" #include "third_party/blink/public/web/web_custom_element.h" // NOLINT(build/include_alpha) @@ -42,13 +43,13 @@ #include #endif -#if defined(ENABLE_PDF_VIEWER) +#if BUILDFLAG(ENABLE_PDF_VIEWER) #include "atom/common/atom_constants.h" -#endif // defined(ENABLE_PDF_VIEWER) +#endif // BUILDFLAG(ENABLE_PDF_VIEWER) -#if defined(ENABLE_PEPPER_FLASH) +#if BUILDFLAG(ENABLE_PEPPER_FLASH) #include "chrome/renderer/pepper/pepper_helper.h" -#endif // defined(ENABLE_PEPPER_FLASH) +#endif // BUILDFLAG(ENABLE_PEPPER_FLASH) namespace atom { @@ -165,17 +166,17 @@ void RendererClientBase::RenderFrameCreated( #if defined(TOOLKIT_VIEWS) new AutofillAgent(render_frame); #endif -#if defined(ENABLE_PEPPER_FLASH) +#if BUILDFLAG(ENABLE_PEPPER_FLASH) new PepperHelper(render_frame); #endif new ContentSettingsObserver(render_frame); new printing::PrintWebViewHelper(render_frame); -#if defined(ENABLE_PDF_VIEWER) +#if BUILDFLAG(ENABLE_PDF_VIEWER) // Allow access to file scheme from pdf viewer. blink::WebSecurityPolicy::AddOriginAccessWhitelistEntry( GURL(kPdfViewerUIOrigin), "file", "", true); -#endif // defined(ENABLE_PDF_VIEWER) +#endif // BUILDFLAG(ENABLE_PDF_VIEWER) } void RendererClientBase::RenderViewCreated(content::RenderView* render_view) { @@ -212,9 +213,9 @@ bool RendererClientBase::OverrideCreatePlugin( blink::WebPlugin** plugin) { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); if (params.mime_type.Utf8() == content::kBrowserPluginMimeType || -#if defined(ENABLE_PDF_VIEWER) +#if BUILDFLAG(ENABLE_PDF_VIEWER) params.mime_type.Utf8() == kPdfPluginMimeType || -#endif // defined(ENABLE_PDF_VIEWER) +#endif // BUILDFLAG(ENABLE_PDF_VIEWER) command_line->HasSwitch(switches::kEnablePlugins)) return false; diff --git a/brightray/common/main_delegate.cc b/brightray/common/main_delegate.cc index 22f8a58876b..6842b4e2aa5 100644 --- a/brightray/common/main_delegate.cc +++ b/brightray/common/main_delegate.cc @@ -12,6 +12,7 @@ #include "brightray/browser/browser_client.h" #include "brightray/common/content_client.h" #include "content/public/common/content_switches.h" +#include "electron/buildflags/buildflags.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_switches.h" @@ -60,7 +61,7 @@ void LoadResourceBundle(const std::string& locale) { bundle.ReloadLocaleResources(locale); bundle.AddDataPackFromPath(pak_dir.Append(FILE_PATH_LITERAL("resources.pak")), ui::SCALE_FACTOR_NONE); -#if defined(ENABLE_PDF_VIEWER) +#if BUILDFLAG(ENABLE_PDF_VIEWER) NOTIMPLEMENTED() << "Hi, whoever's fixing PDF support! Thanks! The pdf " "viewer resources haven't been ported over to the GN build yet, so " @@ -68,7 +69,7 @@ void LoadResourceBundle(const std::string& locale) { bundle.AddDataPackFromPath( pak_dir.Append(FILE_PATH_LITERAL("pdf_viewer_resources.pak")), ui::GetSupportedScaleFactors()[0]); -#endif // defined(ENABLE_PDF_VIEWER) +#endif // BUILDFLAG(ENABLE_PDF_VIEWER) } MainDelegate::MainDelegate() {} diff --git a/buildflags/BUILD.gn b/buildflags/BUILD.gn new file mode 100644 index 00000000000..c28b53b6f9e --- /dev/null +++ b/buildflags/BUILD.gn @@ -0,0 +1,20 @@ +# Copyright (c) 2018 GitHub, Inc. +# Use of this source code is governed by the MIT license that can be +# found in the LICENSE file. + +import("//build/buildflag_header.gni") +import("//electron/buildflags/buildflags.gni") + +buildflag_header("buildflags") { + header = "buildflags.h" + + flags = [ + "ENABLE_DESKTOP_CAPTURER=$enable_desktop_capturer", + "ENABLE_RUN_AS_NODE=$enable_run_as_node", + "ENABLE_OSR=$enable_osr", + "ENABLE_VIEW_API=$enable_view_api", + "ENABLE_PEPPER_FLASH=$enable_pepper_flash", + "ENABLE_PDF_VIEWER=$enable_pdf_viewer", + "OVERRIDE_LOCATION_PROVIDER=$enable_fake_location_provider", + ] +} diff --git a/buildflags/buildflags.gni b/buildflags/buildflags.gni new file mode 100644 index 00000000000..2603b7088be --- /dev/null +++ b/buildflags/buildflags.gni @@ -0,0 +1,25 @@ +# Copyright (c) 2018 GitHub, Inc. +# Use of this source code is governed by the MIT license that can be +# found in the LICENSE file. + +declare_args() { + enable_desktop_capturer = true + + # Allow running Electron as a node binary. + enable_run_as_node = true + + enable_osr = true + + enable_view_api = false + + enable_pdf_viewer = false + + # Provide a fake location provider for mocking + # the geolocation responses. Disable it if you + # need to test with chromium's location provider. + # Should not be enabled for release build. + enable_fake_location_provider = !is_official_build + + # Enable flash plugin support. + enable_pepper_flash = true +} diff --git a/chromium_src/components/pdf/renderer/pepper_pdf_host.cc b/chromium_src/components/pdf/renderer/pepper_pdf_host.cc index f6cff468787..96385148c4f 100644 --- a/chromium_src/components/pdf/renderer/pepper_pdf_host.cc +++ b/chromium_src/components/pdf/renderer/pepper_pdf_host.cc @@ -2,10 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ENABLE_PDF_VIEWER -#error("This header can only be used when enable_pdf_viewer gyp flag is enabled") -#endif // defined(ENABLE_PDF_VIEWER) - #include "components/pdf/renderer/pepper_pdf_host.h" #include "atom/common/api/api_messages.h" diff --git a/chromium_src/components/pdf/renderer/pepper_pdf_host.h b/chromium_src/components/pdf/renderer/pepper_pdf_host.h index 78b12dbb109..0d6ef4d0340 100644 --- a/chromium_src/components/pdf/renderer/pepper_pdf_host.h +++ b/chromium_src/components/pdf/renderer/pepper_pdf_host.h @@ -2,10 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ENABLE_PDF_VIEWER -#error("This header can only be used when enable_pdf_viewer gyp flag is enabled") -#endif // defined(ENABLE_PDF_VIEWER) - #ifndef COMPONENTS_PDF_RENDERER_PEPPER_PDF_HOST_H_ #define COMPONENTS_PDF_RENDERER_PEPPER_PDF_HOST_H_