diff options
Diffstat (limited to 'src/core/web_contents_adapter.cpp')
-rw-r--r-- | src/core/web_contents_adapter.cpp | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 2cd48907b..f5656f571 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -84,11 +84,11 @@ #include "content/public/common/content_constants.h" #include "content/public/common/content_switches.h" #include "content/public/common/drop_data.h" -#include "content/public/common/page_state.h" #include "content/public/common/page_zoom.h" #include "content/public/common/url_constants.h" #include "extensions/buildflags/buildflags.h" #include "third_party/blink/public/common/page/page_zoom.h" +#include "third_party/blink/public/common/page_state/page_state.h" #include "third_party/blink/public/common/peerconnection/webrtc_ip_handling_policy.h" #include "third_party/blink/public/common/web_preferences/web_preferences.h" #include "third_party/blink/public/mojom/frame/media_player_action.mojom.h" @@ -119,6 +119,7 @@ #include <QtCore/qmimedata.h> #include <QtCore/qtemporarydir.h> #include <QtGui/qdrag.h> +#include <QtGui/QDragEnterEvent> #include <QtGui/qpixmap.h> // Can't include headers as qaccessible.h conflicts with Chromium headers. @@ -355,7 +356,7 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex, nullptr); entry->SetTitle(toString16(title)); - entry->SetPageState(content::PageState::CreateFromEncodedData(std::string(pageState.data(), pageState.size()))); + entry->SetPageState(blink::PageState::CreateFromEncodedData(std::string(pageState.data(), pageState.size()))); entry->SetHasPostData(hasPostData); entry->SetOriginalRequestURL(toGurl(originalRequestUrl)); entry->SetIsOverridingUserAgent(isOverridingUserAgent); @@ -435,7 +436,7 @@ QSharedPointer<WebContentsAdapter> WebContentsAdapter::createFromSerializedNavig // TODO(joth): This is duplicated from chrome/.../session_restore.cc and // should be shared e.g. in NavigationController. http://crbug.com/68222 const int id = newWebContents->GetMainFrame()->GetProcess()->GetID(); - const content::PageState& pageState = controller.GetActiveEntry()->GetPageState(); + const blink::PageState& pageState = controller.GetActiveEntry()->GetPageState(); const std::vector<base::FilePath>& filePaths = pageState.GetReferencedFiles(); for (std::vector<base::FilePath>::const_iterator file = filePaths.begin(); file != filePaths.end(); ++file) content::ChildProcessSecurityPolicy::GetInstance()->GrantReadFile(id, *file); @@ -491,7 +492,7 @@ void WebContentsAdapter::setClient(WebContentsAdapterClient *adapterClient) Q_ASSERT(m_profileAdapter); // This might replace any adapter that has been initialized with this WebEngineSettings. - adapterClient->webEngineSettings()->setWebContentsAdapter(this); + WebEngineSettings::get(adapterClient->webEngineSettings())->setWebContentsAdapter(this); } bool WebContentsAdapter::isInitialized() const @@ -551,7 +552,7 @@ void WebContentsAdapter::initialize(content::SiteInstance *site) void WebContentsAdapter::initializeRenderPrefs() { - blink::mojom::RendererPreferences *rendererPrefs = m_webContents->GetMutableRendererPrefs(); + blink::RendererPreferences *rendererPrefs = m_webContents->GetMutableRendererPrefs(); rendererPrefs->use_custom_colors = true; // Qt returns a flash time (the whole cycle) in ms, chromium expects just the interval in // seconds @@ -567,7 +568,8 @@ void WebContentsAdapter::initializeRenderPrefs() commandLine->GetSwitchValueASCII(switches::kForceWebRtcIPHandlingPolicy); else rendererPrefs->webrtc_ip_handling_policy = - m_adapterClient->webEngineSettings()->testAttribute(WebEngineSettings::WebRTCPublicInterfacesOnly) + m_adapterClient->webEngineSettings()->testAttribute( + QWebEngineSettings::WebRTCPublicInterfacesOnly) ? blink::kWebRTCIPHandlingDefaultPublicInterfaceOnly : blink::kWebRTCIPHandlingDefault; #endif @@ -623,7 +625,7 @@ void WebContentsAdapter::reload() bool wasDiscarded = (m_lifecycleState == LifecycleState::Discarded); setLifecycleState(LifecycleState::Active); CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost()); - WebEngineSettings *settings = m_adapterClient->webEngineSettings(); + WebEngineSettings *settings = WebEngineSettings::get(m_adapterClient->webEngineSettings()); settings->doApply(); if (!wasDiscarded) // undiscard() already triggers a reload m_webContents->GetController().Reload(content::ReloadType::NORMAL, /*checkRepost = */false); @@ -638,7 +640,7 @@ void WebContentsAdapter::reloadAndBypassCache() bool wasDiscarded = (m_lifecycleState == LifecycleState::Discarded); setLifecycleState(LifecycleState::Active); CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost()); - WebEngineSettings *settings = m_adapterClient->webEngineSettings(); + WebEngineSettings *settings = WebEngineSettings::get(m_adapterClient->webEngineSettings()); settings->doApply(); if (!wasDiscarded) // undiscard() already triggers a reload m_webContents->GetController().Reload(content::ReloadType::BYPASSING_CACHE, /*checkRepost = */false); @@ -671,8 +673,7 @@ void WebContentsAdapter::load(const QWebEngineHttpRequest &request) CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost()); - WebEngineSettings *settings = m_adapterClient->webEngineSettings(); - settings->doApply(); + WebEngineSettings::get(m_adapterClient->webEngineSettings())->doApply(); // The situation can occur when relying on the editingFinished signal in QML to set the url // of the WebView. @@ -726,8 +727,8 @@ void WebContentsAdapter::load(const QWebEngineHttpRequest &request) } // convert the custom headers into the format that chromium expects - QVector<QByteArray> headers = request.headers(); - for (QVector<QByteArray>::const_iterator it = headers.cbegin(); it != headers.cend(); ++it) { + QList<QByteArray> headers = request.headers(); + for (QList<QByteArray>::const_iterator it = headers.cbegin(); it != headers.cend(); ++it) { if (params.extra_headers.length() > 0) params.extra_headers += '\n'; params.extra_headers += (*it).toStdString() + ": " + request.header(*it).toStdString(); @@ -759,8 +760,7 @@ void WebContentsAdapter::setContent(const QByteArray &data, const QString &mimeT CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost()); - WebEngineSettings *settings = m_adapterClient->webEngineSettings(); - settings->doApply(); + WebEngineSettings::get(m_adapterClient->webEngineSettings())->doApply(); QByteArray encodedData = data.toPercentEncoding(); std::string urlString; @@ -1131,7 +1131,6 @@ void WebContentsAdapter::download(const QUrl &url, const QString &suggestedFileN if (!dlm) return; - dlmd->markNextDownloadAsUserRequested(); dlm->SetDelegate(dlmd); net::NetworkTrafficAnnotationTag traffic_annotation = @@ -1669,19 +1668,19 @@ void WebContentsAdapter::enterDrag(QDragEnterEvent *e, const QPointF &screenPos) content::RenderViewHost *rvh = m_webContents->GetRenderViewHost(); rvh->GetWidget()->FilterDropData(m_currentDropData.get()); - rvh->GetWidget()->DragTargetDragEnter(*m_currentDropData, toGfx(e->posF()), toGfx(screenPos), + rvh->GetWidget()->DragTargetDragEnter(*m_currentDropData, toGfx(e->position()), toGfx(screenPos), toWeb(e->possibleActions()), - toWeb(e->mouseButtons()) | toWeb(e->keyboardModifiers())); + toWeb(e->buttons()) | toWeb(e->modifiers())); } Qt::DropAction WebContentsAdapter::updateDragPosition(QDragMoveEvent *e, const QPointF &screenPos) { CHECK_INITIALIZED(Qt::DropAction()); content::RenderViewHost *rvh = m_webContents->GetRenderViewHost(); - m_lastDragClientPos = e->posF(); + m_lastDragClientPos = e->position(); m_lastDragScreenPos = screenPos; rvh->GetWidget()->DragTargetDragOver(toGfx(m_lastDragClientPos), toGfx(m_lastDragScreenPos), toWeb(e->possibleActions()), - toWeb(e->mouseButtons()) | toWeb(e->keyboardModifiers())); + toWeb(e->buttons()) | toWeb(e->modifiers())); waitForUpdateDragActionCalled(); return toQt(blink::DragOperation(m_currentDropAction)); } @@ -1724,10 +1723,10 @@ void WebContentsAdapter::endDragging(QDropEvent *e, const QPointF &screenPos) CHECK_INITIALIZED(); content::RenderViewHost *rvh = m_webContents->GetRenderViewHost(); rvh->GetWidget()->FilterDropData(m_currentDropData.get()); - m_lastDragClientPos = e->posF(); + m_lastDragClientPos = e->position(); m_lastDragScreenPos = screenPos; rvh->GetWidget()->DragTargetDrop(*m_currentDropData, toGfx(m_lastDragClientPos), toGfx(m_lastDragScreenPos), - toWeb(e->mouseButtons()) | toWeb(e->keyboardModifiers())); + toWeb(e->buttons()) | toWeb(e->modifiers())); m_currentDropData.reset(); } @@ -1752,8 +1751,8 @@ void WebContentsAdapter::replaceMisspelling(const QString &word) void WebContentsAdapter::focusIfNecessary() { CHECK_INITIALIZED(); - const WebEngineSettings *settings = m_adapterClient->webEngineSettings(); - bool focusOnNavigation = settings->testAttribute(WebEngineSettings::FocusOnNavigationEnabled); + const QWebEngineSettings *settings = m_adapterClient->webEngineSettings(); + bool focusOnNavigation = settings->testAttribute(QWebEngineSettings::FocusOnNavigationEnabled); if (focusOnNavigation) m_webContents->Focus(); } |