diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-08-18 09:47:34 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-08-18 10:08:28 +0200 |
commit | e53ddd7b7ec0ca766557d947031820986f11b1a2 (patch) | |
tree | 19f7d4c09af27da94bda2dd0ff647b1913b70a67 /src/core | |
parent | 13d03ef21d3bd67595bd0b36be7401f6e6bcbbd6 (diff) | |
parent | dd7b409388949bc628af75a6e65474d699c416d3 (diff) |
Merge branch '5.5' into 5.6
Change-Id: I9977663123560a22f493b8c02d02de8897b38666
Diffstat (limited to 'src/core')
28 files changed, 249 insertions, 107 deletions
diff --git a/src/core/certificate_error_controller_p.h b/src/core/certificate_error_controller_p.h index 505e77905..08b51f30f 100644 --- a/src/core/certificate_error_controller_p.h +++ b/src/core/certificate_error_controller_p.h @@ -37,6 +37,17 @@ #ifndef CERTIFICATE_ERROR_CONTROLLER_P_H #define CERTIFICATE_ERROR_CONTROLLER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "content/public/browser/content_browser_client.h" #include "certificate_error_controller.h" diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index 85235acce..206392840 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -208,7 +208,7 @@ void ClipboardQt::WriteObjects(ui::ClipboardType type, const ObjectMap& objects) if (uncommittedData) QGuiApplication::clipboard()->setMimeData(uncommittedData.take(), type == ui::CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); - if (type == ui::CLIPBOARD_TYPE_COPY_PASTE) { + if (type == ui::CLIPBOARD_TYPE_COPY_PASTE && IsSupportedClipboardType(ui::CLIPBOARD_TYPE_SELECTION)) { ObjectMap::const_iterator text_iter = objects.find(CBF_TEXT); if (text_iter != objects.end()) { // Copy text and SourceTag to the selection clipboard. diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index a8cb54c0c..91cd0b0c4 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -72,6 +72,7 @@ #include "resource_dispatcher_host_delegate_qt.h" #include "user_script_controller_host.h" #include "web_contents_delegate_qt.h" +#include "web_engine_context.h" #include "web_engine_library_info.h" #if defined(ENABLE_PLUGINS) @@ -225,6 +226,9 @@ public: void PostMainMessageLoopRun() { + // The BrowserContext's destructor uses the MessageLoop so it should be deleted + // right before the RenderProcessHostImpl's destructor destroys it. + WebEngineContext::current()->destroyBrowserContext(); } int PreCreateThreads() Q_DECL_OVERRIDE diff --git a/src/core/core_module.pro b/src/core/core_module.pro index dafeb0b36..291aac916 100644 --- a/src/core/core_module.pro +++ b/src/core/core_module.pro @@ -45,7 +45,9 @@ LOCALE_LIST = am ar bg bn ca cs da de el en-GB en-US es-419 es et fa fi fil fr g for(LOC, LOCALE_LIST) { locales.files += $$REPACK_DIR/qtwebengine_locales/$${LOC}.pak } -resources.files = $$REPACK_DIR/qtwebengine_resources.pak +resources.files = $$REPACK_DIR/qtwebengine_resources.pak \ + $$REPACK_DIR/qtwebengine_resources_100p.pak \ + $$REPACK_DIR/qtwebengine_resources_200p.pak icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat diff --git a/src/core/custom_protocol_handler.cpp b/src/core/custom_protocol_handler.cpp index 5deadf185..f140f98cf 100644 --- a/src/core/custom_protocol_handler.cpp +++ b/src/core/custom_protocol_handler.cpp @@ -10,15 +10,15 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl.html. ** @@ -26,7 +26,7 @@ ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or later as published by the Free ** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to +** the packaging of this file. Please review the following information to ** ensure the GNU General Public License version 2.0 requirements will be ** met: http://www.gnu.org/licenses/gpl-2.0.html. ** diff --git a/src/core/custom_protocol_handler.h b/src/core/custom_protocol_handler.h index 923cac79d..225bb0567 100644 --- a/src/core/custom_protocol_handler.h +++ b/src/core/custom_protocol_handler.h @@ -10,15 +10,15 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl.html. ** @@ -26,7 +26,7 @@ ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or later as published by the Free ** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to +** the packaging of this file. Please review the following information to ** ensure the GNU General Public License version 2.0 requirements will be ** met: http://www.gnu.org/licenses/gpl-2.0.html. ** diff --git a/src/core/custom_url_scheme_handler.cpp b/src/core/custom_url_scheme_handler.cpp index 591cad32e..b9fcf9c36 100644 --- a/src/core/custom_url_scheme_handler.cpp +++ b/src/core/custom_url_scheme_handler.cpp @@ -10,15 +10,15 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl.html. ** @@ -26,7 +26,7 @@ ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or later as published by the Free ** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to +** the packaging of this file. Please review the following information to ** ensure the GNU General Public License version 2.0 requirements will be ** met: http://www.gnu.org/licenses/gpl-2.0.html. ** diff --git a/src/core/custom_url_scheme_handler.h b/src/core/custom_url_scheme_handler.h index 0079095d8..745f0eb4c 100644 --- a/src/core/custom_url_scheme_handler.h +++ b/src/core/custom_url_scheme_handler.h @@ -10,15 +10,15 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl.html. ** @@ -26,7 +26,7 @@ ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or later as published by the Free ** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to +** the packaging of this file. Please review the following information to ** ensure the GNU General Public License version 2.0 requirements will be ** met: http://www.gnu.org/licenses/gpl-2.0.html. ** diff --git a/src/core/gl_context_qt.cpp b/src/core/gl_context_qt.cpp index baccddc9d..b350c3c5b 100644 --- a/src/core/gl_context_qt.cpp +++ b/src/core/gl_context_qt.cpp @@ -60,7 +60,11 @@ namespace { inline void *resourceForContext(const QByteArray &resource) { - return qApp->platformNativeInterface()->nativeResourceForContext(resource, qt_gl_global_share_context()); + QOpenGLContext *shareContext = qt_gl_global_share_context(); + if (!shareContext) { + qFatal("QWebEngine: OpenGL resource sharing is not set up in QtQuick. Please make sure to call QtWebEngine::initialize() in your main() function."); + } + return qApp->platformNativeInterface()->nativeResourceForContext(resource, shareContext); } inline void *resourceForIntegration(const QByteArray &resource) diff --git a/src/core/gl_surface_qt.cpp b/src/core/gl_surface_qt.cpp index 19ce59f7e..c905688ce 100644 --- a/src/core/gl_surface_qt.cpp +++ b/src/core/gl_surface_qt.cpp @@ -324,13 +324,7 @@ bool GLSurfaceQtEGL::InitializeOneOff() if (initialized) return true; -#if defined(USE_X11) - EGLNativeDisplayType nativeDisplay = reinterpret_cast<EGLNativeDisplayType>(GLContextHelper::getXDisplay()); - g_display = eglGetDisplay(nativeDisplay); -#else g_display = GLContextHelper::getEGLDisplay(); -#endif - if (!g_display) { LOG(ERROR) << "GLContextHelper::getEGLDisplay() failed."; return false; diff --git a/src/core/javascript_dialog_controller_p.h b/src/core/javascript_dialog_controller_p.h index 504c5783e..5c3bd39f5 100644 --- a/src/core/javascript_dialog_controller_p.h +++ b/src/core/javascript_dialog_controller_p.h @@ -37,6 +37,17 @@ #ifndef JAVASCRIPT_DIALOG_CONTROLLER_P_H #define JAVASCRIPT_DIALOG_CONTROLLER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "content/public/browser/javascript_dialog_manager.h" #include "web_contents_adapter_client.h" #include <QString> diff --git a/src/core/qtwebengine.gypi b/src/core/qtwebengine.gypi index 2c433f614..cad6882eb 100644 --- a/src/core/qtwebengine.gypi +++ b/src/core/qtwebengine.gypi @@ -26,6 +26,7 @@ '<(chromium_src_dir)/media/media.gyp:media', '<(chromium_src_dir)/net/net.gyp:net', '<(chromium_src_dir)/net/net.gyp:net_resources', + '<(chromium_src_dir)/net/net.gyp:net_with_v8', '<(chromium_src_dir)/skia/skia.gyp:skia', '<(chromium_src_dir)/third_party/WebKit/Source/web/web.gyp:blink_web', '<(chromium_src_dir)/ui/base/ui_base.gyp:ui_base', @@ -47,6 +48,9 @@ 'CHROMIUM_VERSION=\"<!(python <(version_script_location) -f <(chromium_src_dir)/chrome/VERSION -t "@MAJOR@.@MINOR@.@BUILD@.@PATCH@")\"', ], 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeTypeInfo': 'true', + }, 'VCLinkerTool': { 'SubSystem': '2', # Set /SUBSYSTEM:WINDOWS }, @@ -81,6 +85,11 @@ }, }, }], + ['qt_os=="win32" and qt_gl=="opengl"', { + 'include_dirs': [ + '<(chromium_src_dir)/third_party/khronos', + ], + }], ['OS=="win"', { 'resource_include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)/webkit', diff --git a/src/core/resource_bundle_qt.cpp b/src/core/resource_bundle_qt.cpp index 3e9c6ad43..932f40af8 100644 --- a/src/core/resource_bundle_qt.cpp +++ b/src/core/resource_bundle_qt.cpp @@ -44,7 +44,9 @@ namespace ui { void ResourceBundle::LoadCommonResources() { // We repacked the resources we need and installed them. now let chromium mmap that file. - AddDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_PAK), SCALE_FACTOR_100P); + AddDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_PAK), SCALE_FACTOR_NONE); + AddDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_100P_PAK), SCALE_FACTOR_100P); + AddDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_200P_PAK), SCALE_FACTOR_200P); } gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) diff --git a/src/core/resources/repack_resources.gypi b/src/core/resources/repack_resources.gypi index fdf317a7c..ce224e625 100644 --- a/src/core/resources/repack_resources.gypi +++ b/src/core/resources/repack_resources.gypi @@ -4,23 +4,13 @@ { 'variables': { 'repack_path': '<(chromium_src_dir)/tools/grit/grit/format/repack.py', - 'pak_inputs': [ - '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/blink/devtools_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/content/content_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_resources_100_percent.pak', - '<(SHARED_INTERMEDIATE_DIR)/blink/public/resources/blink_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/content/app/resources/content_resources_100_percent.pak', - '<(SHARED_INTERMEDIATE_DIR)/ui/resources/webui_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/chrome/renderer_resources_100_percent.pak', - ], }, 'inputs': [ '<(repack_path)', '<@(pak_inputs)', ], 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/repack/qtwebengine_resources.pak', + '<@(pak_outputs)', ], 'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'], } diff --git a/src/core/resources/resources.gyp b/src/core/resources/resources.gyp index 5d4d83c05..6293cdf3b 100644 --- a/src/core/resources/resources.gyp +++ b/src/core/resources/resources.gyp @@ -15,7 +15,7 @@ }, 'dependencies': [ '<(chromium_src_dir)/content/app/strings/content_strings.gyp:content_strings', - '<(chromium_src_dir)/webkit/blink_resources.gyp:blink_resources', + '<(chromium_src_dir)/blink/public/blink_resources.gyp:blink_resources', '<(chromium_src_dir)/content/browser/devtools/devtools_resources.gyp:devtools_resources', '../chrome_qt.gyp:chrome_resources', ], @@ -26,6 +26,46 @@ 'actions' : [ { 'action_name': 'repack_resources', + 'variables': { + 'pak_inputs': [ + '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/blink/devtools_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/content/content_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/blink/public/resources/blink_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/ui/resources/webui_resources.pak', + ], + 'pak_outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/repack/qtwebengine_resources.pak' + ] + }, + 'includes': [ 'repack_resources.gypi' ], + }, + { + 'action_name': 'repack_resources_100_percent', + 'variables': { + 'pak_inputs': [ + '<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_resources_100_percent.pak', + '<(SHARED_INTERMEDIATE_DIR)/content/app/resources/content_resources_100_percent.pak', + '<(SHARED_INTERMEDIATE_DIR)/chrome/renderer_resources_100_percent.pak', + ], + 'pak_outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/repack/qtwebengine_resources_100p.pak' + ] + }, + 'includes': [ 'repack_resources.gypi' ], + }, + { + 'action_name': 'repack_resources_200_percent', + 'variables': { + 'pak_inputs': [ + '<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_resources_200_percent.pak', + '<(SHARED_INTERMEDIATE_DIR)/content/app/resources/content_resources_200_percent.pak', + '<(SHARED_INTERMEDIATE_DIR)/chrome/renderer_resources_200_percent.pak', + ], + 'pak_outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/repack/qtwebengine_resources_200p.pak' + ] + }, 'includes': [ 'repack_resources.gypi' ], }, { @@ -40,7 +80,15 @@ 'destination': '<(qt_install_data)', 'files': [ '<(SHARED_INTERMEDIATE_DIR)/repack/qtwebengine_resources.pak' ], }, - ], + { + 'destination': '<(qt_install_data)', + 'files': [ '<(SHARED_INTERMEDIATE_DIR)/repack/qtwebengine_resources_100p.pak' ], + }, + { + 'destination': '<(qt_install_data)', + 'files': [ '<(SHARED_INTERMEDIATE_DIR)/repack/qtwebengine_resources_200p.pak' ], + }, + ], }], ['qt_install_translations != ""', { 'copies': [ diff --git a/src/core/surface_factory_qt.cpp b/src/core/surface_factory_qt.cpp index 40c65d9d3..db10be070 100644 --- a/src/core/surface_factory_qt.cpp +++ b/src/core/surface_factory_qt.cpp @@ -71,13 +71,13 @@ base::NativeLibrary LoadLibrary(const base::FilePath& filename) { bool SurfaceFactoryQt::LoadEGLGLES2Bindings(AddGLLibraryCallback add_gl_library, SetGLGetProcAddressProcCallback set_gl_get_proc_address) { base::FilePath libEGLPath = QtWebEngineCore::toFilePath(QT_LIBDIR_EGL); - libEGLPath = libEGLPath.Append("libEGL.so"); + libEGLPath = libEGLPath.Append("libEGL.so.1"); base::NativeLibrary eglLibrary = LoadLibrary(libEGLPath); if (!eglLibrary) return false; base::FilePath libGLES2Path = QtWebEngineCore::toFilePath(QT_LIBDIR_GLES2); - libGLES2Path = libGLES2Path.Append("libGLESv2.so"); + libGLES2Path = libGLES2Path.Append("libGLESv2.so.2"); base::NativeLibrary gles2Library = LoadLibrary(libGLES2Path); if (!gles2Library) return false; diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp index 0eb5163f9..a50fcbe0e 100644 --- a/src/core/url_request_context_getter_qt.cpp +++ b/src/core/url_request_context_getter_qt.cpp @@ -36,11 +36,13 @@ #include "url_request_context_getter_qt.h" +#include "base/command_line.h" #include "base/strings/string_util.h" #include "base/threading/worker_pool.h" #include "base/threading/sequenced_worker_pool.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/cookie_store_factory.h" +#include "content/public/common/content_switches.h" #include "net/base/cache_type.h" #include "net/cert/cert_verifier.h" #include "net/dns/host_resolver.h" @@ -49,7 +51,11 @@ #include "net/http/http_cache.h" #include "net/http/http_network_session.h" #include "net/http/http_server_properties_impl.h" +#include "net/proxy/dhcp_proxy_script_fetcher_factory.h" +#include "net/proxy/proxy_script_fetcher_impl.h" #include "net/proxy/proxy_service.h" +#include "net/proxy/proxy_service_v8.h" +#include "net/proxy/proxy_resolver_v8.h" #include "net/ssl/channel_id_service.h" #include "net/ssl/default_channel_id_store.h" #include "net/ssl/ssl_config_service_defaults.h" @@ -154,17 +160,29 @@ void URLRequestContextGetterQt::generateStorage() base::WorkerPool::GetTaskRunner(true)))); m_storage->set_cert_verifier(net::CertVerifier::CreateDefault()); - net::ProxyService *proxyService = nullptr; + + scoped_ptr<net::HostResolver> host_resolver(net::HostResolver::CreateDefaultResolver(NULL)); + + // The System Proxy Resolver has issues on Windows with unconfigured network cards, + // which is why we want to use the v8 one if (ProxyResolverQt::useProxyResolverQt()) { scoped_ptr<ProxyResolverFactoryQt> factory(new ProxyResolverFactoryQt(false)); - proxyService = new net::ProxyService(proxyConfigService, factory.Pass(), nullptr); - } else - proxyService = net::ProxyService::CreateUsingSystemProxyResolver(proxyConfigService, /*num_pac_threads = */0 /*default*/, NULL); - m_storage->set_proxy_service(proxyService); + m_storage->set_proxy_service(new net::ProxyService(proxyConfigService, factory.Pass(), nullptr)); + } else { + if (!m_dhcpProxyScriptFetcherFactory) + m_dhcpProxyScriptFetcherFactory.reset(new net::DhcpProxyScriptFetcherFactory); + + m_storage->set_proxy_service(net::CreateProxyServiceUsingV8ProxyResolver( + proxyConfigService, + new net::ProxyScriptFetcherImpl(m_urlRequestContext.get()), + m_dhcpProxyScriptFetcherFactory->Create(m_urlRequestContext.get()), + host_resolver.get(), + NULL /* NetLog */, + m_networkDelegate.get())); + } m_storage->set_ssl_config_service(new net::SSLConfigServiceDefaults); m_storage->set_transport_security_state(new net::TransportSecurityState()); - scoped_ptr<net::HostResolver> host_resolver(net::HostResolver::CreateDefaultResolver(NULL)); m_storage->set_http_auth_handler_factory(net::HttpAuthHandlerFactory::CreateDefault(host_resolver.get())); m_storage->set_http_server_properties(scoped_ptr<net::HttpServerProperties>(new net::HttpServerPropertiesImpl)); diff --git a/src/core/url_request_context_getter_qt.h b/src/core/url_request_context_getter_qt.h index be9567f4b..c7a4366ec 100644 --- a/src/core/url_request_context_getter_qt.h +++ b/src/core/url_request_context_getter_qt.h @@ -47,6 +47,7 @@ #include "content/public/common/url_constants.h" #include "net/url_request/url_request_context_storage.h" #include "net/url_request/url_request_job_factory_impl.h" +#include "net/proxy/dhcp_proxy_script_fetcher_factory.h" #include "cookie_monster_delegate_qt.h" #include "network_delegate_qt.h" @@ -97,7 +98,7 @@ private: scoped_ptr<NetworkDelegateQt> m_networkDelegate; scoped_ptr<net::URLRequestContextStorage> m_storage; scoped_ptr<net::URLRequestJobFactoryImpl> m_jobFactory; - + scoped_ptr<net::DhcpProxyScriptFetcherFactory> m_dhcpProxyScriptFetcherFactory; scoped_refptr<CookieMonsterDelegateQt> m_cookieDelegate; friend class NetworkDelegateQt; }; diff --git a/src/core/url_request_custom_job.cpp b/src/core/url_request_custom_job.cpp index cd71b6900..afdcecdfe 100644 --- a/src/core/url_request_custom_job.cpp +++ b/src/core/url_request_custom_job.cpp @@ -10,15 +10,15 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl.html. ** @@ -26,7 +26,7 @@ ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or later as published by the Free ** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to +** the packaging of this file. Please review the following information to ** ensure the GNU General Public License version 2.0 requirements will be ** met: http://www.gnu.org/licenses/gpl-2.0.html. ** diff --git a/src/core/url_request_custom_job.h b/src/core/url_request_custom_job.h index 4975e71d2..60a1d60b9 100644 --- a/src/core/url_request_custom_job.h +++ b/src/core/url_request_custom_job.h @@ -10,15 +10,15 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl.html. ** @@ -26,7 +26,7 @@ ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or later as published by the Free ** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to +** the packaging of this file. Please review the following information to ** ensure the GNU General Public License version 2.0 requirements will be ** met: http://www.gnu.org/licenses/gpl-2.0.html. ** diff --git a/src/core/url_request_custom_job_delegate.cpp b/src/core/url_request_custom_job_delegate.cpp index caf7a0e3e..8d344c862 100644 --- a/src/core/url_request_custom_job_delegate.cpp +++ b/src/core/url_request_custom_job_delegate.cpp @@ -10,15 +10,15 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl.html. ** @@ -26,7 +26,7 @@ ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or later as published by the Free ** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to +** the packaging of this file. Please review the following information to ** ensure the GNU General Public License version 2.0 requirements will be ** met: http://www.gnu.org/licenses/gpl-2.0.html. ** diff --git a/src/core/url_request_custom_job_delegate.h b/src/core/url_request_custom_job_delegate.h index 580149ecf..6c1600592 100644 --- a/src/core/url_request_custom_job_delegate.h +++ b/src/core/url_request_custom_job_delegate.h @@ -10,15 +10,15 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to +** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl.html. ** @@ -26,7 +26,7 @@ ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or later as published by the Free ** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to +** the packaging of this file. Please review the following information to ** ensure the GNU General Public License version 2.0 requirements will be ** met: http://www.gnu.org/licenses/gpl-2.0.html. ** diff --git a/src/core/web_contents_adapter_p.h b/src/core/web_contents_adapter_p.h index 52bade3a5..505f803b2 100644 --- a/src/core/web_contents_adapter_p.h +++ b/src/core/web_contents_adapter_p.h @@ -37,6 +37,17 @@ #ifndef WEB_CONTENTS_ADAPTER_P_H #define WEB_CONTENTS_ADAPTER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "web_contents_adapter.h" #include "base/memory/ref_counted.h" diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index db4cec1fc..727cfb491 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -91,6 +91,10 @@ scoped_refptr<WebEngineContext> sContext; void destroyContext() { + // Destroy WebEngineContext before its static pointer is zeroed and destructor called. + // Before destroying MessageLoop via destroying BrowserMainRunner destructor + // WebEngineContext's pointer is used. + sContext->destroy(); sContext = 0; } @@ -136,9 +140,13 @@ bool usingQtQuick2DRenderer() } // namespace -WebEngineContext::~WebEngineContext() +void WebEngineContext::destroyBrowserContext() { m_defaultBrowserContext = 0; +} + +void WebEngineContext::destroy() +{ delete m_globalQObject; m_globalQObject = 0; base::MessagePump::Delegate *delegate = m_runLoop->loop_; @@ -146,6 +154,15 @@ WebEngineContext::~WebEngineContext() while (delegate->DoWork()) { } GLContextHelper::destroy(); m_runLoop->AfterRun(); + + // Force to destroy RenderProcessHostImpl by destroying BrowserMainRunner. + // RenderProcessHostImpl should be destroyed before WebEngineContext since + // default BrowserContext might be used by the RenderprocessHostImpl's destructor. + m_browserRunner.reset(0); +} + +WebEngineContext::~WebEngineContext() +{ } scoped_refptr<WebEngineContext> WebEngineContext::current() diff --git a/src/core/web_engine_context.h b/src/core/web_engine_context.h index f78791f27..8f034f18f 100644 --- a/src/core/web_engine_context.h +++ b/src/core/web_engine_context.h @@ -71,6 +71,9 @@ public: QtWebEngineCore::BrowserContextAdapter *defaultBrowserContext(); QObject *globalQObject(); + void destroyBrowserContext(); + void destroy(); + private: friend class base::RefCounted<WebEngineContext>; WebEngineContext(); diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp index 69fa418c6..bc030d8f7 100644 --- a/src/core/web_engine_library_info.cpp +++ b/src/core/web_engine_library_info.cpp @@ -112,54 +112,71 @@ static QString getResourcesPath(CFBundleRef frameworkBundle) QString subProcessPath() { - static bool initialized = false; + static QString processPath; + if (processPath.isEmpty()) { #if defined(OS_WIN) - static QString processBinary (QLatin1String(QTWEBENGINEPROCESS_NAME) % QLatin1String(".exe")); + const QString processBinary = QLatin1String(QTWEBENGINEPROCESS_NAME) % QLatin1String(".exe"); #else - static QString processBinary (QLatin1String(QTWEBENGINEPROCESS_NAME)); + const QString processBinary = QLatin1String(QTWEBENGINEPROCESS_NAME); #endif + + QStringList candidatePaths; + const QByteArray fromEnv = qgetenv("QTWEBENGINEPROCESS_PATH"); + if (!fromEnv.isEmpty()) { + // Only search in QTWEBENGINEPROCESS_PATH if set + candidatePaths << QString::fromLocal8Bit(fromEnv); + } else { #if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) - static QString processPath (getPath(frameworkBundle()) - % QStringLiteral("/Helpers/" QTWEBENGINEPROCESS_NAME ".app/Contents/MacOS/" QTWEBENGINEPROCESS_NAME)); + candidatePaths << getPath(frameworkBundle()) + % QStringLiteral("/Helpers/" QTWEBENGINEPROCESS_NAME ".app/Contents/MacOS/" QTWEBENGINEPROCESS_NAME); #else - static QString processPath (QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath) - % QLatin1Char('/') % processBinary); + candidatePaths << QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath) + % QLatin1Char('/') % processBinary; + candidatePaths << QCoreApplication::applicationDirPath() + % QLatin1Char('/') % processBinary; #endif - if (!initialized) { - // Allow overriding at runtime for the time being. - const QByteArray fromEnv = qgetenv("QTWEBENGINEPROCESS_PATH"); - if (!fromEnv.isEmpty()) - processPath = QString::fromLatin1(fromEnv); - if (!QFileInfo(processPath).exists()) { - qWarning("QtWebEngineProcess not found at location %s. Trying fallback path...", qPrintable(processPath)); - processPath = QCoreApplication::applicationDirPath() % QLatin1Char('/') % processBinary; } - if (!QFileInfo(processPath).exists()) - qFatal("QtWebEngineProcess not found at location %s. Try setting the QTWEBENGINEPROCESS_PATH environment variable.", qPrintable(processPath)); - initialized = true; + + Q_FOREACH (const QString &candidate, candidatePaths) { + if (QFileInfo(candidate).exists()) { + processPath = candidate; + break; + } + } + if (processPath.isEmpty()) + qFatal("Could not find %s", processBinary.toUtf8().constData()); + } + return processPath; } QString pluginsPath() { #if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) - return getPath(frameworkBundle()) % QLatin1String("/Libraries"); + static QString pluginsPath = getPath(frameworkBundle()) % QLatin1String("/Libraries"); #else static bool initialized = false; - static QString potentialPluginsPath = QLibraryInfo::location(QLibraryInfo::PluginsPath) % QDir::separator() % QLatin1String("qtwebengine"); + static QString pluginsPath; if (!initialized) { initialized = true; - if (!QFileInfo::exists(potentialPluginsPath)) - potentialPluginsPath = QCoreApplication::applicationDirPath() % QDir::separator() % QLatin1String("qtwebengine"); - if (!QFileInfo::exists(potentialPluginsPath)) - potentialPluginsPath = fallbackDir(); - } + const QStringList directories = QCoreApplication::libraryPaths(); + Q_FOREACH (const QString &dir, directories) { + const QString candidate = dir % "/" % QLatin1String("qtwebengine"); + if (QFileInfo(candidate).exists()) { + pluginsPath = candidate; + break; + } + } - return potentialPluginsPath; + if (pluginsPath.isEmpty()) { + pluginsPath = fallbackDir(); + } + } #endif + return pluginsPath; } QString localesPath() @@ -215,11 +232,11 @@ base::FilePath WebEngineLibraryInfo::getPath(int key) QString directory; switch (key) { case QT_RESOURCES_PAK: -#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) - return toFilePath(getResourcesPath(frameworkBundle()) % QLatin1String("/qtwebengine_resources.pak")); -#else - return toFilePath(QLibraryInfo::location(QLibraryInfo::DataPath) % QDir::separator() % QLatin1String("qtwebengine_resources.pak")); -#endif + return toFilePath(libraryDataPath() % QLatin1String("/qtwebengine_resources.pak")); + case QT_RESOURCES_100P_PAK: + return toFilePath(libraryDataPath() % QLatin1String("/qtwebengine_resources_100p.pak")); + case QT_RESOURCES_200P_PAK: + return toFilePath(libraryDataPath() % QLatin1String("/qtwebengine_resources_200p.pak")); case base::FILE_EXE: case content::CHILD_PROCESS_EXE: return toFilePath(subProcessPath()); diff --git a/src/core/web_engine_library_info.h b/src/core/web_engine_library_info.h index e85258078..cd3e5be94 100644 --- a/src/core/web_engine_library_info.h +++ b/src/core/web_engine_library_info.h @@ -41,7 +41,9 @@ #include "base/files/file_path.h" #include "base/strings/string16.h" enum { - QT_RESOURCES_PAK = 5000 + QT_RESOURCES_PAK = 5000, + QT_RESOURCES_100P_PAK = 5001, + QT_RESOURCES_200P_PAK = 5002 }; class WebEngineLibraryInfo { diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index e022d02ef..1a58ae385 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -534,8 +534,6 @@ static inline WebInputEvent::Modifiers modifiersForEvent(const QInputEvent* even result |= WebInputEvent::ShiftKey; if (modifiers & Qt::AltModifier) result |= WebInputEvent::AltKey; - if (modifiers & Qt::MetaModifier) - result |= WebInputEvent::MetaKey; if (modifiers & Qt::KeypadModifier) result |= WebInputEvent::IsKeyPad; |