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

@ -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;
}