summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/browser_context_adapter.cpp1
-rw-r--r--src/core/content_client_qt.cpp19
-rw-r--r--src/core/cookie_monster_delegate_qt.cpp2
-rw-r--r--src/core/core_gyp_generator.pro1
-rw-r--r--src/core/resources/resources.gyp6
-rw-r--r--src/core/web_engine_library_info.cpp1
-rw-r--r--src/webengine/api/qquickwebenginescript.cpp1
-rw-r--r--src/webengine/api/qquickwebengineview.cpp64
-rw-r--r--src/webengine/api/qquickwebengineview_p.h3
-rw-r--r--src/webengine/api/qquickwebengineview_p_p.h1
-rw-r--r--src/webengine/ui_delegates_manager.cpp9
11 files changed, 55 insertions, 53 deletions
diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp
index 7b40688a1..0bbb13857 100644
--- a/src/core/browser_context_adapter.cpp
+++ b/src/core/browser_context_adapter.cpp
@@ -52,7 +52,6 @@
#include <QCoreApplication>
#include <QDir>
#include <QString>
-#include <QStringBuilder>
#include <QStandardPaths>
#include <numeric>
diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp
index 1d4923c70..ccc97517e 100644
--- a/src/core/content_client_qt.cpp
+++ b/src/core/content_client_qt.cpp
@@ -49,7 +49,6 @@
#include <QCoreApplication>
#include <QFile>
-#include <QStringBuilder>
#if defined(ENABLE_PLUGINS)
#include "content/public/common/pepper_plugin_info.h"
@@ -106,20 +105,14 @@ content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path, cons
void AddPepperFlashFromSystem(std::vector<content::PepperPluginInfo>* plugins)
{
QStringList pluginPaths;
-#if defined(Q_OS_WIN) && defined(Q_PROCESSOR_X86_32)
+#if defined(Q_OS_WIN)
QString winDir = QDir::fromNativeSeparators(qgetenv("WINDIR"));
if (winDir.isEmpty())
winDir = QString::fromLatin1("C:/Windows");
-
- const QStringList pluginDirs = { winDir + "/SysWOW64/Macromed/Flash",
- winDir + "/System32/Macromed/Flash" };
- const QStringList nameFilters("pepflashplayer*.dll");
- Q_FOREACH (const QString &dirPath, pluginDirs) {
- QDir pluginDir(dirPath);
- pluginDir.setFilter(QDir::Files);
- Q_FOREACH (const QFileInfo &info, pluginDir.entryInfoList(nameFilters))
- pluginPaths << info.absoluteFilePath();
- }
+ QDir pluginDir(winDir + "/System32/Macromed/Flash");
+ pluginDir.setFilter(QDir::Files);
+ Q_FOREACH (const QFileInfo &info, pluginDir.entryInfoList(QStringList("pepflashplayer*.dll")))
+ pluginPaths << info.absoluteFilePath();
#endif
#if defined(Q_OS_OSX)
pluginPaths << "/Library/Internet Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin"; // Mac OS X
@@ -133,7 +126,6 @@ void AddPepperFlashFromSystem(std::vector<content::PepperPluginInfo>* plugins)
if (!QFile(*it).exists())
continue;
plugins->push_back(CreatePepperFlashInfo(QtWebEngineCore::toFilePath(*it), std::string()));
- return;
}
}
@@ -160,7 +152,6 @@ void ContentClientQt::AddPepperPlugins(std::vector<content::PepperPluginInfo>* p
#endif
#include <QCoreApplication>
-#include <QStringBuilder>
namespace QtWebEngineCore {
diff --git a/src/core/cookie_monster_delegate_qt.cpp b/src/core/cookie_monster_delegate_qt.cpp
index e740d01e7..3689d54d7 100644
--- a/src/core/cookie_monster_delegate_qt.cpp
+++ b/src/core/cookie_monster_delegate_qt.cpp
@@ -44,8 +44,6 @@
#include "api/qwebenginecookiestore_p.h"
#include "type_conversion.h"
-#include <QStringBuilder>
-
namespace QtWebEngineCore {
static GURL sourceUrlForCookie(const QNetworkCookie &cookie) {
diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro
index 14b8d78e2..0685abd7e 100644
--- a/src/core/core_gyp_generator.pro
+++ b/src/core/core_gyp_generator.pro
@@ -11,6 +11,7 @@ include(core_common.pri)
# Defining keywords such as 'signal' clashes with the chromium code base.
DEFINES += QT_NO_KEYWORDS \
+ QT_USE_QSTRINGBUILDER \
Q_FORWARD_DECLARE_OBJC_CLASS=QT_FORWARD_DECLARE_CLASS \
QTWEBENGINEPROCESS_NAME=\\\"$$QTWEBENGINEPROCESS_NAME\\\" \
QTWEBENGINECORE_VERSION_STR=\\\"$$MODULE_VERSION\\\" \
diff --git a/src/core/resources/resources.gyp b/src/core/resources/resources.gyp
index 6293cdf3b..143f21f9d 100644
--- a/src/core/resources/resources.gyp
+++ b/src/core/resources/resources.gyp
@@ -77,15 +77,15 @@
['qt_install_data != ""', {
'copies': [
{
- 'destination': '<(qt_install_data)',
+ 'destination': '<(qt_install_data)/resources',
'files': [ '<(SHARED_INTERMEDIATE_DIR)/repack/qtwebengine_resources.pak' ],
},
{
- 'destination': '<(qt_install_data)',
+ 'destination': '<(qt_install_data)/resources',
'files': [ '<(SHARED_INTERMEDIATE_DIR)/repack/qtwebengine_resources_100p.pak' ],
},
{
- 'destination': '<(qt_install_data)',
+ 'destination': '<(qt_install_data)/resources',
'files': [ '<(SHARED_INTERMEDIATE_DIR)/repack/qtwebengine_resources_200p.pak' ],
},
],
diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp
index 7b8858e44..a3c599208 100644
--- a/src/core/web_engine_library_info.cpp
+++ b/src/core/web_engine_library_info.cpp
@@ -52,7 +52,6 @@
#include <QLibraryInfo>
#include <QStandardPaths>
#include <QString>
-#include <QStringBuilder>
#ifndef QTWEBENGINEPROCESS_NAME
#error "No name defined for QtWebEngine's process"
diff --git a/src/webengine/api/qquickwebenginescript.cpp b/src/webengine/api/qquickwebenginescript.cpp
index 71dad701f..a19ec1534 100644
--- a/src/webengine/api/qquickwebenginescript.cpp
+++ b/src/webengine/api/qquickwebenginescript.cpp
@@ -40,7 +40,6 @@
#include <QQmlFile>
#include <QtCore/QDebug>
#include <QtCore/QFile>
-#include <QtCore/QStringBuilder>
#include <QtCore/QTimerEvent>
#include "user_script_controller_host.h"
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 8b9374e08..c6d849387 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -75,8 +75,8 @@
#include <QQmlWebChannel>
#include <QQuickWebEngineProfile>
#include <QScreen>
-#include <QStringBuilder>
#include <QUrl>
+#include <QTimer>
#ifndef QT_NO_ACCESSIBILITY
#include <private/qquickaccessibleattached_p.h>
#endif // QT_NO_ACCESSIBILITY
@@ -111,6 +111,7 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate()
, devicePixelRatio(QGuiApplication::primaryScreen()->devicePixelRatio())
, m_dpiScale(1.0)
, m_backgroundColor(Qt::white)
+ , m_webChannel(0)
{
// The gold standard for mobile web content is 160 dpi, and the devicePixelRatio expected
// is the (possibly quantized) ratio of device dpi to 160 dpi.
@@ -696,11 +697,6 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent
Q_Q(QQuickWebEngineView);
- // memorize what webChannel we had for the previous adapter
- QQmlWebChannel *qmlWebChannel = NULL;
- if (adapter)
- qmlWebChannel = qobject_cast<QQmlWebChannel *>(adapter->webChannel());
-
// This throws away the WebContentsAdapter that has been used until now.
// All its states, particularly the loading URL, are replaced by the adopted WebContentsAdapter.
WebContentsAdapterOwner *adapterOwner = new WebContentsAdapterOwner(adapter);
@@ -709,8 +705,12 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent
adapter->initialize(this);
// associate the webChannel with the new adapter
- if (qmlWebChannel)
- adapter->setWebChannel(qmlWebChannel);
+ if (m_webChannel)
+ adapter->setWebChannel(m_webChannel);
+
+ // set initial background color if non-default
+ if (m_backgroundColor != Qt::white)
+ adapter->backgroundColorChanged();
// re-bind the userscrips to the new adapter
Q_FOREACH (QQuickWebEngineScript *script, m_userScripts)
@@ -751,6 +751,10 @@ void QQuickWebEngineViewPrivate::ensureContentsAdapter()
if (!adapter) {
adapter = new WebContentsAdapter();
adapter->initialize(this);
+ if (m_backgroundColor != Qt::white)
+ adapter->backgroundColorChanged();
+ if (m_webChannel)
+ adapter->setWebChannel(m_webChannel);
if (explicitUrl.isValid())
adapter->load(explicitUrl);
// push down the page's user scripts
@@ -784,7 +788,7 @@ void QQuickWebEngineView::setUrl(const QUrl& url)
d->explicitUrl = url;
if (d->adapter)
d->adapter->load(url);
- if (!qmlEngine(this))
+ if (!qmlEngine(this) || isComponentComplete())
d->ensureContentsAdapter();
}
@@ -798,7 +802,7 @@ void QQuickWebEngineView::loadHtml(const QString &html, const QUrl &baseUrl)
{
Q_D(QQuickWebEngineView);
d->explicitUrl = QUrl();
- if (!qmlEngine(this))
+ if (!qmlEngine(this) || isComponentComplete())
d->ensureContentsAdapter();
if (d->adapter)
d->adapter->setContent(html.toUtf8(), QStringLiteral("text/html;charset=UTF-8"), baseUrl);
@@ -898,11 +902,8 @@ void QQuickWebEngineViewPrivate::setProfile(QQuickWebEngineProfile *profile)
if (adapter && adapter->browserContext() != browserContextAdapter()->browserContext()) {
// When the profile changes we need to create a new WebContentAdapter and reload the active URL.
QUrl activeUrl = adapter->activeUrl();
- QQmlWebChannel *qmlWebChannel = qobject_cast<QQmlWebChannel *>(adapter->webChannel());
adapter = 0;
ensureContentsAdapter();
- if (qmlWebChannel)
- adapter->setWebChannel(qmlWebChannel);
if (!explicitUrl.isValid() && activeUrl.isValid())
adapter->load(activeUrl);
@@ -1021,8 +1022,7 @@ bool QQuickWebEngineView::canGoForward() const
void QQuickWebEngineView::runJavaScript(const QString &script, const QJSValue &callback)
{
Q_D(QQuickWebEngineView);
- if (!d->adapter)
- return;
+ d->ensureContentsAdapter();
if (!callback.isUndefined()) {
quint64 requestId = d_ptr->adapter->runJavaScriptCallbackResult(script);
d->m_callbacks.insert(requestId, callback);
@@ -1068,8 +1068,8 @@ void QQuickWebEngineView::setBackgroundColor(const QColor &color)
if (color == d->m_backgroundColor)
return;
d->m_backgroundColor = color;
- d->ensureContentsAdapter();
- d->adapter->backgroundColorChanged();
+ if (d->adapter)
+ d->adapter->backgroundColorChanged();
emit backgroundColorChanged();
}
@@ -1120,23 +1120,24 @@ QQuickWebEngineHistory *QQuickWebEngineView::navigationHistory() const
QQmlWebChannel *QQuickWebEngineView::webChannel()
{
Q_D(QQuickWebEngineView);
- d->ensureContentsAdapter();
- QQmlWebChannel *qmlWebChannel = qobject_cast<QQmlWebChannel *>(d->adapter->webChannel());
- Q_ASSERT(!d->adapter->webChannel() || qmlWebChannel);
- if (!qmlWebChannel) {
- qmlWebChannel = new QQmlWebChannel(this);
- d->adapter->setWebChannel(qmlWebChannel);
+ if (!d->m_webChannel) {
+ d->m_webChannel = new QQmlWebChannel(this);
+ if (d->adapter)
+ d->adapter->setWebChannel(d->m_webChannel);
}
- return qmlWebChannel;
+
+ return d->m_webChannel;
}
void QQuickWebEngineView::setWebChannel(QQmlWebChannel *webChannel)
{
Q_D(QQuickWebEngineView);
- bool notify = (d->adapter->webChannel() == webChannel);
- d->adapter->setWebChannel(webChannel);
- if (notify)
- Q_EMIT webChannelChanged();
+ if (d->m_webChannel == webChannel)
+ return;
+ d->m_webChannel = webChannel;
+ if (d->adapter)
+ d->adapter->setWebChannel(webChannel);
+ Q_EMIT webChannelChanged();
}
void QQuickWebEngineView::grantFeaturePermission(const QUrl &securityOrigin, QQuickWebEngineView::Feature feature, bool granted)
@@ -1420,8 +1421,13 @@ void QQuickWebEngineViewPrivate::userScripts_clear(QQmlListProperty<QQuickWebEng
void QQuickWebEngineView::componentComplete()
{
- Q_D(QQuickWebEngineView);
QQuickItem::componentComplete();
+ QTimer::singleShot(0, this, &QQuickWebEngineView::lazyInitialize);
+}
+
+void QQuickWebEngineView::lazyInitialize()
+{
+ Q_D(QQuickWebEngineView);
d->ensureContentsAdapter();
}
diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h
index 02e820fe5..98d0bbc1d 100644
--- a/src/webengine/api/qquickwebengineview_p.h
+++ b/src/webengine/api/qquickwebengineview_p.h
@@ -290,6 +290,9 @@ public Q_SLOTS:
Q_REVISION(2) void setActiveFocusOnPress(bool arg);
Q_REVISION(2) void triggerWebAction(WebAction action);
+private Q_SLOTS:
+ void lazyInitialize();
+
Q_SIGNALS:
void titleChanged();
void urlChanged();
diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h
index c83090907..5d3be5216 100644
--- a/src/webengine/api/qquickwebengineview_p_p.h
+++ b/src/webengine/api/qquickwebengineview_p_p.h
@@ -206,6 +206,7 @@ public:
qreal devicePixelRatio;
QMap<quint64, QJSValue> m_callbacks;
QList<QSharedPointer<CertificateErrorController> > m_certificateErrorControllers;
+ QQmlWebChannel *m_webChannel;
private:
QScopedPointer<QtWebEngineCore::UIDelegatesManager> m_uIDelegatesManager;
diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp
index 91cec865b..64e22c4a9 100644
--- a/src/webengine/ui_delegates_manager.cpp
+++ b/src/webengine/ui_delegates_manager.cpp
@@ -48,7 +48,6 @@
#include <QQmlContext>
#include <QQmlEngine>
#include <QQmlProperty>
-#include <QStringBuilder>
// Uncomment for QML debugging
//#define UI_DELEGATES_DEBUG
@@ -210,7 +209,7 @@ QObject *UIDelegatesManager::addMenu(QObject *parentMenu, const QString &title,
return 0;
QQmlContext *context = qmlContext(m_view);
QObject *menu = menuComponent->beginCreate(context);
- // Useful when not using Qt Quick Controls' Menu
+ // set visual parent for non-Window-based menus
if (QQuickItem* item = qobject_cast<QQuickItem*>(menu))
item->setParentItem(m_view);
@@ -286,6 +285,9 @@ void UIDelegatesManager::showDialog(QSharedPointer<JavaScriptDialogController> d
QQmlContext *context = qmlContext(m_view);
QObject *dialog = dialogComponent->beginCreate(context);
+ // set visual parent for non-Window-based dialogs
+ if (QQuickItem* item = qobject_cast<QQuickItem*>(dialog))
+ item->setParentItem(m_view);
dialog->setParent(m_view);
QQmlProperty textProp(dialog, QStringLiteral("text"));
textProp.write(dialogController->message());
@@ -334,6 +336,9 @@ void UIDelegatesManager::showDialog(QSharedPointer<AuthenticationDialogControlle
QQmlContext *context = qmlContext(m_view);
QObject *authenticationDialog = authenticationDialogComponent->beginCreate(context);
+ // set visual parent for non-Window-based dialogs
+ if (QQuickItem* item = qobject_cast<QQuickItem*>(authenticationDialog))
+ item->setParentItem(m_view);
authenticationDialog->setParent(m_view);
QString introMessage;