summaryrefslogtreecommitdiffstats
path: root/src/core/web_contents_adapter.cpp
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2018-06-15 18:51:21 +0200
committerMichal Klocek <michal.klocek@qt.io>2018-07-02 10:31:10 +0000
commitec127d7e4898940116be9fbbc8dc94b4cfa9b18c (patch)
treeaf9dc33792e1948bdc7362925ab68f74ee9085a8 /src/core/web_contents_adapter.cpp
parent59b8f28d029e45ac3b3e95edda82e6607a880979 (diff)
Migrate from BUILDFLAG to QT_CONFIG
During configuration we mapped qt webengine fetures to chromium ones and passed them to gn. We used BUILDFLAG to optionally compile code in core. Use QT_CONFIG directly for qt files and add config sanity checks to make sure requested features are present. Change-Id: I930df114ac9aec8e73139ea9135925fc3ad8e39c Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'src/core/web_contents_adapter.cpp')
-rw-r--r--src/core/web_contents_adapter.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index f3bba89a8..ab96ae10e 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -200,7 +200,7 @@ static void callbackOnEvaluateJS(WebContentsAdapterClient *adapterClient, quint6
adapterClient->didRunJavaScript(requestId, fromJSValue(result));
}
-#if BUILDFLAG(ENABLE_BASIC_PRINTING)
+#if QT_CONFIG(webengine_printing_and_pdf)
static void callbackOnPrintingFinished(WebContentsAdapterClient *adapterClient,
int requestId,
const std::vector<char>& result)
@@ -440,7 +440,7 @@ void WebContentsAdapter::initialize(content::SiteInstance *site)
rendererPrefs->caret_blink_interval = base::TimeDelta::FromMillisecondsD(0.5 * static_cast<double>(qtCursorFlashTime));
rendererPrefs->user_agent_override = m_browserContextAdapter->httpUserAgent().toStdString();
rendererPrefs->accept_languages = m_browserContextAdapter->httpAcceptLanguageWithoutQualities().toStdString();
-#if BUILDFLAG(ENABLE_WEBRTC)
+#if QT_CONFIG(webengine_webrtc)
base::CommandLine* commandLine = base::CommandLine::ForCurrentProcess();
if (commandLine->HasSwitch(switches::kForceWebRtcIPHandlingPolicy))
rendererPrefs->webrtc_ip_handling_policy = commandLine->GetSwitchValueASCII(switches::kForceWebRtcIPHandlingPolicy);
@@ -471,9 +471,9 @@ void WebContentsAdapter::initialize(content::SiteInstance *site)
// This should only be necessary after having restored the history to a new WebContentsAdapter.
m_webContents->GetController().LoadIfNecessary();
-#if BUILDFLAG(ENABLE_BASIC_PRINTING)
+#if QT_CONFIG(webengine_printing_and_pdf)
PrintViewManagerQt::CreateForWebContents(webContents());
-#endif // BUILDFLAG(ENABLE_BASIC_PRINTING)
+#endif
// Create an instance of WebEngineVisitedLinksManager to catch the first
// content::NOTIFICATION_RENDERER_PROCESS_CREATED event. This event will
@@ -1166,7 +1166,7 @@ void WebContentsAdapter::wasHidden()
void WebContentsAdapter::printToPDF(const QPageLayout &pageLayout, const QString &filePath)
{
-#if BUILDFLAG(ENABLE_BASIC_PRINTING)
+#if QT_CONFIG(webengine_printing_and_pdf)
CHECK_INITIALIZED();
PrintViewManagerQt::PrintToPDFFileCallback callback = base::Bind(&callbackOnPdfSavingFinished,
m_adapterClient,
@@ -1175,14 +1175,14 @@ void WebContentsAdapter::printToPDF(const QPageLayout &pageLayout, const QString
true,
filePath,
callback);
-#endif // if BUILDFLAG(ENABLE_BASIC_PRINTING)
+#endif // QT_CONFIG(webengine_printing_and_pdf)
}
quint64 WebContentsAdapter::printToPDFCallbackResult(const QPageLayout &pageLayout,
bool colorMode,
bool useCustomMargins)
{
-#if BUILDFLAG(ENABLE_BASIC_PRINTING)
+#if QT_CONFIG(webengine_printing_and_pdf)
CHECK_INITIALIZED(0);
PrintViewManagerQt::PrintToPDFCallback callback = base::Bind(&callbackOnPrintingFinished,
m_adapterClient,
@@ -1196,7 +1196,7 @@ quint64 WebContentsAdapter::printToPDFCallbackResult(const QPageLayout &pageLayo
Q_UNUSED(pageLayout);
Q_UNUSED(colorMode);
return 0;
-#endif // if BUILDFLAG(ENABLE_BASIC_PRINTING)
+#endif // QT_CONFIG(webengine_printing_and_pdf)
}
QPointF WebContentsAdapter::lastScrollOffset() const
@@ -1556,7 +1556,7 @@ void WebContentsAdapter::leaveDrag()
void WebContentsAdapter::replaceMisspelling(const QString &word)
{
-#if BUILDFLAG(ENABLE_SPELLCHECK)
+#if QT_CONFIG(webengine_spellchecker)
CHECK_INITIALIZED();
m_webContents->ReplaceMisspelling(toString16(word));
#endif