diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-04-19 00:02:16 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-04-19 00:02:16 +0200 |
commit | 2ba0e25a0c6fee7e2144f1fc8b577f73e1155e6d (patch) | |
tree | 504e526cbb840733a316714c890fb25d1d64eb1c /src/core | |
parent | 2c246e60e886b082e7438cf8f68cdc22bc919fd9 (diff) | |
parent | f5ec28285ab7f71d6d75af963ae499603da6630e (diff) |
Merge remote-tracking branch 'origin/5.5' into dev
Change-Id: I78c25caf30923fc1101b137f9abc3993e3cf0600
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/browser_accessibility_manager_qt.cpp | 6 | ||||
-rw-r--r-- | src/core/browser_accessibility_qt.cpp | 1 | ||||
-rw-r--r-- | src/core/chromium_overrides.cpp | 21 | ||||
-rw-r--r-- | src/core/config/embedded_android.pri | 74 | ||||
-rw-r--r-- | src/core/core_common.pri | 4 | ||||
-rw-r--r-- | src/core/core_gyp_generator.pro | 1 | ||||
-rw-r--r-- | src/core/gl_context_qt.cpp | 4 | ||||
-rw-r--r-- | src/core/gyp_run.pro | 3 | ||||
-rw-r--r-- | src/core/qtwebengine.gypi | 14 | ||||
-rw-r--r-- | src/core/qtwebengine_extras.gypi | 9 | ||||
-rw-r--r-- | src/core/render_widget_host_view_qt.h | 6 | ||||
-rw-r--r-- | src/core/surface_factory_qt.cpp | 12 | ||||
-rw-r--r-- | src/core/surface_factory_qt.h | 4 | ||||
-rw-r--r-- | src/core/web_engine_context.cpp | 7 | ||||
-rw-r--r-- | src/core/web_engine_context.h | 3 | ||||
-rw-r--r-- | src/core/web_engine_library_info.cpp | 89 |
16 files changed, 79 insertions, 179 deletions
diff --git a/src/core/browser_accessibility_manager_qt.cpp b/src/core/browser_accessibility_manager_qt.cpp index 7b0e8b49e..7c59db110 100644 --- a/src/core/browser_accessibility_manager_qt.cpp +++ b/src/core/browser_accessibility_manager_qt.cpp @@ -55,12 +55,16 @@ BrowserAccessibilityManager* BrowserAccessibilityManager::Create( #endif // QT_NO_ACCESSIBILITY } -#ifndef QT_NO_ACCESSIBILITY BrowserAccessibility *BrowserAccessibilityFactoryQt::Create() { +#ifndef QT_NO_ACCESSIBILITY return new BrowserAccessibilityQt(); +#else + return 0; +#endif // QT_NO_ACCESSIBILITY } +#ifndef QT_NO_ACCESSIBILITY BrowserAccessibilityManagerQt::BrowserAccessibilityManagerQt( QObject* parentObject, const ui::AXTreeUpdate& initialTree, diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp index 5b787b67d..7cd5ac21f 100644 --- a/src/core/browser_accessibility_qt.cpp +++ b/src/core/browser_accessibility_qt.cpp @@ -39,6 +39,7 @@ // found in the LICENSE file. #include "browser_accessibility_qt.h" + #ifndef QT_NO_ACCESSIBILITY #include "third_party/WebKit/public/web/WebAXEnums.h" diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp index 3e2008bbf..9340923df 100644 --- a/src/core/chromium_overrides.cpp +++ b/src/core/chromium_overrides.cpp @@ -50,10 +50,6 @@ #include <QFontDatabase> #include <QStringList> -#if defined(OS_ANDROID) -#include "media/video/capture/fake_video_capture_device.h" -#endif - #if defined(USE_X11) #include "ui/gfx/x/x11_types.h" #endif @@ -193,20 +189,3 @@ PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string&, int) } // namespace gfx #endif // defined(USE_AURA) && !defined(USE_OZONE) - -#if defined(OS_ANDROID) -namespace ui { -bool GrabViewSnapshot(gfx::NativeView /*view*/, std::vector<unsigned char>* /*png_representation*/, const gfx::Rect& /*snapshot_bounds*/) -{ - NOTIMPLEMENTED(); - return false; -} -} - -namespace media { -const std::string FakeVideoCaptureDevice::Name::GetModel() const -{ - return ""; -} -} -#endif diff --git a/src/core/config/embedded_android.pri b/src/core/config/embedded_android.pri deleted file mode 100644 index 4684c2aef..000000000 --- a/src/core/config/embedded_android.pri +++ /dev/null @@ -1,74 +0,0 @@ - -CC = $$which($$QMAKE_CC) -ANDROID_TOOLCHAIN = $$dirname(CC) -TOOLCHAIN_SYSROOT = $$ANDROID_BUILD_TOP - -GYP_ARGS += "-D qt_os=\"embedded_android\" -D android_src=\"$${TOOLCHAIN_SYSROOT}\" -D android_toolchain=\"$${ANDROID_TOOLCHAIN}\"" \ - "-D android_ndk_root=\"$${TOOLCHAIN_SYSROOT}\" -D android_product_out=\"$${ANDROID_PRODUCT_OUT}\"" - -GYP_CONFIG += \ - OS=android_no_sdk \ - android_webview_build=0 \ - build_ffmpegsumo=0 \ - configuration_policy=0 \ - disable_nacl=1 \ - embedded=1 \ - enable_autofill_dialog=0 \ - enable_automation=0 \ - enable_background=0 \ - enable_captive_portal_detection=0 \ - enable_extensions=0 \ - enable_google_now=0 \ - enable_language_detection=0 \ - enable_managed_users=0 \ - enable_plugin_installation=0 \ - enable_plugins=0 \ - enable_printing=0 \ - enable_session_service=0 \ - enable_spellcheck=0 \ - enable_task_manager=0 \ - enable_themes=0 \ - enable_webrtc=0 \ - gcc_version=46 \ - gtest_target_type=none \ - input_speech=0 \ - java_bridge=0 \ - media_use_ffmpeg=0 \ - media_use_libvpx=0 \ - native_discardable_memory=1 \ - native_memory_pressure_signals=1 \ - notifications=0 \ - p2p_apis=0 \ - posix_avoid_mmap=1 \ - proprietary_codecs=0 \ - remoting=0 \ - safe_browsing=0 \ - skia_os=android \ - test_isolation_mode=noop \ - use_aura=0 \ - use_cairo=0 \ - use_canvas_skia=0 \ - use_cups=0 \ - use_default_render_theme=1 \ - use_ffmpeg=0 \ - use_gconf=0 \ - use_gio=0 \ - use_glib=0 \ - use_gnome_keyring=0 \ - use_kerberos=0 \ - use_libffmpeg=0 \ - use_openmax_dl_fft=0 \ - use_openssl=1 \ - use_openssl_certs=1 \ - use_ozone=0 \ - use_pango=0 \ - use_pulseaudio=0 \ - use_system_expat=1 \ - use_system_icu=0 \ - use_system_libjpeg=0 \ - use_system_skia=0 \ - use_system_sqlite=0 \ - use_system_stlport=0 \ - use_x11=0 \ - v8_use_snapshot=false \ - want_separate_host_toolset=0 \ diff --git a/src/core/core_common.pri b/src/core/core_common.pri index 2e9ee4198..cefde4302 100644 --- a/src/core/core_common.pri +++ b/src/core/core_common.pri @@ -5,4 +5,8 @@ TARGET = QtWebEngineCore QT += qml quick webchannel QT_PRIVATE += quick-private gui-private core-private +# Make QtCreator happy. +CHROMIUM_SRC_DIR = $$QTWEBENGINE_ROOT/$${getChromiumSrcDir()} +INCLUDEPATH += $$CHROMIUM_SRC_DIR + qtHaveModule(positioning):QT += positioning diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro index 7ca57f190..07ce48317 100644 --- a/src/core/core_gyp_generator.pro +++ b/src/core/core_gyp_generator.pro @@ -128,6 +128,7 @@ HEADERS = \ process_main.h \ qrc_protocol_handler_qt.h \ qt_render_view_observer_host.h \ + qtwebenginecoreglobal.h \ render_widget_host_view_qt.h \ render_widget_host_view_qt_delegate.h \ renderer/content_renderer_client_qt.h \ diff --git a/src/core/gl_context_qt.cpp b/src/core/gl_context_qt.cpp index b21ef8539..baccddc9d 100644 --- a/src/core/gl_context_qt.cpp +++ b/src/core/gl_context_qt.cpp @@ -134,7 +134,7 @@ void* GLContextHelper::getNativeDisplay() QT_END_NAMESPACE -#if defined(USE_OZONE) || defined(OS_ANDROID) || defined(OS_WIN) +#if defined(USE_OZONE) || defined(OS_WIN) namespace gfx { @@ -158,4 +158,4 @@ scoped_refptr<GLContext> GLContext::CreateGLContext(GLShareGroup* share_group, G } // namespace gfx -#endif // defined(USE_OZONE) || defined(OS_ANDROID) || defined(OS_WIN) +#endif // defined(USE_OZONE) || defined(OS_WIN) diff --git a/src/core/gyp_run.pro b/src/core/gyp_run.pro index 8d4d77351..e1691faa6 100644 --- a/src/core/gyp_run.pro +++ b/src/core/gyp_run.pro @@ -7,9 +7,8 @@ TEMPLATE = aux cross_compile { GYP_ARGS = "-D qt_cross_compile=1" posix: GYP_ARGS += "-D os_posix=1" - android: include(config/embedded_android.pri) qnx: include(config/embedded_qnx.pri) - linux:!android: include(config/embedded_linux.pri) + linux: include(config/embedded_linux.pri) } else { # !cross_compile GYP_ARGS = "-D qt_cross_compile=0" diff --git a/src/core/qtwebengine.gypi b/src/core/qtwebengine.gypi index cb9ea435b..15da6b6ec 100644 --- a/src/core/qtwebengine.gypi +++ b/src/core/qtwebengine.gypi @@ -55,18 +55,8 @@ '<(chromium_src_dir)/base/allocator/allocator.gyp:allocator', ], }], - # embedded_android and embedded_linux need some additional options. - ['qt_os=="embedded_linux" or qt_os=="embedded_android"', { - 'conditions': [ - ['qt_os=="embedded_android"', { - 'dependencies': [ - '<(chromium_src_dir)/ui/ozone/ozone.gyp:ozone_base', - '<(chromium_src_dir)/third_party/ashmem/ashmem.gyp:ashmem', - '<(chromium_src_dir)/third_party/freetype/freetype.gyp:ft2', - '<(chromium_src_dir)/third_party/android_tools/ndk/android_tools_ndk.gyp:cpu_features', - ], - }], - ], + # embedded_linux need some additional options. + ['qt_os=="embedded_linux"', { 'configurations': { 'Debug_Base': { # Reduce the binary size. diff --git a/src/core/qtwebengine_extras.gypi b/src/core/qtwebengine_extras.gypi index c128f289a..e28d6436e 100644 --- a/src/core/qtwebengine_extras.gypi +++ b/src/core/qtwebengine_extras.gypi @@ -6,7 +6,6 @@ 'target_defaults': { # patterns used to exclude chromium files from the build when we have a drop-in replacement 'sources/': [ - ['exclude', 'clipboard/clipboard_android.cc$'], ['exclude', 'clipboard/clipboard_aura.cc$'], ['exclude', 'clipboard/clipboard_aurax11.cc$'], ['exclude', 'clipboard/clipboard_gtk.cc$'], @@ -16,38 +15,31 @@ ['exclude', 'dragdrop/os_exchange_data_provider_aurax11\\.(cc|h)$'], ['exclude', 'dragdrop/os_exchange_data_provider_win\\.(cc|h)$'], ['exclude', 'dragdrop/os_exchange_data_provider_mac\\.(mm|h)$'], - ['exclude', 'resource/resource_bundle_android.cc$'], ['exclude', 'resource/resource_bundle_auralinux.cc$'], ['exclude', 'resource/resource_bundle_gtk.cc$'], ['exclude', 'resource/resource_bundle_mac.mm$'], ['exclude', 'resource/resource_bundle_win.cc$'], - ['exclude', 'browser/web_contents/web_contents_view_android\\.(cc|h)$'], ['exclude', 'browser/web_contents/web_contents_view_aura\\.(cc|h)$'], ['exclude', 'browser/web_contents/web_contents_view_gtk\\.(cc|h)$'], ['exclude', 'browser/web_contents/web_contents_view_mac\\.(mm|h)$'], ['exclude', 'browser/web_contents/web_contents_view_win\\.(cc|h)$'], ['exclude', 'browser/renderer_host/gtk_im_context_wrapper\\.cc$'], - ['exclude', 'browser/renderer_host/native_web_keyboard_event_android.cc$'], ['exclude', 'browser/renderer_host/native_web_keyboard_event_aura.cc$'], ['exclude', 'browser/renderer_host/native_web_keyboard_event_mac.mm$'], ['exclude', 'browser/renderer_host/pepper/pepper_truetype_font_list_pango\\.cc$'], - ['exclude', 'browser/renderer_host/render_widget_host_view_android\\.(cc|h)$'], ['exclude', 'browser/renderer_host/render_widget_host_view_aura\\.(cc|h)$'], ['exclude', 'browser/renderer_host/render_widget_host_view_gtk\\.(cc|h)$'], ['exclude', 'browser/renderer_host/render_widget_host_view_mac\\.(mm|h)$'], ['exclude', 'browser/renderer_host/render_widget_host_view_win\\.(cc|h)$'], ['exclude', 'common/font_list_pango\\.cc$'], - ['exclude', 'browser/accessibility/browser_accessibility_android\\.(cc|h)$'], ['exclude', 'browser/accessibility/browser_accessibility_cocoa\\.(cc|h)$'], ['exclude', 'browser/accessibility/browser_accessibility_gtk\\.(cc|h)$'], ['exclude', 'browser/accessibility/browser_accessibility_mac\\.(cc|h)$'], ['exclude', 'browser/accessibility/browser_accessibility_win\\.(cc|h)$'], - ['exclude', 'browser/accessibility/browser_accessibility_manager_android\\.(cc|h)$'], ['exclude', 'browser/accessibility/browser_accessibility_manager_gtk\\.(cc|h)$'], ['exclude', 'browser/accessibility/browser_accessibility_manager_mac\\.(cc|h)$'], ['exclude', 'browser/accessibility/browser_accessibility_manager_win\\.(cc|h)$'], ['exclude', 'command_buffer/service/async_pixel_transfer_manager_egl\\.(cc|h)$'], - ['exclude', 'common/gpu/image_transport_surface_android\\.cc$'], ['exclude', 'common/gpu/image_transport_surface_linux\\.cc$'], ['exclude', 'common/gpu/image_transport_surface_win\\.cc$'], ['exclude', 'gl_surface_egl\\.cc$'], @@ -57,7 +49,6 @@ ['exclude', 'gl_surface_ozone\\.cc$'], # Avoid the ATL dependency to allow building with VS Express ['exclude', 'browser/accessibility/accessibility_tree_formatter\\.(cc|h)$',], - ['exclude', 'browser/accessibility/accessibility_tree_formatter_android\\.(cc|h)$',], ['exclude', 'browser/accessibility/accessibility_tree_formatter_mac\\.(mm|h)$',], ['exclude', 'browser/accessibility/accessibility_tree_formatter_utils_win\\.(cc|h)$',], ['exclude', 'browser/accessibility/accessibility_tree_formatter_win\\.(cc|h)$',], diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index 19b551b71..68330a486 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -184,12 +184,6 @@ public: virtual void WindowFrameChanged() Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED } #endif // defined(OS_MACOSX) -#if defined(OS_ANDROID) - virtual void ShowDisambiguationPopup(const gfx::Rect&, const SkBitmap&) Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED } - virtual void LockCompositingSurface() Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED } - virtual void UnlockCompositingSurface() Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED } -#endif // defined(OS_ANDROID) - #if defined(OS_WIN) #if defined(USE_AURA) virtual void SetParentNativeViewAccessible(gfx::NativeViewAccessible accessible_parent) Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED } diff --git a/src/core/surface_factory_qt.cpp b/src/core/surface_factory_qt.cpp index 963f7b517..40c65d9d3 100644 --- a/src/core/surface_factory_qt.cpp +++ b/src/core/surface_factory_qt.cpp @@ -45,7 +45,8 @@ #include <QGuiApplication> -#if defined(USE_OZONE) || defined(OS_ANDROID) +#if defined(USE_OZONE) + #include <EGL/egl.h> #ifndef QT_LIBDIR_EGL @@ -69,12 +70,6 @@ base::NativeLibrary LoadLibrary(const base::FilePath& filename) { bool SurfaceFactoryQt::LoadEGLGLES2Bindings(AddGLLibraryCallback add_gl_library, SetGLGetProcAddressProcCallback set_gl_get_proc_address) { -#if defined(OS_ANDROID) - // This is done in gl_implementation_android.cc for now. We might need to switch if we - // start supporting the emulator platform but that would be a more intrusive change. - Q_UNREACHABLE(); - return false; -#else base::FilePath libEGLPath = QtWebEngineCore::toFilePath(QT_LIBDIR_EGL); libEGLPath = libEGLPath.Append("libEGL.so"); base::NativeLibrary eglLibrary = LoadLibrary(libEGLPath); @@ -99,7 +94,6 @@ bool SurfaceFactoryQt::LoadEGLGLES2Bindings(AddGLLibraryCallback add_gl_library, gfx::AddGLNativeLibrary(eglLibrary); gfx::AddGLNativeLibrary(gles2Library); return true; -#endif // defined(OS_ANDROID) } intptr_t SurfaceFactoryQt::GetNativeDisplay() @@ -114,5 +108,5 @@ intptr_t SurfaceFactoryQt::GetNativeDisplay() } // namespace QtWebEngineCore -#endif // defined(USE_OZONE) || defined(OS_ANDROID) +#endif // defined(USE_OZONE) diff --git a/src/core/surface_factory_qt.h b/src/core/surface_factory_qt.h index 7d6f0435e..26cbf9a01 100644 --- a/src/core/surface_factory_qt.h +++ b/src/core/surface_factory_qt.h @@ -37,7 +37,7 @@ #ifndef SURFACE_FACTORY_QT #define SURFACE_FACTORY_QT -#if defined(USE_OZONE) || defined(OS_ANDROID) +#if defined(USE_OZONE) #include "ui/ozone/public/surface_factory_ozone.h" @@ -54,7 +54,7 @@ class SurfaceFactoryQt } // namespace QtWebEngineCore -#endif // defined(USE_OZONE) || defined(OS_ANDROID) +#endif // defined(USE_OZONE) #endif // SURFACE_FACTORY_QT diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index b830110a7..10d6bdd74 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -214,13 +214,6 @@ WebEngineContext::WebEngineContext() parsedCommandLine->AppendSwitchASCII(switches::kProfilerTiming, switches::kProfilerTimingDisabledValue); #endif -#if defined(OS_ANDROID) - // On eAndroid we use this to get the native display - // from Qt in GLSurfaceEGL::InitializeOneOff. - m_surfaceFactory.reset(new SurfaceFactoryQt()); - parsedCommandLine->AppendSwitch(switches::kDisableOverscrollEdgeEffect); -#endif - GLContextHelper::initialize(); if (usingANGLE() || usingSoftwareDynamicGL() || usingQtQuick2DRenderer()) { diff --git a/src/core/web_engine_context.h b/src/core/web_engine_context.h index a3795b0a9..f900c93d8 100644 --- a/src/core/web_engine_context.h +++ b/src/core/web_engine_context.h @@ -79,9 +79,6 @@ private: scoped_ptr<QtWebEngineCore::ContentMainDelegateQt> m_mainDelegate; scoped_ptr<content::ContentMainRunner> m_contentRunner; scoped_ptr<content::BrowserMainRunner> m_browserRunner; -#if defined(OS_ANDROID) - scoped_ptr<QtWebEngineCore::SurfaceFactoryQt> m_surfaceFactory; -#endif QObject* m_globalQObject; QExplicitlySharedDataPointer<QtWebEngineCore::BrowserContextAdapter> m_defaultBrowserContext; scoped_ptr<QtWebEngineCore::DevToolsHttpHandlerDelegateQt> m_devtools; diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp index ce862aae6..17f6b2a05 100644 --- a/src/core/web_engine_library_info.cpp +++ b/src/core/web_engine_library_info.cpp @@ -60,6 +60,11 @@ using namespace QtWebEngineCore; namespace { +QString fallbackDir() { + static QString directory = QDir::homePath() % QLatin1String("/.") % QCoreApplication::applicationName(); + return directory; +} + QString location(QLibraryInfo::LibraryLocation path) { #if defined(Q_OS_BLACKBERRY) @@ -173,7 +178,22 @@ QString pluginsPath() #if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) return getPath(frameworkBundle()) % QLatin1String("/Libraries"); #else - return location(QLibraryInfo::PluginsPath) % QLatin1String("/qtwebengine"); + static bool initialized = false; + static QString potentialPluginsPath = location(QLibraryInfo::PluginsPath) % QDir::separator() % QLatin1String("qtwebengine"); + + if (!initialized) { + initialized = true; + if (!QFileInfo::exists(potentialPluginsPath)) { + qWarning("Installed Qt plugins directory not found at location %s. Trying application directory...", qPrintable(potentialPluginsPath)); + potentialPluginsPath = QCoreApplication::applicationDirPath() % QDir::separator() % QLatin1String("qtwebengine"); + } + if (!QFileInfo::exists(potentialPluginsPath)) { + qWarning("Qt WebEngine Plugins directory not found at location %s. Trying fallback directory... Plugins as for example video codecs MAY NOT work.", qPrintable(potentialPluginsPath)); + potentialPluginsPath = fallbackDir(); + } + } + + return potentialPluginsPath; #endif } @@ -182,30 +202,48 @@ QString localesPath() #if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) return getResourcesPath(frameworkBundle()) % QLatin1String("/qtwebengine_locales"); #else - return location(QLibraryInfo::TranslationsPath) % QDir::separator() % QLatin1String("qtwebengine_locales"); -#endif -} + static bool initialized = false; + static QString potentialLocalesPath = location(QLibraryInfo::TranslationsPath) % QDir::separator() % QLatin1String("qtwebengine_locales"); -QString fallbackDir() { - static QString directory = QDir::homePath() % QLatin1String("/.") % QCoreApplication::applicationName(); - return directory; -} + if (!initialized) { + initialized = true; + if (!QFileInfo::exists(potentialLocalesPath)) { + qWarning("Installed Qt WebEngine locales directory not found at location %s. Trying application directory...", qPrintable(potentialLocalesPath)); + potentialLocalesPath = QCoreApplication::applicationDirPath() % QDir::separator() % QLatin1String("qtwebengine_locales"); + } + if (!QFileInfo::exists(potentialLocalesPath)) { + qWarning("Qt WebEngine locales directory not found at location %s. Trying fallback directory... Translations MAY NOT not be correct.", qPrintable(potentialLocalesPath)); + potentialLocalesPath = fallbackDir(); + } + } -} // namespace + return potentialLocalesPath; +#endif +} -#if defined(OS_ANDROID) -namespace base { -// Replace the Android base path provider that depends on jni. -// With this we avoid patching chromium which we would need since -// PathService registers PathProviderAndroid by default on Android. -bool PathProviderAndroid(int key, FilePath* result) +QString libraryDataPath() { - *result = WebEngineLibraryInfo::getPath(key); - return !(result->empty()); -} +#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) + return getResourcesPath(frameworkBundle()); +#else + static bool initialized = false; + static QString potentialDataPath = location(QLibraryInfo::DataPath); + if (!initialized) { + initialized = true; + if (!QFileInfo::exists(potentialDataPath)) { + qWarning("Qt WebEngine data directory not found at location %s. Trying application directory...", qPrintable(potentialDataPath)); + potentialDataPath = QCoreApplication::applicationDirPath(); + } + if (!QFileInfo::exists(potentialDataPath)) { + qWarning("Qt WebEngine data directory not found at location %s. Trying fallback directory... The application MAY NOT work.", qPrintable(potentialDataPath)); + potentialDataPath = fallbackDir(); + } + } + return potentialDataPath; +#endif } -#endif // defined(OS_ANDROID) +} // namespace base::FilePath WebEngineLibraryInfo::getPath(int key) { @@ -232,18 +270,7 @@ base::FilePath WebEngineLibraryInfo::getPath(int key) directory = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); break; case base::DIR_QT_LIBRARY_DATA: -#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) - return toFilePath(getResourcesPath(frameworkBundle())); -#else - return toFilePath(location(QLibraryInfo::DataPath)); -#endif -#if defined(OS_ANDROID) - case base::DIR_SOURCE_ROOT: - case base::DIR_ANDROID_EXTERNAL_STORAGE: - case base::DIR_ANDROID_APP_DATA: - directory = QStandardPaths::writableLocation(QStandardPaths::DataLocation); - break; -#endif + return toFilePath(libraryDataPath()); case content::DIR_MEDIA_LIBS: return toFilePath(pluginsPath()); case ui::DIR_LOCALES: |