summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-04-03 18:25:42 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-04-04 08:18:59 +0000
commit03b20ee9c152414de89dbc28a5c8e3c98f66ae04 (patch)
treece85e68cc77309993d05cae1076f5c6275f48ef3 /src
parentbfe8875e2119568786b1e98710d44f898313add4 (diff)
Fix spellcheck feature check
Was changed to generated buildflag headers instead of command line defines. Task-number: QTBUG-59687 Change-Id: Iead64f5321d000c07172ee27a0032394527ec501 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/core/browser_context_adapter.cpp8
-rw-r--r--src/core/browser_context_qt.cpp2
-rw-r--r--src/core/content_browser_client_qt.cpp9
-rw-r--r--src/core/content_main_delegate_qt.cpp2
-rw-r--r--src/core/renderer/content_renderer_client_qt.cpp6
-rw-r--r--src/core/renderer/content_renderer_client_qt.h5
-rw-r--r--src/core/web_contents_adapter.cpp2
-rw-r--r--src/core/web_contents_view_qt.cpp5
-rw-r--r--src/core/web_engine_library_info.cpp5
9 files changed, 24 insertions, 20 deletions
diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp
index 1bb90aff..1da18658 100644
--- a/src/core/browser_context_adapter.cpp
+++ b/src/core/browser_context_adapter.cpp
@@ -494,14 +494,14 @@ void BrowserContextAdapter::clearHttpCache()
void BrowserContextAdapter::setSpellCheckLanguages(const QStringList &languages)
{
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
m_browserContext->setSpellCheckLanguages(languages);
#endif
}
QStringList BrowserContextAdapter::spellCheckLanguages() const
{
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
return m_browserContext->spellCheckLanguages();
#else
return QStringList();
@@ -510,14 +510,14 @@ QStringList BrowserContextAdapter::spellCheckLanguages() const
void BrowserContextAdapter::setSpellCheckEnabled(bool enabled)
{
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
m_browserContext->setSpellCheckEnabled(enabled);
#endif
}
bool BrowserContextAdapter::isSpellCheckEnabled() const
{
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
return m_browserContext->isSpellCheckEnabled();
#else
return false;
diff --git a/src/core/browser_context_qt.cpp b/src/core/browser_context_qt.cpp
index 8823e989..133006d7 100644
--- a/src/core/browser_context_qt.cpp
+++ b/src/core/browser_context_qt.cpp
@@ -78,7 +78,7 @@ BrowserContextQt::BrowserContextQt(BrowserContextAdapter *adapter)
factory.set_user_prefs(m_prefStore);
scoped_refptr<PrefRegistrySimple> registry(new PrefRegistrySimple());
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
// Initial spellcheck settings
registry->RegisterListPref(prefs::kSpellCheckDictionaries, new base::ListValue());
registry->RegisterStringPref(prefs::kAcceptLanguages, std::string());
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index 1ae6f130..b45463d7 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -42,9 +42,10 @@
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/threading/thread_restrictions.h"
-#if defined(ENABLE_SPELLCHECK)
+#include "components/spellcheck/spellcheck_build_features.h"
+#if BUILDFLAG(ENABLE_SPELLCHECK)
#include "chrome/browser/spellchecker/spellcheck_message_filter.h"
-#if defined(USE_BROWSER_SPELLCHECKER)
+#if BUILDFLAG(USE_BROWSER_SPELLCHECKER)
#include "chrome/browser/spellchecker/spellcheck_message_filter_platform.h"
#endif
#endif
@@ -414,11 +415,11 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost*
#if defined(ENABLE_PEPPER_CDMS)
host->AddFilter(new BrowserMessageFilterQt(id));
#endif
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
// SpellCheckMessageFilter is required for both Hunspell and Native configurations.
host->AddFilter(new SpellCheckMessageFilter(id));
#endif
-#if defined(Q_OS_MACOS) && defined(ENABLE_SPELLCHECK) && defined(USE_BROWSER_SPELLCHECKER)
+#if defined(Q_OS_MACOS) && BUILDFLAG(ENABLE_SPELLCHECK) && BUILDFLAG(USE_BROWSER_SPELLCHECKER)
host->AddFilter(new SpellCheckMessageFilterPlatform(id));
#endif
#if BUILDFLAG(ENABLE_BASIC_PRINTING)
diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp
index fa55597d..38f66d64 100644
--- a/src/core/content_main_delegate_qt.cpp
+++ b/src/core/content_main_delegate_qt.cpp
@@ -175,7 +175,7 @@ bool ContentMainDelegateQt::BasicStartupComplete(int *exit_code)
SafeOverridePath(base::DIR_QT_LIBRARY_DATA, WebEngineLibraryInfo::getPath(base::DIR_QT_LIBRARY_DATA));
#endif
SafeOverridePath(ui::DIR_LOCALES, WebEngineLibraryInfo::getPath(ui::DIR_LOCALES));
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
SafeOverridePath(base::DIR_APP_DICTIONARIES, WebEngineLibraryInfo::getPath(base::DIR_APP_DICTIONARIES));
#endif
SetContentClient(new ContentClientQt);
diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp
index 09d47380..93badf85 100644
--- a/src/core/renderer/content_renderer_client_qt.cpp
+++ b/src/core/renderer/content_renderer_client_qt.cpp
@@ -44,7 +44,7 @@
#include "base/strings/string_split.h"
#include "base/strings/utf_string_conversions.h"
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
#include "components/spellcheck/renderer/spellcheck.h"
#include "components/spellcheck/renderer/spellcheck_provider.h"
#endif
@@ -104,7 +104,7 @@ void ContentRendererClientQt::RenderThreadStarted()
m_visitedLinkSlave->GetBindCallback());
renderThread->AddObserver(UserResourceController::instance());
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
m_spellCheck.reset(new SpellCheck());
renderThread->AddObserver(m_spellCheck.data());
#endif
@@ -120,7 +120,7 @@ void ContentRendererClientQt::RenderViewCreated(content::RenderView* render_view
new RenderViewObserverQt(render_view, m_webCacheImpl.data());
new WebChannelIPCTransport(render_view);
UserResourceController::instance()->renderViewCreated(render_view);
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
new SpellCheckProvider(render_view, m_spellCheck.data());
#endif
diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h
index 72b4e406..c373665e 100644
--- a/src/core/renderer/content_renderer_client_qt.h
+++ b/src/core/renderer/content_renderer_client_qt.h
@@ -40,6 +40,7 @@
#define CONTENT_RENDERER_CLIENT_QT_H
#include "content/public/renderer/content_renderer_client.h"
+#include "components/spellcheck/spellcheck_build_features.h"
#include <QtGlobal>
#include <QScopedPointer>
@@ -52,7 +53,7 @@ namespace web_cache {
class WebCacheImpl;
}
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
class SpellCheck;
#endif
@@ -80,7 +81,7 @@ public:
private:
QScopedPointer<visitedlink::VisitedLinkSlave> m_visitedLinkSlave;
QScopedPointer<web_cache::WebCacheImpl> m_webCacheImpl;
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
QScopedPointer<SpellCheck> m_spellCheck;
#endif
};
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 496bbb18..d67d972c 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -1347,7 +1347,7 @@ void WebContentsAdapter::leaveDrag()
void WebContentsAdapter::replaceMisspelling(const QString &word)
{
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
Q_D(WebContentsAdapter);
d->webContents->ReplaceMisspelling(toString16(word));
#endif
diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp
index daf2d48b..4f921bd0 100644
--- a/src/core/web_contents_view_qt.cpp
+++ b/src/core/web_contents_view_qt.cpp
@@ -46,6 +46,7 @@
#include "web_contents_adapter.h"
#include "web_engine_context.h"
+#include "components/spellcheck/spellcheck_build_features.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/public/common/context_menu_params.h"
#include <ui/gfx/image/image_skia.h>
@@ -168,7 +169,7 @@ static inline WebEngineContextMenuData fromParams(const content::ContextMenuPara
ret.setMediaFlags((WebEngineContextMenuData::MediaFlags)params.media_flags);
ret.setSuggestedFileName(toQt(params.suggested_filename.data()));
ret.setIsEditable(params.is_editable);
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
ret.setMisspelledWord(toQt(params.misspelled_word));
ret.setSpellCheckerSuggestions(fromVector(params.dictionary_suggestions));
#endif
@@ -178,7 +179,7 @@ static inline WebEngineContextMenuData fromParams(const content::ContextMenuPara
void WebContentsViewQt::ShowContextMenu(content::RenderFrameHost *, const content::ContextMenuParams &params)
{
WebEngineContextMenuData contextMenuData(fromParams(params));
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
// Do not use params.spellcheck_enabled, since it is never
// correctly initialized for chrome asynchronous spellchecking.
// Even fixing the initialization in ContextMenuClientImpl::showContextMenu
diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp
index 40977812..f46f8f42 100644
--- a/src/core/web_engine_library_info.cpp
+++ b/src/core/web_engine_library_info.cpp
@@ -43,6 +43,7 @@
#include "base/base_paths.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
+#include "components/spellcheck/spellcheck_build_features.h"
#include "content/public/common/content_paths.h"
#include "ui/base/ui_base_paths.h"
#include "ui/base/ui_base_switches.h"
@@ -206,7 +207,7 @@ QString localesPath()
#endif
}
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
QString dictionariesPath()
{
static QString potentialDictionariesPath;
@@ -333,7 +334,7 @@ base::FilePath WebEngineLibraryInfo::getPath(int key)
return toFilePath(icuDataPath());
case ui::DIR_LOCALES:
return toFilePath(localesPath());
-#if defined(ENABLE_SPELLCHECK)
+#if BUILDFLAG(ENABLE_SPELLCHECK)
case base::DIR_APP_DICTIONARIES:
return toFilePath(dictionariesPath());
#endif