summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets/api/qwebenginescriptcollection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/webenginewidgets/api/qwebenginescriptcollection.cpp')
-rw-r--r--src/webenginewidgets/api/qwebenginescriptcollection.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/webenginewidgets/api/qwebenginescriptcollection.cpp b/src/webenginewidgets/api/qwebenginescriptcollection.cpp
index a31c26a16..4b77b4699 100644
--- a/src/webenginewidgets/api/qwebenginescriptcollection.cpp
+++ b/src/webenginewidgets/api/qwebenginescriptcollection.cpp
@@ -167,7 +167,7 @@ QList<QWebEngineScript> QWebEngineScriptCollection::toList() const
}
-QWebEngineScriptCollectionPrivate::QWebEngineScriptCollectionPrivate(QtWebEngineCore::UserResourceControllerHost *controller, QtWebEngineCore::WebContentsAdapter *webContents)
+QWebEngineScriptCollectionPrivate::QWebEngineScriptCollectionPrivate(QtWebEngineCore::UserResourceControllerHost *controller, QSharedPointer<QtWebEngineCore::WebContentsAdapter> webContents)
: m_scriptController(controller)
, m_contents(webContents)
{
@@ -175,32 +175,32 @@ QWebEngineScriptCollectionPrivate::QWebEngineScriptCollectionPrivate(QtWebEngine
int QWebEngineScriptCollectionPrivate::count() const
{
- return m_scriptController->registeredScripts(m_contents).count();
+ return m_scriptController->registeredScripts(m_contents.data()).count();
}
bool QWebEngineScriptCollectionPrivate::contains(const QWebEngineScript &s) const
{
- return m_scriptController->containsUserScript(*s.d, m_contents);
+ return m_scriptController->containsUserScript(*s.d, m_contents.data());
}
void QWebEngineScriptCollectionPrivate::insert(const QWebEngineScript &script)
{
if (!script.d)
return;
- m_scriptController->addUserScript(*script.d, m_contents);
+ m_scriptController->addUserScript(*script.d, m_contents.data());
}
bool QWebEngineScriptCollectionPrivate::remove(const QWebEngineScript &script)
{
if (!script.d)
return false;
- return m_scriptController->removeUserScript(*script.d, m_contents);
+ return m_scriptController->removeUserScript(*script.d, m_contents.data());
}
QList<QWebEngineScript> QWebEngineScriptCollectionPrivate::toList(const QString &scriptName) const
{
QList<QWebEngineScript> ret;
- Q_FOREACH (const UserScript &script, m_scriptController->registeredScripts(m_contents))
+ Q_FOREACH (const UserScript &script, m_scriptController->registeredScripts(m_contents.data()))
if (scriptName.isNull() || scriptName == script.name())
ret.append(QWebEngineScript(script));
return ret;
@@ -208,7 +208,7 @@ QList<QWebEngineScript> QWebEngineScriptCollectionPrivate::toList(const QString
QWebEngineScript QWebEngineScriptCollectionPrivate::find(const QString &name) const
{
- Q_FOREACH (const UserScript &script, m_scriptController->registeredScripts(m_contents))
+ Q_FOREACH (const UserScript &script, m_scriptController->registeredScripts(m_contents.data()))
if (name == script.name())
return QWebEngineScript(script);
return QWebEngineScript();
@@ -216,22 +216,22 @@ QWebEngineScript QWebEngineScriptCollectionPrivate::find(const QString &name) co
void QWebEngineScriptCollectionPrivate::clear()
{
- m_scriptController->clearAllScripts(m_contents);
+ m_scriptController->clearAllScripts(m_contents.data());
}
void QWebEngineScriptCollectionPrivate::reserve(int capacity)
{
- m_scriptController->reserve(m_contents, capacity);
+ m_scriptController->reserve(m_contents.data(), capacity);
}
-void QWebEngineScriptCollectionPrivate::rebindToContents(QtWebEngineCore::WebContentsAdapter *page)
+void QWebEngineScriptCollectionPrivate::rebindToContents(QSharedPointer<QtWebEngineCore::WebContentsAdapter> contents)
{
Q_ASSERT(m_contents);
- Q_ASSERT(page);
- Q_ASSERT(m_contents != page);
+ Q_ASSERT(contents);
+ Q_ASSERT(m_contents != contents);
- Q_FOREACH (const UserScript &script, m_scriptController->registeredScripts(m_contents)) {
- m_scriptController->addUserScript(script, page);
+ Q_FOREACH (const UserScript &script, m_scriptController->registeredScripts(m_contents.data())) {
+ m_scriptController->addUserScript(script, contents.data());
}
- m_contents = page;
+ m_contents = contents;
}