build: define compile time features with buildflag header (#14840)

* build: define compile time features with buildflag header

* refactor: switch to BUILDFLAG(ENABLE_DESKTOP_CAPTURER)

* refactor: switch to BUILDFLAG(ENABLE_RUN_AS_NODE)

* refactor: switch to BUILDFLAG(ENABLE_OSR)

* refactor: switch to BUILDFLAG(ENABLE_VIEW_API)

* refactor: switch to BUILDFLAG(ENABLE_PEPPER_FLASH)

* refactor: switch to BUILDFLAG(OVERRIDE_LOCATION_PROVIDER)

* refactor: switch to BUILDFLAG(ENABLE_PDF_VIEWER)
This commit is contained in:
Robo 2018-10-02 01:30:53 +05:30 committed by John Kleinschmidt
parent 4af922c9a2
commit a24ad6bc14
31 changed files with 172 additions and 209 deletions

View file

@ -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 <shlobj.h>
#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;