diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-08-21 14:28:27 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-10-11 10:15:17 +0200 |
commit | 5f9e2f01e4eae22d9d40bb6b7767cde4cb94766e (patch) | |
tree | 58ade0563aef01b2fdba98c237d634559a1c1889 | |
parent | 687671d249613bb2b00570f93df35fcaa0eacdd3 (diff) |
Adaptations for Chromium 77
Fixes: QTBUG-77267
Change-Id: I181e24cf80ebee6991b95dde6c636f0d169b40a4
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
68 files changed, 835 insertions, 415 deletions
diff --git a/configure.pri b/configure.pri index e5ed3b1f5..13ceb8cdc 100644 --- a/configure.pri +++ b/configure.pri @@ -418,8 +418,8 @@ defineTest(qtwebengine_isWindowsPlatformSupported) { qtwebengine_platformError("Qt WebEngine on Windows requires MSVC or Clang (MSVC mode).") return(false) } - !qtwebengine_isMinWinSDKVersion(10, 17763): { - qtwebengine_platformError("Qt WebEngine on Windows requires a Windows SDK version 10.0.17763 or newer.") + !qtwebengine_isMinWinSDKVersion(10, 18362): { + qtwebengine_platformError("Qt WebEngine on Windows requires a Windows SDK version 10.0.18362 or newer.") return(false) } return(true) diff --git a/src/3rdparty b/src/3rdparty -Subproject 7ac85fb4cc6f44a21761a591ac497ae3d6bf966 +Subproject dc5221146d665f5634fab11fb4c9b5515c1ab07 diff --git a/src/buildtools/config/common.pri b/src/buildtools/config/common.pri index 1a54f1559..23a134774 100644 --- a/src/buildtools/config/common.pri +++ b/src/buildtools/config/common.pri @@ -9,7 +9,6 @@ gn_args += \ is_component_build=false \ is_shared=true \ enable_message_center=false \ - enable_mus=false \ enable_nacl=false \ enable_remoting=false \ enable_reporting=false \ @@ -27,7 +26,8 @@ gn_args += \ toolkit_views=false \ treat_warnings_as_errors=false \ safe_browsing_mode=0 \ - optimize_webui=false + optimize_webui=false \ + forbid_non_component_debug_builds=false greaterThan(QMAKE_JUMBO_MERGE_LIMIT,0) { gn_args += \ diff --git a/src/buildtools/config/windows.pri b/src/buildtools/config/windows.pri index dfa40e9dc..1a3d3d580 100644 --- a/src/buildtools/config/windows.pri +++ b/src/buildtools/config/windows.pri @@ -87,3 +87,10 @@ msvc { } else { error("Qt WebEngine for Windows can only be built with a Microsoft Visual Studio C++ compatible compiler") } + +qtConfig(webengine-spellchecker) { + qtConfig(webengine-native-spellchecker): gn_args += use_browser_spellchecker=true + else: gn_args += use_browser_spellchecker=false +} else { + gn_args += use_browser_spellchecker=false +} diff --git a/src/core/api/qwebenginecookiestore.h b/src/core/api/qwebenginecookiestore.h index 3d313ac23..ff8865406 100644 --- a/src/core/api/qwebenginecookiestore.h +++ b/src/core/api/qwebenginecookiestore.h @@ -50,8 +50,10 @@ #include <functional> namespace QtWebEngineCore { -class ProfileAdapter; +class ContentBrowserClientQt; class CookieMonsterDelegateQt; +class ProfileAdapter; +class RestrictedCookieManagerQt; } // namespace QtWebEngineCore QT_BEGIN_NAMESPACE @@ -84,8 +86,10 @@ Q_SIGNALS: private: explicit QWebEngineCookieStore(QObject *parent = Q_NULLPTR); - friend class QtWebEngineCore::ProfileAdapter; + friend class QtWebEngineCore::ContentBrowserClientQt; friend class QtWebEngineCore::CookieMonsterDelegateQt; + friend class QtWebEngineCore::ProfileAdapter; + friend class QtWebEngineCore::RestrictedCookieManagerQt; Q_DISABLE_COPY(QWebEngineCookieStore) Q_DECLARE_PRIVATE(QWebEngineCookieStore) QScopedPointer<QWebEngineCookieStorePrivate> d_ptr; diff --git a/src/core/api/qwebengineurlrequestinfo.cpp b/src/core/api/qwebengineurlrequestinfo.cpp index 2aa43a318..5492b21d4 100644 --- a/src/core/api/qwebengineurlrequestinfo.cpp +++ b/src/core/api/qwebengineurlrequestinfo.cpp @@ -64,7 +64,8 @@ ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypePing, content::Resource ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeServiceWorker, content::ResourceType::kServiceWorker) ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeCspReport, content::ResourceType::kCspReport) ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypePluginResource, content::ResourceType::kPluginResource) -ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeNavigationPreload, content::ResourceType::kNavigationPreload) +ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeNavigationPreloadMainFrame, content::ResourceType::kNavigationPreloadMainFrame) +ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeNavigationPreloadSubFrame, content::ResourceType::kNavigationPreloadSubFrame) ASSERT_ENUMS_MATCH(QWebEngineUrlRequestInfo::ResourceTypeLast, content::ResourceType::kMaxValue) ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::LinkNavigation, QWebEngineUrlRequestInfo::NavigationTypeLink) @@ -186,8 +187,8 @@ QWebEngineUrlRequestInfo::QWebEngineUrlRequestInfo(QWebEngineUrlRequestInfoPriva violations. CSP reports are in JSON format and they are delivered by HTTP POST requests to specified servers. (Added in Qt 5.7) \value ResourceTypePluginResource A resource requested by a plugin. (Added in Qt 5.7) - \value ResourceTypeNavigationPreload A service worker navigation preload - request. (Added in Qt 5.14) + \value ResourceTypeNavigationPreloadMainFrame A main-frame service worker navigation preload request. (Added in Qt 5.14) + \value ResourceTypeNavigationPreloadSubFrame A sub-frame service worker navigation preload request. (Added in Qt 5.14) \value ResourceTypeUnknown Unknown request type. \note For forward compatibility all values not matched should be treated as unknown, diff --git a/src/core/api/qwebengineurlrequestinfo.h b/src/core/api/qwebengineurlrequestinfo.h index c2c924b05..75b6e3a81 100644 --- a/src/core/api/qwebengineurlrequestinfo.h +++ b/src/core/api/qwebengineurlrequestinfo.h @@ -76,9 +76,10 @@ public: ResourceTypeServiceWorker, // the main resource of a service worker. ResourceTypeCspReport, // Content Security Policy (CSP) violation report ResourceTypePluginResource, // A resource requested by a plugin - ResourceTypeNavigationPreload, // A service worker navigation preload request. + ResourceTypeNavigationPreloadMainFrame = 19, // A main-frame service worker navigation preload request + ResourceTypeNavigationPreloadSubFrame, // A sub-frame service worker navigation preload request #ifndef Q_QDOC - ResourceTypeLast = ResourceTypeNavigationPreload, + ResourceTypeLast = ResourceTypeNavigationPreloadSubFrame, #endif ResourceTypeUnknown = 255 }; diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp index abf1c1154..c760dcd45 100644 --- a/src/core/browser_accessibility_qt.cpp +++ b/src/core/browser_accessibility_qt.cpp @@ -157,7 +157,7 @@ int BrowserAccessibilityQt::indexOfChild(const QAccessibleInterface *iface) cons { const BrowserAccessibilityQt *child = static_cast<const BrowserAccessibilityQt*>(iface); - return child->GetIndexInParent(); + return const_cast<BrowserAccessibilityQt *>(child)->GetIndexInParent(); } QString BrowserAccessibilityQt::text(QAccessible::Text t) const @@ -796,24 +796,24 @@ QAccessibleInterface *BrowserAccessibilityQt::cellAt(int row, int column) const if (row < 0 || row >= rows || column < 0 || column >= columns) return 0; - int cell_id = GetCellId(row, column); - BrowserAccessibility* cell = manager()->GetFromID(cell_id); + base::Optional<int> cell_id = GetCellId(row, column); + BrowserAccessibility* cell = cell_id ? manager()->GetFromID(*cell_id) : nullptr; if (cell) { QAccessibleInterface *iface = static_cast<BrowserAccessibilityQt*>(cell); return iface; } - return 0; + return nullptr; } QAccessibleInterface *BrowserAccessibilityQt::caption() const { - return 0; + return nullptr; } QAccessibleInterface *BrowserAccessibilityQt::summary() const { - return 0; + return nullptr; } QString BrowserAccessibilityQt::columnDescription(int column) const diff --git a/src/core/browser_main_parts_qt.cpp b/src/core/browser_main_parts_qt.cpp index d42a931d0..3e9af8167 100644 --- a/src/core/browser_main_parts_qt.cpp +++ b/src/core/browser_main_parts_qt.cpp @@ -51,6 +51,7 @@ #include "content/public/browser/browser_main_parts.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/child_process_security_policy.h" +#include "content/public/browser/system_connector.h" #include "content/public/common/service_manager_connection.h" #include "extensions/buildflags/buildflags.h" #if BUILDFLAG(ENABLE_EXTENSIONS) @@ -278,10 +279,10 @@ int BrowserMainPartsQt::PreCreateThreads() return 0; } -void BrowserMainPartsQt::ServiceManagerConnectionStarted(content::ServiceManagerConnection *connection) +void BrowserMainPartsQt::PostCreateThreads() { ServiceQt::GetInstance()->InitConnector(); - connection->GetConnector()->WarmService(service_manager::ServiceFilter::ByName("qtwebengine")); + content::GetSystemConnector()->WarmService(service_manager::ServiceFilter::ByName("qtwebengine")); } } // namespace QtWebEngineCore diff --git a/src/core/browser_main_parts_qt.h b/src/core/browser_main_parts_qt.h index 8c6d8340e..f287c2e44 100644 --- a/src/core/browser_main_parts_qt.h +++ b/src/core/browser_main_parts_qt.h @@ -65,7 +65,7 @@ public: void PreMainMessageLoopRun() override; void PostMainMessageLoopRun() override; int PreCreateThreads() override; - void ServiceManagerConnectionStarted(content::ServiceManagerConnection *connection) override; + void PostCreateThreads() override; private: DISALLOW_COPY_AND_ASSIGN(BrowserMainPartsQt); diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp index b226c34ea..4920540a0 100644 --- a/src/core/chromium_overrides.cpp +++ b/src/core/chromium_overrides.cpp @@ -42,6 +42,8 @@ #include "web_contents_view_qt.h" #include "base/values.h" +#include "content/browser/accessibility/accessibility_tree_formatter_blink.h" +#include "content/browser/accessibility/accessibility_tree_formatter_browser.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/common/font_list.h" @@ -136,6 +138,16 @@ ActivationClient *GetActivationClient(aura::Window *) } // namespace wm #endif // defined(USE_AURA) || defined(USE_OZONE) +namespace content { +std::vector<AccessibilityTreeFormatter::TestPass> AccessibilityTreeFormatter::GetTestPasses() +{ + return { + {"blink", &AccessibilityTreeFormatterBlink::CreateBlink}, + {"native", &AccessibilityTreeFormatter::Create}, + }; +} +} // namespace content + #if defined(USE_AURA) namespace ui { diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index f4a14570a..70e0a2376 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -116,15 +116,15 @@ void ClipboardQt::WriteObjects(ui::ClipboardType type, const ObjectMap &objects) // Commit the accumulated data. if (uncommittedData) QGuiApplication::clipboard()->setMimeData(uncommittedData.take(), - type == ui::CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard + type == ui::ClipboardType::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); - if (type == ui::CLIPBOARD_TYPE_COPY_PASTE && IsSupportedClipboardType(ui::CLIPBOARD_TYPE_SELECTION)) { + if (type == ui::ClipboardType::kCopyPaste && IsSupportedClipboardType(ui::ClipboardType::kSelection)) { ObjectMap::const_iterator text_iter = objects.find(CBF_TEXT); if (text_iter != objects.end()) { // Copy text and SourceTag to the selection clipboard. ObjectMap::const_iterator next_iter = text_iter; - WriteObjects(ui::CLIPBOARD_TYPE_SELECTION, ObjectMap(text_iter, ++next_iter, base::KEEP_FIRST_OF_DUPES)); + WriteObjects(ui::ClipboardType::kSelection, ObjectMap(text_iter, ++next_iter, base::KEEP_FIRST_OF_DUPES)); } } } @@ -176,13 +176,13 @@ void ClipboardQt::WriteData(const ui::ClipboardFormatType &format, const char *d bool ClipboardQt::IsFormatAvailable(const ui::ClipboardFormatType &format, ui::ClipboardType type) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( - type == ui::CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); + type == ui::ClipboardType::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); return mimeData && mimeData->hasFormat(QString::fromStdString(format.ToString())); } void ClipboardQt::Clear(ui::ClipboardType type) { - QGuiApplication::clipboard()->clear(type == ui::CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard + QGuiApplication::clipboard()->clear(type == ui::ClipboardType::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); } @@ -196,7 +196,7 @@ void ClipboardQt::ReadAvailableTypes(ui::ClipboardType type, std::vector<base::s types->clear(); const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( - type == ui::CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); + type == ui::ClipboardType::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); if (!mimeData) return; if (mimeData->hasImage() && !mimeData->formats().contains(QStringLiteral("image/png"))) @@ -213,7 +213,7 @@ void ClipboardQt::ReadAvailableTypes(ui::ClipboardType type, std::vector<base::s void ClipboardQt::ReadText(ui::ClipboardType type, base::string16 *result) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( - type == ui::CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); + type == ui::ClipboardType::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); if (mimeData) *result = toString16(mimeData->text()); } @@ -221,7 +221,7 @@ void ClipboardQt::ReadText(ui::ClipboardType type, base::string16 *result) const void ClipboardQt::ReadAsciiText(ui::ClipboardType type, std::string *result) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( - type == ui::CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); + type == ui::ClipboardType::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); if (mimeData) *result = mimeData->text().toStdString(); } @@ -236,7 +236,7 @@ void ClipboardQt::ReadHTML(ui::ClipboardType type, base::string16 *markup, std:: *fragment_end = 0; const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( - type == ui::CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); + type == ui::ClipboardType::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); if (!mimeData) return; *markup = toString16(mimeData->html()); @@ -246,7 +246,7 @@ void ClipboardQt::ReadHTML(ui::ClipboardType type, base::string16 *markup, std:: void ClipboardQt::ReadRTF(ui::ClipboardType type, std::string *result) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( - type == ui::CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); + type == ui::ClipboardType::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); if (!mimeData) return; const QByteArray byteArray = mimeData->data(QString::fromLatin1(ui::kMimeTypeRTF)); @@ -256,7 +256,7 @@ void ClipboardQt::ReadRTF(ui::ClipboardType type, std::string *result) const SkBitmap ClipboardQt::ReadImage(ui::ClipboardType type) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( - type == ui::CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); + type == ui::ClipboardType::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); if (!mimeData) return SkBitmap(); QImage image = qvariant_cast<QImage>(mimeData->imageData()); @@ -282,7 +282,7 @@ SkBitmap ClipboardQt::ReadImage(ui::ClipboardType type) const void ClipboardQt::ReadCustomData(ui::ClipboardType clipboard_type, const base::string16 &type, base::string16 *result) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( - clipboard_type == ui::CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); + clipboard_type == ui::ClipboardType::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); if (!mimeData) return; const QByteArray customData = mimeData->data(QString::fromLatin1(ui::kMimeTypeWebCustomData)); @@ -305,7 +305,7 @@ void ClipboardQt::ReadData(const ui::ClipboardFormatType &format, std::string *r uint64_t ClipboardQt::GetSequenceNumber(ui::ClipboardType type) const { - return clipboardChangeObserver()->getSequenceNumber(type == ui::CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard + return clipboardChangeObserver()->getSequenceNumber(type == ui::ClipboardType::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); } diff --git a/src/core/compositor/compositor.cpp b/src/core/compositor/compositor.cpp index 56693961c..1578e431e 100644 --- a/src/core/compositor/compositor.cpp +++ b/src/core/compositor/compositor.cpp @@ -128,7 +128,7 @@ QSGNode *Compositor::updatePaintNode(QSGNode *oldNode, RenderWidgetHostViewQtDel m_updatePaintNodeShouldCommit = false; gfx::PresentationFeedback dummyFeedback(base::TimeTicks::Now(), base::TimeDelta(), gfx::PresentationFeedback::Flags::kVSync); - m_presentations.insert({m_committedFrame.metadata.frame_token, dummyFeedback}); + m_presentations.emplace(m_committedFrame.metadata.frame_token, viz::FrameTimingDetails{dummyFeedback}); m_resourceTracker->commitResources(); frameNode->commit(m_pendingFrame, m_committedFrame, m_resourceTracker.get(), viewDelegate); @@ -161,7 +161,8 @@ void Compositor::notifyFrameCommitted() void Compositor::sendPresentationFeedback(uint frame_token) { gfx::PresentationFeedback dummyFeedback(base::TimeTicks::Now(), base::TimeDelta(), gfx::PresentationFeedback::Flags::kVSync); - m_presentations.insert({frame_token, dummyFeedback}); + viz::FrameTimingDetails dummyDetails = {dummyFeedback}; + m_presentations.emplace(frame_token, dummyDetails); } bool Compositor::OnBeginFrameDerivedImpl(const viz::BeginFrameArgs &args) diff --git a/src/core/compositor/compositor.h b/src/core/compositor/compositor.h index 6d88dc054..36e62c17a 100644 --- a/src/core/compositor/compositor.h +++ b/src/core/compositor/compositor.h @@ -41,9 +41,9 @@ #define COMPOSITOR_H #include "base/memory/weak_ptr.h" +#include "components/viz/common/frame_timing_details.h" #include "components/viz/common/frame_sinks/begin_frame_source.h" #include "components/viz/common/quads/compositor_frame.h" -#include "ui/gfx/presentation_feedback.h" #include <QtCore/qglobal.h> #include <QtCore/qshareddata.h> @@ -115,7 +115,7 @@ private: std::unique_ptr<CompositorResourceTracker> m_resourceTracker; content::RenderWidgetHost *m_host; std::unique_ptr<viz::SyntheticBeginFrameSource> m_beginFrameSource; - base::flat_map<uint32_t, gfx::PresentationFeedback> m_presentations; + base::flat_map<uint32_t, viz::FrameTimingDetails> m_presentations; viz::mojom::CompositorFrameSinkClient *m_frameSinkClient = nullptr; bool m_updatePaintNodeShouldCommit = false; bool m_needsBeginFrames = false; diff --git a/src/core/compositor/display_gl_output_surface.cpp b/src/core/compositor/display_gl_output_surface.cpp index 5a78b8322..0077af112 100644 --- a/src/core/compositor/display_gl_output_surface.cpp +++ b/src/core/compositor/display_gl_output_surface.cpp @@ -53,20 +53,19 @@ namespace QtWebEngineCore { -DisplayGLOutputSurface::DisplayGLOutputSurface( - scoped_refptr<viz::VizProcessContextProvider> contextProvider, - viz::UpdateVSyncParametersCallback callback) +DisplayGLOutputSurface::DisplayGLOutputSurface(scoped_refptr<viz::VizProcessContextProvider> contextProvider) : OutputSurface(contextProvider) , m_commandBuffer(contextProvider->command_buffer()) , m_gl(contextProvider->ContextGL()) + , m_vizContextProvider(contextProvider) { capabilities_.uses_default_gl_framebuffer = false; m_gl->GenFramebuffers(1, &m_fboId); - contextProvider->SetUpdateVSyncParametersCallback(std::move(callback)); } DisplayGLOutputSurface::~DisplayGLOutputSurface() { + m_vizContextProvider->SetUpdateVSyncParametersCallback(viz::UpdateVSyncParametersCallback()); m_gl->DeleteFramebuffers(1, &m_fboId); if (m_sink) m_sink->disconnect(this); @@ -224,9 +223,10 @@ void DisplayGLOutputSurface::swapBuffersOnVizThread() m_backBuffer = std::move(m_middleBuffer); } - m_display->DidReceiveSwapBuffersAck(); + const auto now = base::TimeTicks::Now(); + m_display->DidReceiveSwapBuffersAck(gfx::SwapTimings{now, now}); m_display->DidReceivePresentationFeedback( - gfx::PresentationFeedback(base::TimeTicks::Now(), base::TimeDelta(), + gfx::PresentationFeedback(now, base::TimeDelta(), gfx::PresentationFeedback::Flags::kVSync)); } @@ -234,12 +234,6 @@ void DisplayGLOutputSurface::SetDrawRectangle(const gfx::Rect &) { } -// Returning nullptr here effectively disables viz::OverlayProcessor. -viz::OverlayCandidateValidator *DisplayGLOutputSurface::GetOverlayCandidateValidator() const -{ - return nullptr; -} - // Returning true here will cause viz::GLRenderer to try to render the output // surface as an overlay plane (see viz::DirectRenderer::DrawFrame and // viz::GLRenderer::ScheduleOverlays). @@ -289,4 +283,18 @@ unsigned DisplayGLOutputSurface::UpdateGpuFence() return 0; } +void DisplayGLOutputSurface::SetUpdateVSyncParametersCallback(viz::UpdateVSyncParametersCallback callback) +{ + m_vizContextProvider->SetUpdateVSyncParametersCallback(std::move(callback)); +} + +void DisplayGLOutputSurface::SetDisplayTransformHint(gfx::OverlayTransform) +{ +} + +gfx::OverlayTransform DisplayGLOutputSurface::GetDisplayTransform() +{ + return gfx::OVERLAY_TRANSFORM_NONE; +} + } // namespace QtWebEngineCore diff --git a/src/core/compositor/display_gl_output_surface.h b/src/core/compositor/display_gl_output_surface.h index c42a6630a..67d987263 100644 --- a/src/core/compositor/display_gl_output_surface.h +++ b/src/core/compositor/display_gl_output_surface.h @@ -61,9 +61,7 @@ namespace QtWebEngineCore { class DisplayGLOutputSurface final : public viz::OutputSurface, public DisplayProducer { public: - DisplayGLOutputSurface( - scoped_refptr<viz::VizProcessContextProvider> contextProvider, - viz::UpdateVSyncParametersCallback callback); + DisplayGLOutputSurface(scoped_refptr<viz::VizProcessContextProvider> contextProvider); ~DisplayGLOutputSurface() override; // Overridden from viz::OutputSurface. @@ -72,7 +70,6 @@ public: void DiscardBackbuffer() override; void BindFramebuffer() override; void SetDrawRectangle(const gfx::Rect &drawRect) override; - viz::OverlayCandidateValidator *GetOverlayCandidateValidator() const override; bool IsDisplayedAsOverlayPlane() const override; unsigned GetOverlayTextureId() const override; gfx::BufferFormat GetOverlayBufferFormat() const override; @@ -86,6 +83,9 @@ public: uint32_t GetFramebufferCopyTextureFormat() override; void SwapBuffers(viz::OutputSurfaceFrame frame) override; unsigned UpdateGpuFence() override; + void SetUpdateVSyncParametersCallback(viz::UpdateVSyncParametersCallback callback) override; + void SetDisplayTransformHint(gfx::OverlayTransform transform) override; + gfx::OverlayTransform GetDisplayTransform() override; // Overridden from DisplayProducer. QSGNode *updatePaintNode(QSGNode *oldNode, RenderWidgetHostViewQtDelegate *delegate) override; @@ -141,6 +141,7 @@ private: std::unique_ptr<Buffer> m_middleBuffer; std::unique_ptr<Buffer> m_frontBuffer; scoped_refptr<base::SingleThreadTaskRunner> m_taskRunner; + scoped_refptr<viz::VizProcessContextProvider> m_vizContextProvider; }; } // namespace QtWebEngineCore diff --git a/src/core/compositor/display_overrides.cpp b/src/core/compositor/display_overrides.cpp index 4547bb04b..5d999ab92 100644 --- a/src/core/compositor/display_overrides.cpp +++ b/src/core/compositor/display_overrides.cpp @@ -40,23 +40,20 @@ #include "display_gl_output_surface.h" #include "display_software_output_surface.h" -#include "components/viz/service/display_embedder/gpu_display_provider.h" +#include "components/viz/service/display_embedder/output_surface_provider_impl.h" #include "gpu/ipc/in_process_command_buffer.h" std::unique_ptr<viz::OutputSurface> -viz::GpuDisplayProvider::CreateGLOutputSurface( - scoped_refptr<VizProcessContextProvider> context_provider, - UpdateVSyncParametersCallback update_vsync_callback) +viz::OutputSurfaceProviderImpl::CreateGLOutputSurface( + scoped_refptr<VizProcessContextProvider> context_provider) { - return std::make_unique<QtWebEngineCore::DisplayGLOutputSurface>( - std::move(context_provider), std::move(update_vsync_callback)); + return std::make_unique<QtWebEngineCore::DisplayGLOutputSurface>(std::move(context_provider)); } std::unique_ptr<viz::OutputSurface> -viz::GpuDisplayProvider::CreateSoftwareOutputSurface( - UpdateVSyncParametersCallback update_vsync_callback) +viz::OutputSurfaceProviderImpl::CreateSoftwareOutputSurface() { - return std::make_unique<QtWebEngineCore::DisplaySoftwareOutputSurface>(std::move(update_vsync_callback)); + return std::make_unique<QtWebEngineCore::DisplaySoftwareOutputSurface>(); } void gpu::InProcessCommandBuffer::GetTextureQt( diff --git a/src/core/compositor/display_software_output_surface.cpp b/src/core/compositor/display_software_output_surface.cpp index 13f8e8f38..5d3c7a6f6 100644 --- a/src/core/compositor/display_software_output_surface.cpp +++ b/src/core/compositor/display_software_output_surface.cpp @@ -63,7 +63,7 @@ public: // Overridden from viz::SoftwareOutputDevice. void Resize(const gfx::Size &sizeInPixels, float devicePixelRatio) override; - void OnSwapBuffers(base::OnceClosure swapCompletionCallback) override; + void OnSwapBuffers(SwapBuffersCallback swap_ack_callback) override; // Overridden from DisplayProducer. QSGNode *updatePaintNode(QSGNode *oldNode, RenderWidgetHostViewQtDelegate *delegate) override; @@ -73,7 +73,7 @@ private: scoped_refptr<DisplayFrameSink> m_sink; float m_devicePixelRatio = 1.0; scoped_refptr<base::SingleThreadTaskRunner> m_taskRunner; - base::OnceClosure m_swapCompletionCallback; + SwapBuffersCallback m_swapCompletionCallback; QImage m_image; float m_imageDevicePixelRatio = 1.0; }; @@ -99,11 +99,11 @@ void DisplaySoftwareOutputSurface::Device::Resize(const gfx::Size &sizeInPixels, surface_ = SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(sizeInPixels.width(), sizeInPixels.height())); } -void DisplaySoftwareOutputSurface::Device::OnSwapBuffers(base::OnceClosure swapCompletionCallback) +void DisplaySoftwareOutputSurface::Device::OnSwapBuffers(SwapBuffersCallback swap_ack_callback) { QMutexLocker locker(&m_mutex); m_taskRunner = base::ThreadTaskRunnerHandle::Get(); - m_swapCompletionCallback = std::move(swapCompletionCallback); + m_swapCompletionCallback = std::move(swap_ack_callback); m_sink->scheduleUpdate(); } @@ -143,7 +143,7 @@ QSGNode *DisplaySoftwareOutputSurface::Device::updatePaintNode( m_image.detach(); } m_imageDevicePixelRatio = m_devicePixelRatio; - m_taskRunner->PostTask(FROM_HERE, std::move(m_swapCompletionCallback)); + m_taskRunner->PostTask(FROM_HERE, base::BindOnce(std::move(m_swapCompletionCallback), toGfx(m_image.size()))); m_taskRunner.reset(); } @@ -155,8 +155,8 @@ QSGNode *DisplaySoftwareOutputSurface::Device::updatePaintNode( return node; } -DisplaySoftwareOutputSurface::DisplaySoftwareOutputSurface(viz::UpdateVSyncParametersCallback callback) - : SoftwareOutputSurface(std::make_unique<Device>(), std::move(callback)) +DisplaySoftwareOutputSurface::DisplaySoftwareOutputSurface() + : SoftwareOutputSurface(std::make_unique<Device>()) {} DisplaySoftwareOutputSurface::~DisplaySoftwareOutputSurface() {} diff --git a/src/core/compositor/display_software_output_surface.h b/src/core/compositor/display_software_output_surface.h index 6707c74dc..ae4b277dd 100644 --- a/src/core/compositor/display_software_output_surface.h +++ b/src/core/compositor/display_software_output_surface.h @@ -47,7 +47,7 @@ namespace QtWebEngineCore { class DisplaySoftwareOutputSurface final : public viz::SoftwareOutputSurface { public: - DisplaySoftwareOutputSurface(viz::UpdateVSyncParametersCallback callback); + DisplaySoftwareOutputSurface(); ~DisplaySoftwareOutputSurface() override; // Overridden from viz::SoftwareOutputSurface. diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 69df2232a..6fcd9ad5b 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -84,7 +84,6 @@ #include "qtwebengine/browser/qtwebengine_renderer_manifest.h" #include "net/ssl/client_cert_identity.h" #include "net/ssl/client_cert_store.h" -#include "services/proxy_resolver/proxy_resolver_service.h" #include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/service.h" #include "services/service_manager/sandbox/switches.h" @@ -125,6 +124,8 @@ #include "web_contents_delegate_qt.h" #include "web_engine_context.h" #include "web_engine_library_info.h" +#include "api/qwebenginecookiestore.h" +#include "api/qwebenginecookiestore_p.h" #if defined(Q_OS_LINUX) #include "global_descriptors_qt.h" @@ -158,8 +159,9 @@ #include <QGuiApplication> #include <QLocale> -#ifndef QT_NO_OPENGL +#if QT_CONFIG(opengl) # include <QOpenGLContext> +# include <QOpenGLExtraFunctions> #endif #include <qpa/qplatformnativeinterface.h> @@ -202,13 +204,15 @@ public: } void* GetHandle() override { return m_handle; } - bool WasAllocatedUsingRobustnessExtension() override + unsigned int CheckStickyGraphicsResetStatus() override { #if QT_CONFIG(opengl) - if (QOpenGLContext *context = qt_gl_global_share_context()) - return context->format().testOption(QSurfaceFormat::ResetNotification); + if (QOpenGLContext *context = qt_gl_global_share_context()) { + if (context->format().testOption(QSurfaceFormat::ResetNotification)) + return context->extraFunctions()->glGetGraphicsResetStatus(); + } #endif - return false; + return 0 /*GL_NO_ERROR*/; } // We don't care about the rest, this context shouldn't be used except for its handle. @@ -404,10 +408,11 @@ void ContentBrowserClientQt::AllowCertificateError(content::WebContents *webCont contentsDelegate->allowCertificateError(errorController); } -void ContentBrowserClientQt::SelectClientCertificate(content::WebContents *webContents, - net::SSLCertRequestInfo *certRequestInfo, - net::ClientCertIdentityList clientCerts, - std::unique_ptr<content::ClientCertificateDelegate> delegate) + +base::OnceClosure ContentBrowserClientQt::SelectClientCertificate(content::WebContents *webContents, + net::SSLCertRequestInfo *certRequestInfo, + net::ClientCertIdentityList clientCerts, + std::unique_ptr<content::ClientCertificateDelegate> delegate) { if (!clientCerts.empty()) { WebContentsDelegateQt* contentsDelegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate()); @@ -419,6 +424,8 @@ void ContentBrowserClientQt::SelectClientCertificate(content::WebContents *webCo } else { delegate->ContinueWithCertificate(nullptr, nullptr); } + // This is consistent with AwContentBrowserClient and CastContentBrowserClient: + return base::OnceClosure(); } std::unique_ptr<net::ClientCertStore> ContentBrowserClientQt::CreateClientCertStore(content::ResourceContext *resource_context) @@ -652,13 +659,6 @@ std::unique_ptr<device::LocationProvider> ContentBrowserClientQt::OverrideSystem } #endif -scoped_refptr<net::URLRequestContextGetter> GetSystemRequestContextOnUIThread() -{ - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - return scoped_refptr<net::URLRequestContextGetter>( - ProfileAdapter::createDefaultProfileAdapter()->profile()->GetRequestContext()); -} - void ContentBrowserClientQt::AddNetworkHintsMessageFilter(int render_process_id, net::URLRequestContext *context) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -679,38 +679,42 @@ bool ContentBrowserClientQt::ShouldEnableStrictSiteIsolation() return false; } -bool ContentBrowserClientQt::AllowGetCookie(const GURL &url, - const GURL &first_party, - const net::CookieList & /*cookie_list*/, - content::ResourceContext *context, - int /*render_process_id*/, - int /*render_frame_id*/) -{ - DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - return ProfileIODataQt::FromResourceContext(context)->canGetCookies(toQt(first_party), toQt(url)); +bool ContentBrowserClientQt::WillCreateRestrictedCookieManager(network::mojom::RestrictedCookieManagerRole role, + content::BrowserContext *browser_context, + const url::Origin &origin, + bool is_service_worker, + int process_id, + int routing_id, + network::mojom::RestrictedCookieManagerRequest *request) +{ + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::IO}, + base::BindOnce(&ProfileIODataQt::CreateRestrictedCookieManager, + ProfileIODataQt::FromBrowserContext(browser_context)->getWeakPtrOnUIThread(), + std::move(*request), + role, origin, is_service_worker, process_id, routing_id)); + return true; } -bool ContentBrowserClientQt::AllowSetCookie(const GURL &url, - const GURL &first_party, - const net::CanonicalCookie& /*cookie*/, - content::ResourceContext *context, - int /*render_process_id*/, - int /*render_frame_id*/) +bool ContentBrowserClientQt::AllowAppCacheOnIO(const GURL &manifest_url, + const GURL &first_party, + content::ResourceContext *context) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - return ProfileIODataQt::FromResourceContext(context)->canSetCookie(toQt(first_party), QByteArray(), toQt(url)); + return ProfileIODataQt::FromResourceContext(context)->canGetCookies(toQt(first_party), toQt(manifest_url)); } bool ContentBrowserClientQt::AllowAppCache(const GURL &manifest_url, const GURL &first_party, - content::ResourceContext *context) + content::BrowserContext *context) { - DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - return ProfileIODataQt::FromResourceContext(context)->canGetCookies(toQt(first_party), toQt(manifest_url)); + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + return static_cast<ProfileQt *>(context)->profileAdapter()->cookieStore()->d_func()->canAccessCookies(toQt(first_party), toQt(manifest_url)); } bool ContentBrowserClientQt::AllowServiceWorker(const GURL &scope, const GURL &first_party, + const GURL & /*script_url*/, content::ResourceContext *context, base::RepeatingCallback<content::WebContents*()> wc_getter) { @@ -760,12 +764,12 @@ bool ContentBrowserClientQt::HandleExternalProtocol( bool is_main_frame, ui::PageTransition page_transition, bool has_user_gesture, - network::mojom::URLLoaderFactoryRequest *factory_request, - network::mojom::URLLoaderFactory *&out_factory) + network::mojom::URLLoaderFactoryPtr *out_factory) { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); Q_UNUSED(child_id); Q_UNUSED(navigation_data); + Q_UNUSED(out_factory); base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(&LaunchURL, @@ -877,7 +881,7 @@ std::string ContentBrowserClientQt::getUserAgent() return content::BuildUserAgentFromProduct("QtWebEngine/" QTWEBENGINECORE_VERSION_STR " Chrome/" CHROMIUM_VERSION); } -std::string ContentBrowserClientQt::GetProduct() const +std::string ContentBrowserClientQt::GetProduct() { QString productName(qApp->applicationName() % '/' % qApp->applicationVersion()); return productName.toStdString(); diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h index 7201bb0df..f5b03a8d9 100644 --- a/src/core/content_browser_client_qt.h +++ b/src/core/content_browser_client_qt.h @@ -102,10 +102,10 @@ public: bool strict_enforcement, bool expired_previous_decision, const base::Callback<void(content::CertificateRequestResultType)> &callback) override; - void SelectClientCertificate(content::WebContents* web_contents, - net::SSLCertRequestInfo* cert_request_info, - net::ClientCertIdentityList client_certs, - std::unique_ptr<content::ClientCertificateDelegate> delegate) override; + base::OnceClosure SelectClientCertificate(content::WebContents* web_contents, + net::SSLCertRequestInfo* cert_request_info, + net::ClientCertIdentityList client_certs, + std::unique_ptr<content::ClientCertificateDelegate> delegate) override; std::unique_ptr<net::ClientCertStore> CreateClientCertStore(content::ResourceContext *resource_context) override; content::DevToolsManagerDelegate *GetDevToolsManagerDelegate() override; content::PlatformNotificationService * GetPlatformNotificationService(content::BrowserContext *browser_context) override; @@ -142,26 +142,24 @@ public: bool *no_javascript_access) override; bool ShouldEnableStrictSiteIsolation() override; - bool AllowGetCookie(const GURL& url, - const GURL& first_party, - const net::CookieList& cookie_list, - content::ResourceContext* context, - int render_process_id, - int render_frame_id) override; - - bool AllowSetCookie(const GURL& url, - const GURL& first_party, - const net::CanonicalCookie& cookie, - content::ResourceContext* context, - int render_process_id, - int render_frame_id) override; - + bool WillCreateRestrictedCookieManager(network::mojom::RestrictedCookieManagerRole role, + content::BrowserContext *browser_context, + const url::Origin& origin, + bool is_service_worker, + int process_id, + int routing_id, + network::mojom::RestrictedCookieManagerRequest *request) override; + + bool AllowAppCacheOnIO(const GURL& manifest_url, + const GURL& first_party, + content::ResourceContext* context) override; bool AllowAppCache(const GURL& manifest_url, const GURL& first_party, - content::ResourceContext* context) override; + content::BrowserContext* context) override; bool AllowServiceWorker(const GURL& scope, const GURL& first_party, + const GURL& script_url, content::ResourceContext* context, base::RepeatingCallback<content::WebContents*()> wc_getter) override; @@ -197,6 +195,7 @@ public: scoped_refptr<net::HttpResponseHeaders> response_headers, bool first_auth_attempt, LoginAuthRequiredCallback auth_required_callback) override; + bool HandleExternalProtocol( const GURL &url, content::ResourceRequestInfo::WebContentsGetter web_contents_getter, @@ -205,8 +204,7 @@ public: bool is_main_frame, ui::PageTransition page_transition, bool has_user_gesture, - network::mojom::URLLoaderFactoryRequest *factory_request, - network::mojom::URLLoaderFactory *&out_factory) override; + network::mojom::URLLoaderFactoryPtr *out_factory) override; std::vector<std::unique_ptr<content::URLLoaderThrottle>> CreateURLLoaderThrottlesOnIO( const network::ResourceRequest &request, content::ResourceContext *resource_context, @@ -220,8 +218,8 @@ public: static std::string getUserAgent(); - std::string GetUserAgent() const override { return getUserAgent(); } - std::string GetProduct() const override; + std::string GetUserAgent() override { return getUserAgent(); } + std::string GetProduct() override; private: void InitFrameInterfaces(); diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index 8e5fdf06c..554ee3e12 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -414,21 +414,27 @@ void ContentClientQt::AddAdditionalSchemes(Schemes* schemes) schemes->standard_schemes.push_back("chrome-extension"); } -base::StringPiece ContentClientQt::GetDataResource(int resource_id, ui::ScaleFactor scale_factor) const { +base::StringPiece ContentClientQt::GetDataResource(int resource_id, ui::ScaleFactor scale_factor) +{ return ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(resource_id, scale_factor); } -base::RefCountedMemory *ContentClientQt::GetDataResourceBytes(int resource_id) const +base::RefCountedMemory *ContentClientQt::GetDataResourceBytes(int resource_id) { return ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id); } -gfx::Image &ContentClientQt::GetNativeImageNamed(int resource_id) const +gfx::Image &ContentClientQt::GetNativeImageNamed(int resource_id) { return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); } -base::string16 ContentClientQt::GetLocalizedString(int message_id) const +bool ContentClientQt::IsDataResourceGzipped(int resource_id) +{ + return ui::ResourceBundle::GetSharedInstance().IsGzipped(resource_id); +} + +base::string16 ContentClientQt::GetLocalizedString(int message_id) { return l10n_util::GetStringUTF16(message_id); } diff --git a/src/core/content_client_qt.h b/src/core/content_client_qt.h index 1f4ac0b63..581805a51 100644 --- a/src/core/content_client_qt.h +++ b/src/core/content_client_qt.h @@ -56,10 +56,11 @@ public: std::vector<media::CdmHostFilePath> *cdm_host_file_paths) override; void AddAdditionalSchemes(Schemes* schemes) override; - base::StringPiece GetDataResource(int, ui::ScaleFactor) const override; - base::RefCountedMemory* GetDataResourceBytes(int resource_id) const override; - gfx::Image &GetNativeImageNamed(int resource_id) const override; - base::string16 GetLocalizedString(int message_id) const override; + base::StringPiece GetDataResource(int, ui::ScaleFactor) override; + base::RefCountedMemory* GetDataResourceBytes(int resource_id) override; + gfx::Image &GetNativeImageNamed(int resource_id) override; + bool IsDataResourceGzipped(int resource_id) override; + base::string16 GetLocalizedString(int message_id) override; }; } // namespace QtWebEngineCore diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp index 6df20896c..cb23a5287 100644 --- a/src/core/content_main_delegate_qt.cpp +++ b/src/core/content_main_delegate_qt.cpp @@ -130,7 +130,7 @@ static logging::LoggingDestination DetermineLogMode(const base::CommandLine& com enable_logging = !enable_logging; if (enable_logging) - return logging::LOG_TO_SYSTEM_DEBUG_LOG; + return logging::LOG_TO_SYSTEM_DEBUG_LOG | logging::LOG_TO_STDERR; else return logging::LOG_NONE; } @@ -149,7 +149,9 @@ void ContentMainDelegateQt::PreSandboxStartup() base::CommandLine* parsedCommandLine = base::CommandLine::ForCurrentProcess(); logging::LoggingSettings settings; settings.logging_dest = DetermineLogMode(*parsedCommandLine); - logging::InitLogging(settings); + bool success = logging::InitLogging(settings); + if (!success) + qWarning("Failed to initialize Chromium logging"); // view the logs with process/thread IDs and timestamps logging::SetLogItems(true, //enable_process_id true, //enable_thread_id diff --git a/src/core/content_utility_client_qt.cpp b/src/core/content_utility_client_qt.cpp index 0b2dbd08e..12a538a07 100644 --- a/src/core/content_utility_client_qt.cpp +++ b/src/core/content_utility_client_qt.cpp @@ -39,9 +39,8 @@ #include "content_utility_client_qt.h" -#include "base/bind.h" -#include "content/public/utility/utility_thread.h" -#include "services/proxy_resolver/proxy_resolver_service.h" +#include "base/no_destructor.h" +#include "services/proxy_resolver/proxy_resolver_factory_impl.h" namespace QtWebEngineCore { @@ -51,41 +50,12 @@ ContentUtilityClientQt::ContentUtilityClientQt() ContentUtilityClientQt::~ContentUtilityClientQt() = default; -namespace { - -std::unique_ptr<service_manager::Service> CreateProxyResolverService(service_manager::mojom::ServiceRequest request) +void ContentUtilityClientQt::RunIOThreadService(mojo::GenericPendingReceiver *receiver) { - return std::make_unique<proxy_resolver::ProxyResolverService>(std::move(request)); -} - -using ServiceFactory = base::OnceCallback<std::unique_ptr<service_manager::Service>()>; -void RunServiceOnIOThread(ServiceFactory factory) -{ - base::OnceClosure terminate_process = base::BindOnce( - base::IgnoreResult(&base::SequencedTaskRunner::PostTask), - base::SequencedTaskRunnerHandle::Get(), FROM_HERE, - base::BindOnce([] { content::UtilityThread::Get()->ReleaseProcess(); })); - content::ChildThread::Get()->GetIOTaskRunner()->PostTask( - FROM_HERE, - base::BindOnce( - [](ServiceFactory factory, base::OnceClosure terminate_process) { - service_manager::Service::RunAsyncUntilTermination( - std::move(factory).Run(), std::move(terminate_process)); - }, - std::move(factory), std::move(terminate_process))); -} - -} // namespace - -bool ContentUtilityClientQt::HandleServiceRequest(const std::string &service_name, - service_manager::mojom::ServiceRequest request) -{ - if (service_name == proxy_resolver::mojom::kProxyResolverServiceName) { - RunServiceOnIOThread(base::BindOnce(&CreateProxyResolverService, std::move(request))); - return true; + if (auto factory_receiver = receiver->As<proxy_resolver::mojom::ProxyResolverFactory>()) { + static base::NoDestructor<proxy_resolver::ProxyResolverFactoryImpl> factory(std::move(factory_receiver)); + return; } - - return false; } } // namespace diff --git a/src/core/content_utility_client_qt.h b/src/core/content_utility_client_qt.h index 79972adb8..2a9ecff93 100644 --- a/src/core/content_utility_client_qt.h +++ b/src/core/content_utility_client_qt.h @@ -53,8 +53,7 @@ public: ~ContentUtilityClientQt() override; // content::ContentUtilityClient: - bool HandleServiceRequest(const std::string &service_name, - service_manager::mojom::ServiceRequest request) override; + void RunIOThreadService(mojo::GenericPendingReceiver *receiver) override; }; diff --git a/src/core/core_chromium.pri b/src/core/core_chromium.pri index 810ec9a0f..9eab15456 100644 --- a/src/core/core_chromium.pri +++ b/src/core/core_chromium.pri @@ -86,6 +86,7 @@ SOURCES = \ net/network_delegate_qt.cpp \ net/proxy_config_service_qt.cpp \ net/qrc_url_scheme_handler.cpp \ + net/restricted_cookie_manager_qt.cpp \ net/ssl_host_state_delegate_qt.cpp \ net/url_request_context_getter_qt.cpp \ net/url_request_custom_job.cpp \ @@ -195,6 +196,7 @@ HEADERS = \ net/custom_protocol_handler.h \ net/network_delegate_qt.h \ net/qrc_url_scheme_handler.h \ + net/restricted_cookie_manager_qt.h \ net/ssl_host_state_delegate_qt.h \ net/url_request_context_getter_qt.h \ net/url_request_custom_job.h \ diff --git a/src/core/extensions/component_extension_resource_manager_qt.cpp b/src/core/extensions/component_extension_resource_manager_qt.cpp index f83fcc51c..bb1dd045c 100644 --- a/src/core/extensions/component_extension_resource_manager_qt.cpp +++ b/src/core/extensions/component_extension_resource_manager_qt.cpp @@ -96,7 +96,7 @@ void ComponentExtensionResourceManagerQt::AddComponentResourceEntries(const Grit base::FilePath resource_path = base::FilePath().AppendASCII(entries[i].name); resource_path = resource_path.NormalizePathSeparators(); - DCHECK(!base::ContainsKey(path_to_resource_id_, resource_path)); + DCHECK(!base::Contains(path_to_resource_id_, resource_path)); path_to_resource_id_[resource_path] = entries[i].value; } } diff --git a/src/core/extensions/extension_system_qt.cpp b/src/core/extensions/extension_system_qt.cpp index 4ca407421..7278e50c1 100644 --- a/src/core/extensions/extension_system_qt.cpp +++ b/src/core/extensions/extension_system_qt.cpp @@ -137,8 +137,9 @@ class ContentVerifierDelegateQt // This should return what verification mode is appropriate for the given // extension, if any. - Mode ShouldBeVerified(const Extension& extension) override { - return NONE; + bool ShouldBeVerified(const Extension& extension) override + { + return false; } // Should return the public key to use for validating signatures via the two @@ -398,11 +399,6 @@ void ExtensionSystemQt::InitForRegularProfile(bool extensions_enabled) Init(extensions_enabled); } -void ExtensionSystemQt::InitForIncognitoProfile() -{ - NOTIMPLEMENTED(); -} - std::unique_ptr<ExtensionSet> ExtensionSystemQt::GetDependentExtensions(const Extension *extension) { return base::WrapUnique(new ExtensionSet()); diff --git a/src/core/extensions/extension_system_qt.h b/src/core/extensions/extension_system_qt.h index 712e0104d..4370f5cc3 100644 --- a/src/core/extensions/extension_system_qt.h +++ b/src/core/extensions/extension_system_qt.h @@ -85,7 +85,6 @@ public: // ExtensionSystem implementation: void InitForRegularProfile(bool extensions_enabled) override; - void InitForIncognitoProfile() override; ExtensionService *extension_service() override; RuntimeData *runtime_data() override; ManagementPolicy *management_policy() override; diff --git a/src/core/login_delegate_qt.cpp b/src/core/login_delegate_qt.cpp index 7970b9b46..f63252112 100644 --- a/src/core/login_delegate_qt.cpp +++ b/src/core/login_delegate_qt.cpp @@ -50,7 +50,6 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/resource_dispatcher_host.h" #include "content/public/browser/resource_request_info.h" -#include "content/public/browser/stream_info.h" #include "extensions/buildflags/buildflags.h" #if BUILDFLAG(ENABLE_EXTENSIONS) #include "extensions/browser/info_map.h" diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp index 55c0bb39b..04c68de4c 100644 --- a/src/core/media_capture_devices_dispatcher.cpp +++ b/src/core/media_capture_devices_dispatcher.cpp @@ -74,6 +74,8 @@ namespace QtWebEngineCore { using content::BrowserThread; +using blink::mojom::MediaStreamRequestResult; +using blink::mojom::MediaStreamType; namespace { @@ -94,16 +96,16 @@ void getDevicesForDesktopCapture(blink::MediaStreamDevices *devices, content::De DCHECK_CURRENTLY_ON(BrowserThread::UI); // Add selected desktop source to the list. - devices->push_back(blink::MediaStreamDevice(blink::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE, mediaId.ToString(), "Screen")); + devices->push_back(blink::MediaStreamDevice(MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE, mediaId.ToString(), "Screen")); if (captureAudio) { if (mediaId.type == content::DesktopMediaID::TYPE_WEB_CONTENTS) { devices->push_back( - blink::MediaStreamDevice(blink::MEDIA_GUM_DESKTOP_AUDIO_CAPTURE, + blink::MediaStreamDevice(MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE, mediaId.ToString(), "Tab audio")); } else { // Use the special loopback device ID for system audio capture. devices->push_back(blink::MediaStreamDevice( - blink::MEDIA_GUM_DESKTOP_AUDIO_CAPTURE, + MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE, media::AudioDeviceDescription::kLoopbackInputDeviceId, "System Audio")); } @@ -154,14 +156,14 @@ WebContentsAdapterClient::MediaRequestFlags mediaRequestFlagsForRequest(const co { WebContentsAdapterClient::MediaRequestFlags requestFlags = WebContentsAdapterClient::MediaNone; - if (request.audio_type == blink::MEDIA_DEVICE_AUDIO_CAPTURE) + if (request.audio_type == MediaStreamType::DEVICE_AUDIO_CAPTURE) requestFlags |= WebContentsAdapterClient::MediaAudioCapture; - else if (request.audio_type == blink::MEDIA_GUM_DESKTOP_AUDIO_CAPTURE) + else if (request.audio_type == MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE) requestFlags |= WebContentsAdapterClient::MediaDesktopAudioCapture; - if (request.video_type == blink::MEDIA_DEVICE_VIDEO_CAPTURE) + if (request.video_type == MediaStreamType::DEVICE_VIDEO_CAPTURE) requestFlags |= WebContentsAdapterClient::MediaVideoCapture; - else if (request.video_type == blink::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE) + else if (request.video_type == MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE) requestFlags |= WebContentsAdapterClient::MediaDesktopVideoCapture; return requestFlags; @@ -185,7 +187,7 @@ public: } private: - gfx::NativeViewId OnStarted(base::OnceClosure, base::RepeatingClosure) override + gfx::NativeViewId OnStarted(base::OnceClosure, SourceCallback) override { DCHECK(!m_started); m_started = true; @@ -234,13 +236,13 @@ void MediaCaptureDevicesDispatcher::handleMediaAccessPermissionResponse(content: qWarning("Security origin mismatch for media access permission: %s requested and %s provided\n", qPrintable(requestSecurityOrigin.toString()), qPrintable(securityOrigin.toString())); bool microphoneRequested = - (request.audio_type && authorizationFlags & WebContentsAdapterClient::MediaAudioCapture); + (request.audio_type != MediaStreamType::NO_SERVICE && (authorizationFlags & WebContentsAdapterClient::MediaAudioCapture)); bool webcamRequested = - (request.video_type && authorizationFlags & WebContentsAdapterClient::MediaVideoCapture); + (request.video_type != MediaStreamType::NO_SERVICE && (authorizationFlags & WebContentsAdapterClient::MediaVideoCapture)); bool desktopAudioRequested = - (request.audio_type && authorizationFlags & WebContentsAdapterClient::MediaDesktopAudioCapture); + (request.audio_type != MediaStreamType::NO_SERVICE && (authorizationFlags & WebContentsAdapterClient::MediaDesktopAudioCapture)); bool desktopVideoRequested = - (request.video_type && authorizationFlags & WebContentsAdapterClient::MediaDesktopVideoCapture); + (request.video_type != MediaStreamType::NO_SERVICE && (authorizationFlags & WebContentsAdapterClient::MediaDesktopVideoCapture)); if (securityOriginsMatch) { if (microphoneRequested || webcamRequested) { @@ -273,10 +275,10 @@ void MediaCaptureDevicesDispatcher::handleMediaAccessPermissionResponse(content: } if (devices.empty()) - std::move(callback).Run(devices, blink::MEDIA_DEVICE_INVALID_STATE, + std::move(callback).Run(devices, MediaStreamRequestResult::INVALID_STATE, std::unique_ptr<content::MediaStreamUI>()); else - std::move(callback).Run(devices, blink::MEDIA_DEVICE_OK, + std::move(callback).Run(devices, MediaStreamRequestResult::OK, std::make_unique<MediaStreamUIQt>(webContents, devices)); } @@ -314,17 +316,17 @@ void MediaCaptureDevicesDispatcher::processMediaAccessRequest(WebContentsAdapter DCHECK_CURRENTLY_ON(BrowserThread::UI); // Let's not support tab capture for now. - if (request.video_type == blink::MEDIA_GUM_TAB_VIDEO_CAPTURE || request.audio_type == blink::MEDIA_GUM_TAB_AUDIO_CAPTURE) { - std::move(callback).Run(blink::MediaStreamDevices(), blink::MEDIA_DEVICE_NOT_SUPPORTED, std::unique_ptr<content::MediaStreamUI>()); + if (request.video_type == MediaStreamType::GUM_TAB_VIDEO_CAPTURE || request.audio_type == MediaStreamType::GUM_TAB_AUDIO_CAPTURE) { + std::move(callback).Run(blink::MediaStreamDevices(), MediaStreamRequestResult::NOT_SUPPORTED, std::unique_ptr<content::MediaStreamUI>()); return; } - if (request.video_type == blink::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE || request.audio_type == blink::MEDIA_GUM_DESKTOP_AUDIO_CAPTURE) { + if (request.video_type == MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE || request.audio_type == MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE) { const bool screenCaptureEnabled = adapterClient->webEngineSettings()->testAttribute(WebEngineSettings::ScreenCaptureEnabled); const bool originIsSecure = content::IsOriginSecure(request.security_origin); if (!screenCaptureEnabled || !originIsSecure) { - std::move(callback).Run(blink::MediaStreamDevices(), blink::MEDIA_DEVICE_INVALID_STATE, std::unique_ptr<content::MediaStreamUI>()); + std::move(callback).Run(blink::MediaStreamDevices(), MediaStreamRequestResult::INVALID_STATE, std::unique_ptr<content::MediaStreamUI>()); return; } @@ -344,8 +346,8 @@ void MediaCaptureDevicesDispatcher::processDesktopCaptureAccessRequest(content:: { blink::MediaStreamDevices devices; - if (request.video_type != blink::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE || request.requested_video_device_id.empty()) { - std::move(callback).Run(devices, blink::MEDIA_DEVICE_INVALID_STATE, std::unique_ptr<content::MediaStreamUI>()); + if (request.video_type != MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE || request.requested_video_device_id.empty()) { + std::move(callback).Run(devices, MediaStreamRequestResult::INVALID_STATE, std::unique_ptr<content::MediaStreamUI>()); return; } @@ -366,20 +368,20 @@ void MediaCaptureDevicesDispatcher::processDesktopCaptureAccessRequest(content:: // Received invalid device id. if (mediaId.type == content::DesktopMediaID::TYPE_NONE) { - std::move(callback).Run(devices, blink::MEDIA_DEVICE_INVALID_STATE, std::unique_ptr<content::MediaStreamUI>()); + std::move(callback).Run(devices, MediaStreamRequestResult::INVALID_STATE, std::unique_ptr<content::MediaStreamUI>()); return; } // Audio is only supported for screen capture streams. - bool capture_audio = (mediaId.type == content::DesktopMediaID::TYPE_SCREEN && request.audio_type == blink::MEDIA_GUM_DESKTOP_AUDIO_CAPTURE); + bool capture_audio = (mediaId.type == content::DesktopMediaID::TYPE_SCREEN && request.audio_type == MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE); getDevicesForDesktopCapture(&devices, mediaId, capture_audio); if (devices.empty()) - std::move(callback).Run(devices, blink::MEDIA_DEVICE_INVALID_STATE, + std::move(callback).Run(devices, MediaStreamRequestResult::INVALID_STATE, std::unique_ptr<content::MediaStreamUI>()); else - std::move(callback).Run(devices, blink::MEDIA_DEVICE_OK, + std::move(callback).Run(devices, MediaStreamRequestResult::OK, std::make_unique<MediaStreamUIQt>(webContents, devices)); } @@ -433,7 +435,7 @@ void MediaCaptureDevicesDispatcher::getDefaultDevices(const std::string &audioDe } } -void MediaCaptureDevicesDispatcher::OnMediaRequestStateChanged(int render_process_id, int render_frame_id, int page_request_id, const GURL &security_origin, blink::MediaStreamType stream_type, content::MediaRequestState state) +void MediaCaptureDevicesDispatcher::OnMediaRequestStateChanged(int render_process_id, int render_frame_id, int page_request_id, const GURL &security_origin, blink::mojom::MediaStreamType stream_type, content::MediaRequestState state) { DCHECK_CURRENTLY_ON(BrowserThread::IO); base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, @@ -446,7 +448,7 @@ void MediaCaptureDevicesDispatcher::updateMediaRequestStateOnUIThread(int render int render_frame_id, int page_request_id, const GURL & /*security_origin*/, - blink::MediaStreamType /*stream_type*/, + blink::mojom::MediaStreamType /*stream_type*/, content::MediaRequestState state) { DCHECK_CURRENTLY_ON(BrowserThread::UI); diff --git a/src/core/media_capture_devices_dispatcher.h b/src/core/media_capture_devices_dispatcher.h index 07afd54bf..6a67a53e9 100644 --- a/src/core/media_capture_devices_dispatcher.h +++ b/src/core/media_capture_devices_dispatcher.h @@ -81,20 +81,20 @@ private: int render_frame_id, int page_request_id, const GURL &security_origin, - blink::MediaStreamType stream_type, + blink::mojom::MediaStreamType stream_type, content::MediaRequestState state) override; void OnCreatingAudioStream(int /*render_process_id*/, int /*render_frame_id*/) override {} void OnSetCapturingLinkSecured(int /*render_process_id*/, int /*render_frame_id*/, int /*page_request_id*/, - blink::MediaStreamType /*stream_type*/, + blink::mojom::MediaStreamType /*stream_type*/, bool /*is_secure*/) override {} friend struct base::DefaultSingletonTraits<MediaCaptureDevicesDispatcher>; typedef base::RepeatingCallback<void(const blink::MediaStreamDevices &devices, - blink::MediaStreamRequestResult result, + blink::mojom::MediaStreamRequestResult result, std::unique_ptr<content::MediaStreamUI> ui)> RepeatingMediaResponseCallback; @@ -121,7 +121,7 @@ private: // Called by the MediaObserver() functions, executed on UI thread. void updateMediaRequestStateOnUIThread(int render_process_id, int render_frame_id, int page_request_id, const GURL &security_origin, - blink::MediaStreamType stream_type, content::MediaRequestState state); + blink::mojom::MediaStreamType stream_type, content::MediaRequestState state); RequestsQueues m_pendingRequests; diff --git a/src/core/net/restricted_cookie_manager_qt.cpp b/src/core/net/restricted_cookie_manager_qt.cpp new file mode 100644 index 000000000..e01969f4d --- /dev/null +++ b/src/core/net/restricted_cookie_manager_qt.cpp @@ -0,0 +1,184 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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.LGPL3 included in the +** 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-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// originally based on android_webview/browser/network_service/aw_proxying_restricted_cookie_manager.cc: +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "restricted_cookie_manager_qt.h" + +#include "api/qwebenginecookiestore.h" +#include "api/qwebenginecookiestore_p.h" +#include "profile_adapter.h" +#include "profile_qt.h" +#include "type_conversion.h" + +#include "base/memory/ptr_util.h" +#include "base/task/post_task.h" +#include "content/public/browser/browser_task_traits.h" +#include "content/public/browser/browser_thread.h" +#include "mojo/public/cpp/bindings/strong_binding.h" + +namespace QtWebEngineCore { + +class RestrictedCookieManagerListenerQt : public network::mojom::CookieChangeListener { +public: + RestrictedCookieManagerListenerQt(const GURL &url, + const GURL &site_for_cookies, + base::WeakPtr<RestrictedCookieManagerQt> restricted_cookie_manager, + network::mojom::CookieChangeListenerPtr client_listener) + : url_(url) + , site_for_cookies_(site_for_cookies) + , restricted_cookie_manager_(restricted_cookie_manager) + , client_listener_(std::move(client_listener)) + {} + + void OnCookieChange(const net::CanonicalCookie &cookie, network::mojom::CookieChangeCause cause) override + { + if (restricted_cookie_manager_ && restricted_cookie_manager_->allowCookies(url_, site_for_cookies_)) + client_listener_->OnCookieChange(cookie, cause); + } + +private: + const GURL url_; + const GURL site_for_cookies_; + base::WeakPtr<RestrictedCookieManagerQt> restricted_cookie_manager_; + network::mojom::CookieChangeListenerPtr client_listener_; +}; + +RestrictedCookieManagerQt::RestrictedCookieManagerQt(base::WeakPtr<ProfileIODataQt> profileIoData, + network::mojom::RestrictedCookieManagerRole role, + net::CookieStore *cookie_store, + network::CookieSettings *cookie_settings, + const url::Origin &origin, + bool is_service_worker, + int32_t process_id, + int32_t frame_id) + : network::RestrictedCookieManager(role, cookie_store, cookie_settings, origin, + nullptr, is_service_worker, process_id, frame_id) + , m_profileIoData(profileIoData) + , weak_factory_(this) +{ + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); +} + +RestrictedCookieManagerQt::~RestrictedCookieManagerQt() +{ + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); +} + +void RestrictedCookieManagerQt::GetAllForUrl(const GURL &url, + const GURL &site_for_cookies, + network::mojom::CookieManagerGetOptionsPtr options, + GetAllForUrlCallback callback) +{ + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + + if (allowCookies(url, site_for_cookies)) { + network::RestrictedCookieManager::GetAllForUrl(url, site_for_cookies, std::move(options), std::move(callback)); + } else { + std::move(callback).Run(std::vector<net::CanonicalCookie>()); + } +} + +void RestrictedCookieManagerQt::SetCanonicalCookie(const net::CanonicalCookie &cookie, + const GURL &url, + const GURL &site_for_cookies, + SetCanonicalCookieCallback callback) +{ + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + + if (allowCookies(url, site_for_cookies)) { + network::RestrictedCookieManager::SetCanonicalCookie(cookie, url, site_for_cookies, std::move(callback)); + } else { + std::move(callback).Run(false); + } +} + +void RestrictedCookieManagerQt::AddChangeListener(const GURL &url, + const GURL &site_for_cookies, + network::mojom::CookieChangeListenerPtr listener, + AddChangeListenerCallback callback) +{ + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + + network::mojom::CookieChangeListenerPtr proxy_listener_ptr; + auto proxy_listener = + std::make_unique<RestrictedCookieManagerListenerQt>( + url, site_for_cookies, weak_factory_.GetWeakPtr(), + std::move(listener)); + + mojo::MakeStrongBinding(std::move(proxy_listener), + mojo::MakeRequest(&proxy_listener_ptr)); + + network::RestrictedCookieManager::AddChangeListener( + url, site_for_cookies, std::move(proxy_listener_ptr), + std::move(callback)); +} + +void RestrictedCookieManagerQt::GetCookiesString(const GURL &url, + const GURL &site_for_cookies, + GetCookiesStringCallback callback) +{ + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + + if (allowCookies(url, site_for_cookies)) { + network::RestrictedCookieManager::GetCookiesString(url, site_for_cookies, std::move(callback)); + } else { + std::move(callback).Run(""); + } +} + +void RestrictedCookieManagerQt::CookiesEnabledFor(const GURL &url, + const GURL &site_for_cookies, + CookiesEnabledForCallback callback) +{ + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + std::move(callback).Run(allowCookies(url, site_for_cookies)); +} + +bool RestrictedCookieManagerQt::allowCookies(const GURL &url, const GURL &site_for_cookies) const +{ + if (!m_profileIoData) + return false; + return m_profileIoData->canGetCookies(toQt(site_for_cookies), toQt(url)); +} + +} // namespace QtWebEngineCore diff --git a/src/core/net/restricted_cookie_manager_qt.h b/src/core/net/restricted_cookie_manager_qt.h new file mode 100644 index 000000000..a277c7c96 --- /dev/null +++ b/src/core/net/restricted_cookie_manager_qt.h @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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.LGPL3 included in the +** 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-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef RESTRICTED_COOKIE_MANAGER_QT_H +#define RESTRICTED_COOKIE_MANAGER_QT_H + +#include "base/macros.h" +#include "base/memory/weak_ptr.h" +#include "services/network/restricted_cookie_manager.h" +#include "url/gurl.h" + +namespace QtWebEngineCore { + +class ProfileIODataQt; + +class RestrictedCookieManagerQt : public network::RestrictedCookieManager +{ +public: + RestrictedCookieManagerQt(base::WeakPtr<ProfileIODataQt> profileIoData, + network::mojom::RestrictedCookieManagerRole role, + net::CookieStore *cookie_store, + network::CookieSettings *cookie_settings, + const url::Origin &origin, + bool is_service_worker, + int32_t process_id, + int32_t frame_id); + ~RestrictedCookieManagerQt() override; + + // network::mojom::RestrictedCookieManager interface: + void GetAllForUrl(const GURL &url, + const GURL &site_for_cookies, + network::mojom::CookieManagerGetOptionsPtr options, + GetAllForUrlCallback callback) override; + void SetCanonicalCookie(const net::CanonicalCookie& cookie, + const GURL &url, + const GURL &site_for_cookies, + SetCanonicalCookieCallback callback) override; + void AddChangeListener(const GURL &url, + const GURL &site_for_cookies, + network::mojom::CookieChangeListenerPtr listener, + AddChangeListenerCallback callback) override; + + void GetCookiesString(const GURL &url, + const GURL &site_for_cookies, + GetCookiesStringCallback callback) override; + + void CookiesEnabledFor(const GURL &url, + const GURL &site_for_cookies, + CookiesEnabledForCallback callback) override; + + // Internal: + bool allowCookies(const GURL& url, const GURL &site_for_cookies) const; + +private: + base::WeakPtr<ProfileIODataQt> m_profileIoData; + + base::WeakPtrFactory<RestrictedCookieManagerQt> weak_factory_; + + DISALLOW_COPY_AND_ASSIGN(RestrictedCookieManagerQt); +}; + +} // namespace QtWebEngineCore + +#endif // RESTRICTED_COOKIE_MANAGER_QT_H diff --git a/src/core/net/ssl_host_state_delegate_qt.cpp b/src/core/net/ssl_host_state_delegate_qt.cpp index ecc3c681e..b6cdf68dc 100644 --- a/src/core/net/ssl_host_state_delegate_qt.cpp +++ b/src/core/net/ssl_host_state_delegate_qt.cpp @@ -120,7 +120,7 @@ void SSLHostStateDelegateQt::HostRanInsecureContent(const std::string &host, int } // Returns whether the specified host ran insecure content. -bool SSLHostStateDelegateQt::DidHostRunInsecureContent(const std::string &host, int pid, InsecureContentType content_type) const +bool SSLHostStateDelegateQt::DidHostRunInsecureContent(const std::string &host, int pid, InsecureContentType content_type) { return false; } @@ -136,7 +136,7 @@ void SSLHostStateDelegateQt::RevokeUserAllowExceptions(const std::string &host) // |host|. This does not mean that *all* certificate errors are allowed, just // that there exists an exception. To see if a particular certificate and // error combination exception is allowed, use QueryPolicy(). -bool SSLHostStateDelegateQt::HasAllowException(const std::string &host) const +bool SSLHostStateDelegateQt::HasAllowException(const std::string &host) { auto policy_iterator = m_certPolicyforHost.find(host); return policy_iterator != m_certPolicyforHost.end() && diff --git a/src/core/net/ssl_host_state_delegate_qt.h b/src/core/net/ssl_host_state_delegate_qt.h index b1b49bcf3..28e239304 100644 --- a/src/core/net/ssl_host_state_delegate_qt.h +++ b/src/core/net/ssl_host_state_delegate_qt.h @@ -69,9 +69,9 @@ public: CertJudgment QueryPolicy(const std::string &host, const net::X509Certificate &cert, int error, bool *expired_previous_decision) override; void HostRanInsecureContent(const std::string& host, int child_id, InsecureContentType content_type) override; - bool DidHostRunInsecureContent(const std::string& host, int child_id, InsecureContentType content_type) const override; + bool DidHostRunInsecureContent(const std::string& host, int child_id, InsecureContentType content_type) override; void RevokeUserAllowExceptions(const std::string &host) override; - bool HasAllowException(const std::string &host) const override; + bool HasAllowException(const std::string &host) override; private: std::map<std::string, CertPolicy> m_certPolicyforHost; diff --git a/src/core/net/webui_controller_factory_qt.cpp b/src/core/net/webui_controller_factory_qt.cpp index 92bb8854f..2bfd242e7 100644 --- a/src/core/net/webui_controller_factory_qt.cpp +++ b/src/core/net/webui_controller_factory_qt.cpp @@ -175,24 +175,24 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI *web_ui, Profile *profile, co namespace QtWebEngineCore { -WebUI::TypeID WebUIControllerFactoryQt::GetWebUIType(content::BrowserContext *browser_context, const GURL &url) const +WebUI::TypeID WebUIControllerFactoryQt::GetWebUIType(content::BrowserContext *browser_context, const GURL &url) { Profile *profile = Profile::FromBrowserContext(browser_context); WebUIFactoryFunction function = GetWebUIFactoryFunction(nullptr, profile, url); return function ? reinterpret_cast<WebUI::TypeID>(function) : WebUI::kNoWebUI; } -bool WebUIControllerFactoryQt::UseWebUIForURL(content::BrowserContext *browser_context, const GURL &url) const +bool WebUIControllerFactoryQt::UseWebUIForURL(content::BrowserContext *browser_context, const GURL &url) { return GetWebUIType(browser_context, url) != WebUI::kNoWebUI; } -bool WebUIControllerFactoryQt::UseWebUIBindingsForURL(content::BrowserContext *browser_context, const GURL &url) const +bool WebUIControllerFactoryQt::UseWebUIBindingsForURL(content::BrowserContext *browser_context, const GURL &url) { return UseWebUIForURL(browser_context, url); } -std::unique_ptr<WebUIController> WebUIControllerFactoryQt::CreateWebUIControllerForURL(WebUI *web_ui, const GURL &url) const +std::unique_ptr<WebUIController> WebUIControllerFactoryQt::CreateWebUIControllerForURL(WebUI *web_ui, const GURL &url) { Profile *profile = Profile::FromWebUI(web_ui); WebUIFactoryFunction function = GetWebUIFactoryFunction(web_ui, profile, url); diff --git a/src/core/net/webui_controller_factory_qt.h b/src/core/net/webui_controller_factory_qt.h index 4038e6538..20ea62193 100644 --- a/src/core/net/webui_controller_factory_qt.h +++ b/src/core/net/webui_controller_factory_qt.h @@ -57,10 +57,10 @@ namespace QtWebEngineCore { class WebUIControllerFactoryQt : public content::WebUIControllerFactory { public: - content::WebUI::TypeID GetWebUIType(content::BrowserContext *browserContext, const GURL &url) const override; - bool UseWebUIForURL(content::BrowserContext *browserContext, const GURL &url) const override; - bool UseWebUIBindingsForURL(content::BrowserContext *browserContext, const GURL &url) const override; - std::unique_ptr<content::WebUIController> CreateWebUIControllerForURL(content::WebUI *webUi, const GURL &url) const override; + content::WebUI::TypeID GetWebUIType(content::BrowserContext *browserContext, const GURL &url) override; + bool UseWebUIForURL(content::BrowserContext *browserContext, const GURL &url) override; + bool UseWebUIBindingsForURL(content::BrowserContext *browserContext, const GURL &url) override; + std::unique_ptr<content::WebUIController> CreateWebUIControllerForURL(content::WebUI *webUi, const GURL &url) override; static WebUIControllerFactoryQt *GetInstance(); diff --git a/src/core/ozone/gl_surface_egl_qt.cpp b/src/core/ozone/gl_surface_egl_qt.cpp index 97c6cdee6..a6988bbf3 100644 --- a/src/core/ozone/gl_surface_egl_qt.cpp +++ b/src/core/ozone/gl_surface_egl_qt.cpp @@ -169,6 +169,11 @@ bool GLSurfaceEGL::IsPixelFormatFloatSupported() return false; } +bool GLSurfaceEGL::IsANGLEFeatureControlSupported() +{ + return false; +} + void GLSurfaceEGL::ShutdownOneOff() { } diff --git a/src/core/ozone/gl_surface_qt.cpp b/src/core/ozone/gl_surface_qt.cpp index 82f8cd0e5..58a225b4e 100644 --- a/src/core/ozone/gl_surface_qt.cpp +++ b/src/core/ozone/gl_surface_qt.cpp @@ -63,7 +63,7 @@ #if defined(OS_WIN) #include "ozone/gl_surface_wgl_qt.h" -#include "gpu/ipc/service/direct_composition_surface_win.h" +#include "ui/gl/direct_composition_surface_win.h" #include "ui/gl/vsync_provider_win.h" #endif @@ -219,11 +219,24 @@ scoped_refptr<gl::GLSurface> ImageTransportSurface::CreateNativeSurface(base::We QT_NOT_USED return scoped_refptr<gl::GLSurface>(); } +} // namespace gpu + +namespace gl { + +bool DirectCompositionSurfaceWin::IsDirectCompositionSupported() +{ + return false; +} + +bool DirectCompositionSurfaceWin::IsDecodeSwapChainSupported() +{ + return false; +} bool DirectCompositionSurfaceWin::IsHDRSupported() { return false; } -} // namespace gpu +} // namespace gl #endif #endif // !defined(OS_MACOSX) diff --git a/src/core/ozone/ozone_platform_qt.cpp b/src/core/ozone/ozone_platform_qt.cpp index eb7610c0f..2ab274b8f 100644 --- a/src/core/ozone/ozone_platform_qt.cpp +++ b/src/core/ozone/ozone_platform_qt.cpp @@ -40,14 +40,15 @@ #include "ozone_platform_qt.h" #if defined(USE_OZONE) +#include "ui/base/ime/input_method.h" #include "ui/display/types/native_display_delegate.h" -#include "ui/events/system_input_injector.h" #include "ui/ozone/common/stub_client_native_pixmap_factory.h" #include "ui/ozone/common/stub_overlay_manager.h" #include "ui/ozone/public/cursor_factory_ozone.h" #include "ui/ozone/public/gpu_platform_support_host.h" #include "ui/ozone/public/input_controller.h" #include "ui/ozone/public/ozone_platform.h" +#include "ui/ozone/public/system_input_injector.h" #include "ui/platform_window/platform_window_delegate.h" #include "ui/platform_window/platform_window_init_properties.h" #include "ui/platform_window/platform_window.h" @@ -72,6 +73,7 @@ public: ui::InputController* GetInputController() override; std::unique_ptr<ui::SystemInputInjector> CreateSystemInputInjector() override; ui::OverlayManagerOzone* GetOverlayManager() override; + std::unique_ptr<InputMethod> CreateInputMethod(internal::InputMethodDelegate *delegate) override; private: void InitializeUI(const ui::OzonePlatform::InitParams &) override; @@ -146,6 +148,12 @@ void OzonePlatformQt::InitializeGPU(const ui::OzonePlatform::InitParams &) surface_factory_ozone_.reset(new QtWebEngineCore::SurfaceFactoryQt()); } +std::unique_ptr<InputMethod> OzonePlatformQt::CreateInputMethod(internal::InputMethodDelegate *) +{ + NOTREACHED(); + return nullptr; +} + } // namespace OzonePlatform* CreateOzonePlatformQt() { return new OzonePlatformQt; } diff --git a/src/core/ozone/platform_window_qt.h b/src/core/ozone/platform_window_qt.h index bb2fc714b..ca4a00313 100644 --- a/src/core/ozone/platform_window_qt.h +++ b/src/core/ozone/platform_window_qt.h @@ -70,13 +70,14 @@ public: void Maximize() override { } void Minimize() override { } void Restore() override { } - PlatformWindowState GetPlatformWindowState() const override { return PLATFORM_WINDOW_STATE_UNKNOWN; } + PlatformWindowState GetPlatformWindowState() const override { return PlatformWindowState::kUnknown; } void SetCursor(PlatformCursor) override { } void MoveCursorTo(const gfx::Point&) override { } void ConfineCursorToBounds(const gfx::Rect&) override { } - PlatformImeController* GetPlatformImeController() override { return nullptr; } void SetRestoredBoundsInPixels(const gfx::Rect& bounds) override { } gfx::Rect GetRestoredBoundsInPixels() const override { return gfx::Rect(); } + void Activate() override { } + void Deactivate() override { } // PlatformEventDispatcher: bool CanDispatchEvent(const PlatformEvent& event) override; diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index e2b959ebc..9e8687a47 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -78,6 +78,9 @@ ProfileAdapter::PermissionType toQt(content::PermissionType type) case content::PermissionType::PAYMENT_HANDLER: case content::PermissionType::BACKGROUND_FETCH: case content::PermissionType::IDLE_DETECTION: + case content::PermissionType::PERIODIC_BACKGROUND_SYNC: + case content::PermissionType::WAKE_LOCK_SCREEN: + case content::PermissionType::WAKE_LOCK_SYSTEM: case content::PermissionType::NUM: NOTIMPLEMENTED() << "Unsupported permission type: " << static_cast<int>(type); break; diff --git a/src/core/pref_service_adapter.cpp b/src/core/pref_service_adapter.cpp index 8a33a4b60..ca4be87df 100644 --- a/src/core/pref_service_adapter.cpp +++ b/src/core/pref_service_adapter.cpp @@ -106,6 +106,7 @@ void PrefServiceAdapter::setup(const ProfileAdapter &profileAdapter) registry->RegisterBooleanPref(spellcheck::prefs::kSpellCheckUseSpellingService, false); #endif // QT_CONFIG(webengine_spellchecker) registry->RegisterBooleanPref(prefs::kShowInternalAccessibilityTree, false); + registry->RegisterBooleanPref(prefs::kAccessibilityImageLabelsEnabled, false); registry->RegisterIntegerPref(prefs::kNotificationNextPersistentId, 10000); #if BUILDFLAG(ENABLE_EXTENSIONS) diff --git a/src/core/printing/print_view_manager_base_qt.cpp b/src/core/printing/print_view_manager_base_qt.cpp index 52f4481bb..4516f10b2 100644 --- a/src/core/printing/print_view_manager_base_qt.cpp +++ b/src/core/printing/print_view_manager_base_qt.cpp @@ -343,9 +343,10 @@ void PrintViewManagerBaseQt::ShouldQuitFromInnerMessageLoop() } } -bool PrintViewManagerBaseQt::CreateNewPrintJob(printing::PrinterQuery *job) +bool PrintViewManagerBaseQt::CreateNewPrintJob(std::unique_ptr<printing::PrinterQuery> query) { DCHECK(!m_isInsideInnerMessageLoop); + DCHECK(query); // Disconnect the current |m_printJob|. DisconnectFromCurrentPrintJob(); @@ -359,12 +360,9 @@ bool PrintViewManagerBaseQt::CreateNewPrintJob(printing::PrinterQuery *job) // Ask the renderer to generate the print preview, create the print preview // view and switch to it, initialize the printer and show the print dialog. DCHECK(!m_printJob.get()); - DCHECK(job); - if (!job) - return false; m_printJob = base::MakeRefCounted<printing::PrintJob>(); - m_printJob->Initialize(job, RenderSourceName(), number_pages_); + m_printJob->Initialize(std::move(query), RenderSourceName(), number_pages_); m_registrar.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, content::Source<printing::PrintJob>(m_printJob.get())); m_didPrintingSucceed = false; @@ -482,13 +480,13 @@ bool PrintViewManagerBaseQt::OpportunisticallyCreatePrintJob(int cookie) // The job was initiated by a script. Time to get the corresponding worker // thread. - scoped_refptr<printing::PrinterQuery> queued_query = m_printerQueriesQueue->PopPrinterQuery(cookie); - if (!queued_query.get()) { + std::unique_ptr<printing::PrinterQuery> queued_query = m_printerQueriesQueue->PopPrinterQuery(cookie); + if (!queued_query) { NOTREACHED(); return false; } - if (!CreateNewPrintJob(queued_query.get())) { + if (!CreateNewPrintJob(std::move(queued_query))) { // Don't kill anything. return false; } @@ -512,23 +510,23 @@ void PrintViewManagerBaseQt::ReleasePrinterQuery() if (!printJobManager) return; - scoped_refptr<printing::PrinterQuery> printerQuery; + std::unique_ptr<printing::PrinterQuery> printerQuery; printerQuery = m_printerQueriesQueue->PopPrinterQuery(cookie); - if (!printerQuery.get()) + if (!printerQuery) return; base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO}, - base::BindOnce(&printing::PrinterQuery::StopWorker, printerQuery.get())); + base::BindOnce(&printing::PrinterQuery::StopWorker, std::move(printerQuery))); } // Originally from print_preview_message_handler.cc: void PrintViewManagerBaseQt::StopWorker(int documentCookie) { if (documentCookie <= 0) return; - scoped_refptr<printing::PrinterQuery> printer_query = + std::unique_ptr<printing::PrinterQuery> printer_query = m_printerQueriesQueue->PopPrinterQuery(documentCookie); if (printer_query.get()) { base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO}, - base::BindOnce(&printing::PrinterQuery::StopWorker, printer_query)); + base::BindOnce(&printing::PrinterQuery::StopWorker, std::move(printer_query))); } } diff --git a/src/core/printing/print_view_manager_base_qt.h b/src/core/printing/print_view_manager_base_qt.h index 3ade02f0d..31e0a1778 100644 --- a/src/core/printing/print_view_manager_base_qt.h +++ b/src/core/printing/print_view_manager_base_qt.h @@ -147,7 +147,7 @@ protected: void TerminatePrintJob(bool cancel); void DisconnectFromCurrentPrintJob(); - bool CreateNewPrintJob(printing::PrinterQuery *job); + bool CreateNewPrintJob(std::unique_ptr<printing::PrinterQuery> query); void ReleasePrintJob(); void ReleasePrinterQuery(); @@ -164,7 +164,7 @@ private: bool m_didPrintingSucceed; scoped_refptr<printing::PrintQueriesQueue> m_printerQueriesQueue; // The current RFH that is printing with a system printing dialog. - content::RenderFrameHost* m_printingRFH; + content::RenderFrameHost *m_printingRFH; DISALLOW_COPY_AND_ASSIGN(PrintViewManagerBaseQt); }; diff --git a/src/core/printing/printing_message_filter_qt.cpp b/src/core/printing/printing_message_filter_qt.cpp index d1e86343f..5b9228d20 100644 --- a/src/core/printing/printing_message_filter_qt.cpp +++ b/src/core/printing/printing_message_filter_qt.cpp @@ -92,10 +92,10 @@ bool PrintingMessageFilterQt::OnMessageReceived(const IPC::Message& message) { void PrintingMessageFilterQt::OnGetDefaultPrintSettings(IPC::Message* reply_msg) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - scoped_refptr<printing::PrinterQuery> printer_query; + std::unique_ptr<printing::PrinterQuery> printer_query; printer_query = queue_->PopPrinterQuery(0); - if (!printer_query.get()) { + if (!printer_query) { printer_query = queue_->CreatePrinterQuery(render_process_id_, reply_msg->routing_id()); } @@ -109,14 +109,14 @@ void PrintingMessageFilterQt::OnGetDefaultPrintSettings(IPC::Message* reply_msg) printing::DEFAULT_MARGINS, false, false, - base::Bind(&PrintingMessageFilterQt::OnGetDefaultPrintSettingsReply, - this, - printer_query, - reply_msg)); + base::BindOnce(&PrintingMessageFilterQt::OnGetDefaultPrintSettingsReply, + this, + std::move(printer_query), + reply_msg)); } void PrintingMessageFilterQt::OnGetDefaultPrintSettingsReply( - scoped_refptr<printing::PrinterQuery> printer_query, + std::unique_ptr<printing::PrinterQuery> printer_query, IPC::Message* reply_msg) { PrintMsg_Print_Params params; if (!printer_query.get() || @@ -132,7 +132,7 @@ void PrintingMessageFilterQt::OnGetDefaultPrintSettingsReply( if (printer_query.get()) { // If user hasn't cancelled. if (printer_query->cookie() && printer_query->settings().dpi()) { - queue_->QueuePrinterQuery(printer_query.get()); + queue_->QueuePrinterQuery(std::move(printer_query)); } else { printer_query->StopWorker(); } @@ -142,7 +142,7 @@ void PrintingMessageFilterQt::OnGetDefaultPrintSettingsReply( void PrintingMessageFilterQt::OnScriptedPrint( const PrintHostMsg_ScriptedPrint_Params& params, IPC::Message* reply_msg) { - scoped_refptr<printing::PrinterQuery> printer_query = + std::unique_ptr<printing::PrinterQuery> printer_query = queue_->PopPrinterQuery(params.cookie); if (!printer_query.get()) { printer_query = @@ -155,14 +155,14 @@ void PrintingMessageFilterQt::OnScriptedPrint( params.margin_type, params.is_scripted, params.is_modifiable, - base::Bind(&PrintingMessageFilterQt::OnScriptedPrintReply, - this, - printer_query, - reply_msg)); + base::BindOnce(&PrintingMessageFilterQt::OnScriptedPrintReply, + this, + std::move(printer_query), + reply_msg)); } void PrintingMessageFilterQt::OnScriptedPrintReply( - scoped_refptr<printing::PrinterQuery> printer_query, + std::unique_ptr<printing::PrinterQuery> printer_query, IPC::Message* reply_msg) { PrintMsg_PrintPages_Params params; @@ -177,7 +177,7 @@ void PrintingMessageFilterQt::OnScriptedPrintReply( PrintHostMsg_ScriptedPrint::WriteReplyParams(reply_msg, params); Send(reply_msg); if (!params.params.dpi.IsEmpty() && params.params.document_cookie) { - queue_->QueuePrinterQuery(printer_query.get()); + queue_->QueuePrinterQuery(std::move(printer_query)); } else { printer_query->StopWorker(); } @@ -186,7 +186,7 @@ void PrintingMessageFilterQt::OnScriptedPrintReply( void PrintingMessageFilterQt::OnUpdatePrintSettings(int document_cookie, base::Value job_settings, IPC::Message* reply_msg) { - scoped_refptr<printing::PrinterQuery> printer_query; + std::unique_ptr<printing::PrinterQuery> printer_query; printer_query = queue_->PopPrinterQuery(document_cookie); if (!printer_query.get()) { printer_query = queue_->CreatePrinterQuery( @@ -194,12 +194,11 @@ void PrintingMessageFilterQt::OnUpdatePrintSettings(int document_cookie, } printer_query->SetSettings( std::move(job_settings), - base::Bind(&PrintingMessageFilterQt::OnUpdatePrintSettingsReply, this, - printer_query, reply_msg)); + base::BindOnce(&PrintingMessageFilterQt::OnUpdatePrintSettingsReply, this, + std::move(printer_query), reply_msg)); } -void PrintingMessageFilterQt::OnUpdatePrintSettingsReply( - scoped_refptr<printing::PrinterQuery> printer_query, +void PrintingMessageFilterQt::OnUpdatePrintSettingsReply(std::unique_ptr<printing::PrinterQuery> printer_query, IPC::Message* reply_msg) { PrintMsg_PrintPages_Params params; if (!printer_query.get() || @@ -218,9 +217,9 @@ void PrintingMessageFilterQt::OnUpdatePrintSettingsReply( (printer_query->last_status() == printing::PrintingContext::CANCEL)); Send(reply_msg); // If user hasn't cancelled. - if (printer_query.get()) { + if (printer_query) { if (printer_query->cookie() && printer_query->settings().dpi()) { - queue_->QueuePrinterQuery(printer_query.get()); + queue_->QueuePrinterQuery(std::move(printer_query)); } else { printer_query->StopWorker(); } diff --git a/src/core/printing/printing_message_filter_qt.h b/src/core/printing/printing_message_filter_qt.h index f1a3514c5..88559d3df 100644 --- a/src/core/printing/printing_message_filter_qt.h +++ b/src/core/printing/printing_message_filter_qt.h @@ -95,7 +95,7 @@ class PrintingMessageFilterQt : public content::BrowserMessageFilter { // Get the default print setting. void OnGetDefaultPrintSettings(IPC::Message* reply_msg); - void OnGetDefaultPrintSettingsReply(scoped_refptr<printing::PrinterQuery> printer_query, + void OnGetDefaultPrintSettingsReply(std::unique_ptr<printing::PrinterQuery> printer_query, IPC::Message* reply_msg); // The renderer host have to show to the user the print dialog and returns @@ -103,7 +103,7 @@ class PrintingMessageFilterQt : public content::BrowserMessageFilter { // thread and the UI thread. The reply occurs on the IO thread. void OnScriptedPrint(const PrintHostMsg_ScriptedPrint_Params& params, IPC::Message* reply_msg); - void OnScriptedPrintReply(scoped_refptr<printing::PrinterQuery> printer_query, + void OnScriptedPrintReply(std::unique_ptr<printing::PrinterQuery> printer_query, IPC::Message* reply_msg); // Modify the current print settings based on |job_settings|. The task is @@ -112,7 +112,7 @@ class PrintingMessageFilterQt : public content::BrowserMessageFilter { void OnUpdatePrintSettings(int document_cookie, base::Value job_settings, IPC::Message* reply_msg); - void OnUpdatePrintSettingsReply(scoped_refptr<printing::PrinterQuery> printer_query, + void OnUpdatePrintSettingsReply(std::unique_ptr<printing::PrinterQuery> printer_query, IPC::Message* reply_msg); // Check to see if print preview has been cancelled. diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp index 90016c5a3..2e0e378ac 100644 --- a/src/core/profile_io_data_qt.cpp +++ b/src/core/profile_io_data_qt.cpp @@ -56,6 +56,7 @@ #include "net/cert/ct_policy_enforcer.h" #include "net/cert/multi_log_ct_verifier.h" #include "net/cert_net/cert_net_fetcher_impl.h" +#include "net/ftp/ftp_auth_cache.h" #include "net/dns/host_resolver_manager.h" #include "net/http/http_auth_handler_factory.h" #include "net/http/http_auth_scheme.h" @@ -78,6 +79,7 @@ #include "net/url_request/url_request_intercepting_job_factory.h" #include "services/file/user_id_map.h" #include "services/network/proxy_service_mojo.h" +#include "services/network/restricted_cookie_manager.h" #include "net/client_cert_override.h" #include "net/client_cert_store_data.h" @@ -85,6 +87,7 @@ #include "net/custom_protocol_handler.h" #include "net/network_delegate_qt.h" #include "net/proxy_config_service_qt.h" +#include "net/restricted_cookie_manager_qt.h" #include "net/url_request_context_getter_qt.h" #include "profile_qt.h" #include "resource_context_qt.h" @@ -189,8 +192,12 @@ ProfileIODataQt::~ProfileIODataQt() } } - if (m_urlRequestContext && m_urlRequestContext->proxy_resolution_service()) - m_urlRequestContext->proxy_resolution_service()->OnShutdown(); + if (m_urlRequestContext) { + if (m_urlRequestContext->proxy_resolution_service()) + m_urlRequestContext->proxy_resolution_service()->OnShutdown(); + m_restrictedCookieManagerBindings.CloseAllBindings(); + cancelAllUrlRequests(); + } m_resourceContext.reset(); if (m_cookieDelegate) @@ -238,6 +245,12 @@ extensions::ExtensionSystemQt* ProfileIODataQt::GetExtensionSystem() } #endif // BUILDFLAG(ENABLE_EXTENSIONS) +base::WeakPtr<ProfileIODataQt> ProfileIODataQt::getWeakPtrOnUIThread() +{ + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + return m_weakPtr; +} + void ProfileIODataQt::initializeOnIOThread() { m_networkDelegate.reset(new NetworkDelegateQt(this)); @@ -304,6 +317,7 @@ void ProfileIODataQt::generateStorage() // We must stop all requests before deleting their backends. if (m_storage) { m_urlRequestContext->proxy_resolution_service()->OnShutdown(); + m_restrictedCookieManagerBindings.CloseAllBindings(); m_cookieDelegate->setCookieMonster(nullptr); m_storage->set_cookie_store(nullptr); cancelAllUrlRequests(); @@ -380,6 +394,8 @@ void ProfileIODataQt::generateStorage() m_urlRequestContext->host_resolver(), nullptr /* NetLog */, m_urlRequestContext->network_delegate())); + + m_storage->set_ftp_auth_cache(std::make_unique<net::FtpAuthCache>()); } @@ -390,7 +406,7 @@ void ProfileIODataQt::generateCookieStore() const std::lock_guard<QRecursiveMutex> lock(m_mutex); -// // FIXME: Add code to remove the old channel-id database. + // FIXME: Add code to remove the old channel-id database. std::unique_ptr<net::CookieStore> cookieStore; switch (m_persistentCookiesPolicy) { @@ -486,7 +502,6 @@ void ProfileIODataQt::generateHttpCache() if (!m_httpNetworkSession || !doNetworkSessionParamsMatch(network_session_params, m_httpNetworkSession->params()) || !doNetworkSessionContextMatch(network_session_context, m_httpNetworkSession->context())) { - cancelAllUrlRequests(); m_httpNetworkSession.reset(new net::HttpNetworkSession(network_session_params, network_session_context)); } @@ -520,7 +535,7 @@ void ProfileIODataQt::generateJobFactory() jobFactory->SetProtocolHandler(url::kFileScheme, std::make_unique<net::FileProtocolHandler>(taskRunner)); jobFactory->SetProtocolHandler(url::kFtpScheme, - net::FtpProtocolHandler::Create(m_urlRequestContext->host_resolver())); + net::FtpProtocolHandler::Create(m_urlRequestContext->host_resolver(), m_urlRequestContext->ftp_auth_cache())); m_installedCustomSchemes = m_customUrlSchemes; for (const QByteArray &scheme : qAsConst(m_installedCustomSchemes)) { @@ -640,7 +655,7 @@ void ProfileIODataQt::createProxyConfig() base::CreateSingleThreadTaskRunnerWithTraits({content::BrowserThread::IO})), initialConfig, initialConfigState); //pass interface to io thread - m_proxyResolverFactoryInterface = ChromeMojoProxyResolverFactory::CreateWithStrongBinding().PassInterface(); + m_proxyResolverFactoryInterface = ChromeMojoProxyResolverFactory::CreateWithSelfOwnedReceiver(); } void ProfileIODataQt::updateStorageSettings() @@ -788,9 +803,34 @@ std::unique_ptr<net::ClientCertStore> ProfileIODataQt::CreateClientCertStore() #endif } +void ProfileIODataQt::CreateRestrictedCookieManager(network::mojom::RestrictedCookieManagerRequest request, + network::mojom::RestrictedCookieManagerRole role, + const url::Origin &origin, + bool is_service_worker, + int32_t process_id, + int32_t routing_id) +{ + Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); + m_restrictedCookieManagerBindings.AddBinding( + std::make_unique<RestrictedCookieManagerQt>( + m_weakPtr, + role, urlRequestContext()->cookie_store(), + &m_cookieSettings, origin, + is_service_worker, process_id, routing_id), + std::move(request)); +} + +// static +ProfileIODataQt *ProfileIODataQt::FromBrowserContext(content::BrowserContext *browser_context) +{ + Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + return static_cast<ProfileQt *>(browser_context)->m_profileIOData.get(); +} + // static ProfileIODataQt *ProfileIODataQt::FromResourceContext(content::ResourceContext *resource_context) { + Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); return static_cast<ResourceContextQt *>(resource_context)->m_io_data; } diff --git a/src/core/profile_io_data_qt.h b/src/core/profile_io_data_qt.h index 83b784ce3..8f11a9ce2 100644 --- a/src/core/profile_io_data_qt.h +++ b/src/core/profile_io_data_qt.h @@ -46,6 +46,9 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/custom_handlers/protocol_handler_registry.h" #include "extensions/buildflags/buildflags.h" +#include "mojo/public/cpp/bindings/strong_binding_set.h" +#include "services/network/cookie_settings.h" +#include "services/network/public/mojom/restricted_cookie_manager.mojom.h" #include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h" #include <QtCore/QString> @@ -145,11 +148,22 @@ public: void updateUsedForGlobalCertificateVerification(); // runs on ui thread bool hasPageInterceptors(); + void CreateRestrictedCookieManager(network::mojom::RestrictedCookieManagerRequest request, + network::mojom::RestrictedCookieManagerRole role, + const url::Origin &origin, + bool is_service_worker, + int32_t process_id, + int32_t routing_id); + #if QT_CONFIG(ssl) ClientCertificateStoreData *clientCertificateStoreData(); #endif std::unique_ptr<net::ClientCertStore> CreateClientCertStore(); + static ProfileIODataQt *FromBrowserContext(content::BrowserContext *browser_context); static ProfileIODataQt *FromResourceContext(content::ResourceContext *resource_context); + + base::WeakPtr<ProfileIODataQt> getWeakPtrOnUIThread(); + private: void removeBrowsingDataRemoverObserver(); @@ -175,6 +189,8 @@ private: QAtomicPointer<net::ProxyConfigService> m_proxyConfigService; QPointer<ProfileAdapter> m_profileAdapter; // never dereferenced in IO thread and it is passed by qpointer ProfileAdapter::PersistentCookiesPolicy m_persistentCookiesPolicy; + mojo::StrongBindingSet<network::mojom::RestrictedCookieManager> m_restrictedCookieManagerBindings; + #if QT_CONFIG(ssl) ClientCertificateStoreData *m_clientCertificateStoreData; #endif @@ -186,6 +202,7 @@ private: QList<QByteArray> m_customUrlSchemes; QList<QByteArray> m_installedCustomSchemes; QWebEngineUrlRequestInterceptor* m_requestInterceptor = nullptr; + network::CookieSettings m_cookieSettings; #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) QMutex m_mutex{QMutex::Recursive}; using QRecursiveMutex = QMutex; diff --git a/src/core/profile_qt.cpp b/src/core/profile_qt.cpp index 19d54df62..94b22fbea 100644 --- a/src/core/profile_qt.cpp +++ b/src/core/profile_qt.cpp @@ -130,7 +130,7 @@ const PrefService* ProfileQt::GetPrefs() const return m_prefServiceAdapter.prefService(); } -base::FilePath ProfileQt::GetPath() const +base::FilePath ProfileQt::GetPath() { return toFilePath(m_profileAdapter->dataPath()); } @@ -140,7 +140,7 @@ base::FilePath ProfileQt::GetCachePath() const return toFilePath(m_profileAdapter->cachePath()); } -bool ProfileQt::IsOffTheRecord() const +bool ProfileQt::IsOffTheRecord() { return m_profileAdapter->isOffTheRecord(); } @@ -155,12 +155,6 @@ net::URLRequestContextGetter *ProfileQt::CreateMediaRequestContext() return m_urlRequestContextGetter.get(); } -net::URLRequestContextGetter *ProfileQt::CreateMediaRequestContextForStoragePartition(const base::FilePath&, bool) -{ - Q_UNIMPLEMENTED(); - return nullptr; -} - content::ResourceContext *ProfileQt::GetResourceContext() { return m_profileIOData->resourceContext(); @@ -234,9 +228,9 @@ net::URLRequestContextGetter *ProfileQt::CreateRequestContext( DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK(!m_urlRequestContextGetter.get()); #if BUILDFLAG(ENABLE_EXTENSIONS) - extensions::InfoMap* extension_info_map = GetExtensionSystem()->info_map(); + extensions::InfoMap *extension_info_map = GetExtensionSystem()->info_map(); (*protocol_handlers)[extensions::kExtensionScheme] = - extensions::CreateExtensionProtocolHandler(IsOffTheRecord(),extension_info_map); + extensions::CreateExtensionProtocolHandler(IsOffTheRecord(), extension_info_map); #endif m_profileIOData->setRequestContextData(protocol_handlers, std::move(request_interceptors)); @@ -245,15 +239,6 @@ net::URLRequestContextGetter *ProfileQt::CreateRequestContext( return m_urlRequestContextGetter.get(); } -net::URLRequestContextGetter *ProfileQt::CreateRequestContextForStoragePartition( - const base::FilePath& partition_path, bool in_memory, - content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors) -{ - Q_UNIMPLEMENTED(); - return nullptr; -} - content::ClientHintsControllerDelegate *ProfileQt::GetClientHintsControllerDelegate() { return nullptr; @@ -270,7 +255,7 @@ void ProfileQt::SetCorsOriginAccessListForOrigin(const url::Origin &source_origi std::move(closure)); } -const content::SharedCorsOriginAccessList *ProfileQt::GetSharedCorsOriginAccessList() const +content::SharedCorsOriginAccessList *ProfileQt::GetSharedCorsOriginAccessList() { return m_sharedCorsOriginAccessList.get(); } diff --git a/src/core/profile_qt.h b/src/core/profile_qt.h index b6ff0a0db..f5dc59717 100644 --- a/src/core/profile_qt.h +++ b/src/core/profile_qt.h @@ -76,13 +76,10 @@ public: base::FilePath GetCachePath() const; // BrowserContext implementation: - base::FilePath GetPath() const override; - bool IsOffTheRecord() const override; + base::FilePath GetPath() override; + bool IsOffTheRecord() override; net::URLRequestContextGetter *CreateMediaRequestContext() override; - net::URLRequestContextGetter *CreateMediaRequestContextForStoragePartition( - const base::FilePath &partition_path, - bool in_memory) override; content::ResourceContext *GetResourceContext() override; content::DownloadManagerDelegate *GetDownloadManagerDelegate() override; content::BrowserPluginGuestManager *GetGuestManager() override; @@ -92,10 +89,6 @@ public: net::URLRequestContextGetter *CreateRequestContext( content::ProtocolHandlerMap *protocol_handlers, content::URLRequestInterceptorScopedVector request_interceptors) override; - net::URLRequestContextGetter *CreateRequestContextForStoragePartition( - const base::FilePath &partition_path, bool in_memory, - content::ProtocolHandlerMap *protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors) override; std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate( const base::FilePath &partition_path) override; content::PermissionControllerDelegate * GetPermissionControllerDelegate() override; @@ -107,7 +100,7 @@ public: std::vector<network::mojom::CorsOriginPatternPtr> allow_patterns, std::vector<network::mojom::CorsOriginPatternPtr> block_patterns, base::OnceClosure closure) override; - const content::SharedCorsOriginAccessList* GetSharedCorsOriginAccessList() const override; + content::SharedCorsOriginAccessList *GetSharedCorsOriginAccessList() override; std::string GetMediaDeviceIDSalt() override; // Profile implementation: @@ -137,6 +130,7 @@ public: private: friend class ContentBrowserClientQt; + friend class ProfileIODataQt; friend class WebContentsAdapter; scoped_refptr<net::URLRequestContextGetter> m_urlRequestContextGetter; std::unique_ptr<BrowsingDataRemoverDelegateQt> m_removerDelegate; diff --git a/src/core/qtwebengine_sources.gni b/src/core/qtwebengine_sources.gni index 8441ca095..b4a6b3b83 100644 --- a/src/core/qtwebengine_sources.gni +++ b/src/core/qtwebengine_sources.gni @@ -46,6 +46,7 @@ source_set("qtwebengine_sources") { ] deps = [ + "//build:branding_buildflags", "//chrome/common:buildflags", "//components/nacl/common:buildflags", "//extensions/buildflags:buildflags", @@ -116,9 +117,10 @@ source_set("qtwebengine_sources") { "//chrome/common/extensions/permissions/chrome_permission_message_rules.h", ] } else { + deps += [ + "//extensions/common:common_constants", + ] sources += [ - "//extensions/common/constants.cc", - "//extensions/common/constants.h", "//extensions/common/url_pattern.cc", "//extensions/common/url_pattern.h", ] diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index cf02731c7..7633aa44c 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -120,8 +120,7 @@ static inline ui::LatencyInfo CreateLatencyInfo(const blink::WebInputEvent& even if (!event.TimeStamp().is_null()) { latency_info.AddLatencyNumberWithTimestamp( ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, - event.TimeStamp(), - 1); + event.TimeStamp()); } return latency_info; } @@ -539,110 +538,110 @@ void RenderWidgetHostViewQt::DisplayCursor(const content::WebCursor &webCursor) ui::CursorType auraType = ui::CursorType::kNull; #endif switch (cursorInfo.type) { - case blink::WebCursorInfo::kTypePointer: + case ui::CursorType::kPointer: shape = Qt::ArrowCursor; break; - case blink::WebCursorInfo::kTypeCross: + case ui::CursorType::kCross: shape = Qt::CrossCursor; break; - case blink::WebCursorInfo::kTypeHand: + case ui::CursorType::kHand: shape = Qt::PointingHandCursor; break; - case blink::WebCursorInfo::kTypeIBeam: + case ui::CursorType::kIBeam: shape = Qt::IBeamCursor; break; - case blink::WebCursorInfo::kTypeWait: + case ui::CursorType::kWait: shape = Qt::WaitCursor; break; - case blink::WebCursorInfo::kTypeHelp: + case ui::CursorType::kHelp: shape = Qt::WhatsThisCursor; break; - case blink::WebCursorInfo::kTypeEastResize: - case blink::WebCursorInfo::kTypeWestResize: - case blink::WebCursorInfo::kTypeEastWestResize: - case blink::WebCursorInfo::kTypeEastPanning: - case blink::WebCursorInfo::kTypeWestPanning: + case ui::CursorType::kEastResize: + case ui::CursorType::kWestResize: + case ui::CursorType::kEastWestResize: + case ui::CursorType::kEastPanning: + case ui::CursorType::kWestPanning: shape = Qt::SizeHorCursor; break; - case blink::WebCursorInfo::kTypeNorthResize: - case blink::WebCursorInfo::kTypeSouthResize: - case blink::WebCursorInfo::kTypeNorthSouthResize: - case blink::WebCursorInfo::kTypeNorthPanning: - case blink::WebCursorInfo::kTypeSouthPanning: + case ui::CursorType::kNorthResize: + case ui::CursorType::kSouthResize: + case ui::CursorType::kNorthSouthResize: + case ui::CursorType::kNorthPanning: + case ui::CursorType::kSouthPanning: shape = Qt::SizeVerCursor; break; - case blink::WebCursorInfo::kTypeNorthEastResize: - case blink::WebCursorInfo::kTypeSouthWestResize: - case blink::WebCursorInfo::kTypeNorthEastSouthWestResize: - case blink::WebCursorInfo::kTypeNorthEastPanning: - case blink::WebCursorInfo::kTypeSouthWestPanning: + case ui::CursorType::kNorthEastResize: + case ui::CursorType::kSouthWestResize: + case ui::CursorType::kNorthEastSouthWestResize: + case ui::CursorType::kNorthEastPanning: + case ui::CursorType::kSouthWestPanning: shape = Qt::SizeBDiagCursor; break; - case blink::WebCursorInfo::kTypeNorthWestResize: - case blink::WebCursorInfo::kTypeSouthEastResize: - case blink::WebCursorInfo::kTypeNorthWestSouthEastResize: - case blink::WebCursorInfo::kTypeNorthWestPanning: - case blink::WebCursorInfo::kTypeSouthEastPanning: + case ui::CursorType::kNorthWestResize: + case ui::CursorType::kSouthEastResize: + case ui::CursorType::kNorthWestSouthEastResize: + case ui::CursorType::kNorthWestPanning: + case ui::CursorType::kSouthEastPanning: shape = Qt::SizeFDiagCursor; break; - case blink::WebCursorInfo::kTypeColumnResize: + case ui::CursorType::kColumnResize: shape = Qt::SplitHCursor; break; - case blink::WebCursorInfo::kTypeRowResize: + case ui::CursorType::kRowResize: shape = Qt::SplitVCursor; break; - case blink::WebCursorInfo::kTypeMiddlePanning: - case blink::WebCursorInfo::kTypeMove: + case ui::CursorType::kMiddlePanning: + case ui::CursorType::kMove: shape = Qt::SizeAllCursor; break; - case blink::WebCursorInfo::kTypeProgress: + case ui::CursorType::kProgress: shape = Qt::BusyCursor; break; - case blink::WebCursorInfo::kTypeCopy: + case ui::CursorType::kCopy: shape = Qt::DragCopyCursor; break; - case blink::WebCursorInfo::kTypeAlias: + case ui::CursorType::kAlias: shape = Qt::DragLinkCursor; break; #if defined(USE_AURA) - case blink::WebCursorInfo::kTypeVerticalText: + case ui::CursorType::kVerticalText: auraType = ui::CursorType::kVerticalText; break; - case blink::WebCursorInfo::kTypeCell: + case ui::CursorType::kCell: auraType = ui::CursorType::kCell; break; - case blink::WebCursorInfo::kTypeContextMenu: + case ui::CursorType::kContextMenu: auraType = ui::CursorType::kContextMenu; break; - case blink::WebCursorInfo::kTypeZoomIn: + case ui::CursorType::kZoomIn: auraType = ui::CursorType::kZoomIn; break; - case blink::WebCursorInfo::kTypeZoomOut: + case ui::CursorType::kZoomOut: auraType = ui::CursorType::kZoomOut; break; #else - case blink::WebCursorInfo::kTypeVerticalText: - case blink::WebCursorInfo::kTypeCell: - case blink::WebCursorInfo::kTypeContextMenu: - case blink::WebCursorInfo::kTypeZoomIn: - case blink::WebCursorInfo::kTypeZoomOut: + case ui::CursorType::kVerticalText: + case ui::CursorType::kCell: + case ui::CursorType::kContextMenu: + case ui::CursorType::kZoomIn: + case ui::CursorType::kZoomOut: // FIXME: Support on OS X break; #endif - case blink::WebCursorInfo::kTypeNoDrop: - case blink::WebCursorInfo::kTypeNotAllowed: + case ui::CursorType::kNoDrop: + case ui::CursorType::kNotAllowed: shape = Qt::ForbiddenCursor; break; - case blink::WebCursorInfo::kTypeNone: + case ui::CursorType::kNone: shape = Qt::BlankCursor; break; - case blink::WebCursorInfo::kTypeGrab: + case ui::CursorType::kGrab: shape = Qt::OpenHandCursor; break; - case blink::WebCursorInfo::kTypeGrabbing: + case ui::CursorType::kGrabbing: shape = Qt::ClosedHandCursor; break; - case blink::WebCursorInfo::kTypeCustom: + case ui::CursorType::kCustom: if (cursorInfo.custom_image.colorType() == SkColorType::kN32_SkColorType) { QImage cursor = toQImage(cursorInfo.custom_image, QImage::Format_ARGB32); m_delegate->updateCursor(QCursor(QPixmap::fromImage(cursor), cursorInfo.hotspot.x(), cursorInfo.hotspot.y())); @@ -835,7 +834,7 @@ void RenderWidgetHostViewQt::OnTextSelectionChanged(content::TextInputManager *t #if defined(USE_OZONE) if (!selection->selected_text().empty() && selection->user_initiated()) { // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. - ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); + ui::ScopedClipboardWriter clipboard_writer(ui::ClipboardType::kSelection); clipboard_writer.WriteText(selection->selected_text()); } #endif // defined(USE_OZONE) @@ -1016,7 +1015,7 @@ void RenderWidgetHostViewQt::notifyShown() m_delegatedFrameHost->AttachToCompositor(m_uiCompositor.get()); m_delegatedFrameHost->WasShown(GetLocalSurfaceIdAllocation().local_surface_id(), m_viewRectInDips.size(), - false /* record_presentation_time */); + base::nullopt); } host()->WasShown(base::nullopt); } @@ -1028,7 +1027,7 @@ void RenderWidgetHostViewQt::notifyHidden() return; m_visible = false; host()->WasHidden(); - m_delegatedFrameHost->WasHidden(); + m_delegatedFrameHost->WasHidden(content::DelegatedFrameHost::HiddenCause::kOther); m_delegatedFrameHost->DetachFromCompositor(); } else { host()->WasHidden(); diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 1d2d37898..b9b199087 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -298,7 +298,8 @@ void ContentRendererClientQt::GetNavigationErrorStringsInternal(content::RenderF resourceId = IDR_NET_ERROR_HTML; - const base::StringPiece template_html(ui::ResourceBundle::GetSharedInstance().GetRawDataResource(resourceId)); + std::string extracted_string = ui::ResourceBundle::GetSharedInstance().DecompressDataResource(resourceId); + const base::StringPiece template_html(extracted_string.data(), extracted_string.size()); if (template_html.empty()) NOTREACHED() << "unable to load template. ID: " << resourceId; else // "t" is the id of the templates root node. @@ -523,7 +524,7 @@ static void AddWidevine(std::vector<std::unique_ptr<media::KeySystemProperties>> } // Session types. - bool cdm_supports_temporary_session = base::ContainsValue(capability->session_types, media::CdmSessionType::kTemporary); + bool cdm_supports_temporary_session = base::Contains(capability->session_types, media::CdmSessionType::kTemporary); if (!cdm_supports_temporary_session) { DVLOG(1) << "Temporary session must be supported."; return; diff --git a/src/core/renderer/extensions/extensions_renderer_client_qt.cpp b/src/core/renderer/extensions/extensions_renderer_client_qt.cpp index c25494590..7d4c9a83c 100644 --- a/src/core/renderer/extensions/extensions_renderer_client_qt.cpp +++ b/src/core/renderer/extensions/extensions_renderer_client_qt.cpp @@ -56,6 +56,8 @@ #include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_thread.h" #include "extensions/common/constants.h" +#include "extensions/common/extension.h" +#include "extensions/common/manifest_handlers/background_info.h" #include "extensions/common/switches.h" #include "extensions/renderer/dispatcher.h" #include "extensions/renderer/extension_frame_helper.h" @@ -120,6 +122,28 @@ void ExtensionsRendererClientQt::OnExtensionUnloaded(const extensions::Extension resource_request_policy_->OnExtensionUnloaded(extension_id); } +bool ExtensionsRendererClientQt::ExtensionAPIEnabledForServiceWorkerScript(const GURL &scope, const GURL &script_url) const +{ + if (!script_url.SchemeIs(extensions::kExtensionScheme)) + return false; + + if (!extensions::ExtensionsClient::Get()->ExtensionAPIEnabledInExtensionServiceWorkers()) + return false; + + const extensions::Extension* extension = + extensions::RendererExtensionRegistry::Get()->GetExtensionOrAppByURL(script_url); + + if (!extension || !extensions::BackgroundInfo::IsServiceWorkerBased(extension)) + return false; + + if (scope != extension->url()) + return false; + + const std::string& sw_script = extensions::BackgroundInfo::GetBackgroundServiceWorkerScript(extension); + + return extension->GetResourceURL(sw_script) == script_url; +} + void ExtensionsRendererClientQt::RenderThreadStarted() { content::RenderThread *thread = content::RenderThread::Get(); diff --git a/src/core/renderer/extensions/extensions_renderer_client_qt.h b/src/core/renderer/extensions/extensions_renderer_client_qt.h index 2d45d255a..87e324213 100644 --- a/src/core/renderer/extensions/extensions_renderer_client_qt.h +++ b/src/core/renderer/extensions/extensions_renderer_client_qt.h @@ -113,6 +113,8 @@ public: const std::string &mime_type, const GURL &original_url); + bool ExtensionAPIEnabledForServiceWorkerScript(const GURL &scope, const GURL &script_url) const override; + void RunScriptsAtDocumentStart(content::RenderFrame *render_frame); void RunScriptsAtDocumentEnd(content::RenderFrame *render_frame); void RunScriptsAtDocumentIdle(content::RenderFrame *render_frame); diff --git a/src/core/renderer/web_channel_ipc_transport.cpp b/src/core/renderer/web_channel_ipc_transport.cpp index 1bdd1d8c0..108686068 100644 --- a/src/core/renderer/web_channel_ipc_transport.cpp +++ b/src/core/renderer/web_channel_ipc_transport.cpp @@ -92,15 +92,18 @@ void WebChannelTransport::Install(blink::WebLocalFrame *frame, uint worldId) gin::Handle<WebChannelTransport> transport = gin::CreateHandle(isolate, new WebChannelTransport); v8::Local<v8::Object> global = context->Global(); - v8::Local<v8::Value> qtObjectValue = global->Get(gin::StringToV8(isolate, "qt")); + v8::MaybeLocal<v8::Value> qtObjectValue = global->Get(context, gin::StringToV8(isolate, "qt")); v8::Local<v8::Object> qtObject; - if (qtObjectValue.IsEmpty() || !qtObjectValue->IsObject()) { + if (qtObjectValue.IsEmpty() || !qtObjectValue.ToLocalChecked()->IsObject()) { qtObject = v8::Object::New(isolate); - global->Set(gin::StringToV8(isolate, "qt"), qtObject); + auto whocares = global->Set(context, gin::StringToV8(isolate, "qt"), qtObject); + // FIXME: Perhaps error out, but the return value is V8 internal... + Q_UNUSED(whocares); } else { - qtObject = v8::Local<v8::Object>::Cast(qtObjectValue); + qtObject = v8::Local<v8::Object>::Cast(qtObjectValue.ToLocalChecked()); } - qtObject->Set(gin::StringToV8(isolate, "webChannelTransport"), transport.ToV8()); + auto whocares = qtObject->Set(context, gin::StringToV8(isolate, "webChannelTransport"), transport.ToV8()); + Q_UNUSED(whocares); } void WebChannelTransport::Uninstall(blink::WebLocalFrame *frame, uint worldId) @@ -115,11 +118,11 @@ void WebChannelTransport::Uninstall(blink::WebLocalFrame *frame, uint worldId) v8::Context::Scope contextScope(context); v8::Local<v8::Object> global(context->Global()); - v8::Local<v8::Value> qtObjectValue = global->Get(gin::StringToV8(isolate, "qt")); - if (qtObjectValue.IsEmpty() || !qtObjectValue->IsObject()) + v8::MaybeLocal<v8::Value> qtObjectValue = global->Get(context, gin::StringToV8(isolate, "qt")); + if (qtObjectValue.IsEmpty() || !qtObjectValue.ToLocalChecked()->IsObject()) return; - v8::Local<v8::Object> qtObject = v8::Local<v8::Object>::Cast(qtObjectValue); - // FIXME: ? + v8::Local<v8::Object> qtObject = v8::Local<v8::Object>::Cast(qtObjectValue.ToLocalChecked()); + // FIXME: We can't do anything about a failure, so why the .. is it nodiscard? auto whocares = qtObject->Delete(context, gin::StringToV8(isolate, "webChannelTransport")); Q_UNUSED(whocares); } @@ -235,16 +238,16 @@ void WebChannelIPCTransport::DispatchWebChannelMessage(const std::vector<uint8_t v8::Context::Scope contextScope(context); v8::Local<v8::Object> global(context->Global()); - v8::Local<v8::Value> qtObjectValue(global->Get(gin::StringToV8(isolate, "qt"))); - if (qtObjectValue.IsEmpty() || !qtObjectValue->IsObject()) + v8::MaybeLocal<v8::Value> qtObjectValue(global->Get(context, gin::StringToV8(isolate, "qt"))); + if (qtObjectValue.IsEmpty() || !qtObjectValue.ToLocalChecked()->IsObject()) return; - v8::Local<v8::Object> qtObject = v8::Local<v8::Object>::Cast(qtObjectValue); - v8::Local<v8::Value> webChannelObjectValue(qtObject->Get(gin::StringToV8(isolate, "webChannelTransport"))); - if (webChannelObjectValue.IsEmpty() || !webChannelObjectValue->IsObject()) + v8::Local<v8::Object> qtObject = v8::Local<v8::Object>::Cast(qtObjectValue.ToLocalChecked()); + v8::MaybeLocal<v8::Value> webChannelObjectValue(qtObject->Get(context, gin::StringToV8(isolate, "webChannelTransport"))); + if (webChannelObjectValue.IsEmpty() || !webChannelObjectValue.ToLocalChecked()->IsObject()) return; - v8::Local<v8::Object> webChannelObject = v8::Local<v8::Object>::Cast(webChannelObjectValue); - v8::Local<v8::Value> callbackValue(webChannelObject->Get(gin::StringToV8(isolate, "onmessage"))); - if (callbackValue.IsEmpty() || !callbackValue->IsFunction()) { + v8::Local<v8::Object> webChannelObject = v8::Local<v8::Object>::Cast(webChannelObjectValue.ToLocalChecked()); + v8::MaybeLocal<v8::Value> callbackValue(webChannelObject->Get(context, gin::StringToV8(isolate, "onmessage"))); + if (callbackValue.IsEmpty() || !callbackValue.ToLocalChecked()->IsFunction()) { LOG(WARNING) << "onmessage is not a callable property of qt.webChannelTransport. Some things might not work as expected."; return; } @@ -257,7 +260,7 @@ void WebChannelIPCTransport::DispatchWebChannelMessage(const std::vector<uint8_t v8::PropertyAttribute(v8::ReadOnly | v8::DontDelete)); DCHECK(!wasSet.IsNothing() && wasSet.FromJust()); - v8::Local<v8::Function> callback = v8::Local<v8::Function>::Cast(callbackValue); + v8::Local<v8::Function> callback = v8::Local<v8::Function>::Cast(callbackValue.ToLocalChecked()); v8::Local<v8::Value> argv[] = { messageObject }; frame->CallFunctionEvenIfScriptDisabled(callback, webChannelObject, 1, argv); } diff --git a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp b/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp index eba835cd7..a08e2cf88 100644 --- a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp +++ b/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp @@ -98,7 +98,7 @@ void OnPdfStreamIntercepted( // external viewer, trigger the download. std::unique_ptr<download::DownloadUrlParameters> params( content::DownloadRequestUtils::CreateDownloadForWebContentsMainFrame( - web_contents, original_url, NO_TRAFFIC_ANNOTATION_YET)); + web_contents, original_url, MISSING_TRAFFIC_ANNOTATION)); content::BrowserContext::GetDownloadManager(web_contents->GetBrowserContext()) ->DownloadUrl(std::move(params)); return; diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 85e63c5a4..3eb52409d 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -334,6 +334,7 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex, std::unique_ptr<content::NavigationEntry> entry = content::NavigationController::CreateNavigationEntry( toGurl(virtualUrl), content::Referrer(toGurl(referrerUrl), static_cast<network::mojom::ReferrerPolicy>(referrerPolicy)), + base::nullopt, // optional initiator_origin // Use a transition type of reload so that we don't incorrectly // increase the typed count. ui::PAGE_TRANSITION_RELOAD, diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 4f8f853b2..255ff0034 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -539,7 +539,7 @@ void WebContentsDelegateQt::ExitFullscreenModeForTab(content::WebContents *web_c m_viewClient->requestFullScreenMode(toQt(web_contents->GetLastCommittedURL().GetOrigin()), false); } -bool WebContentsDelegateQt::IsFullscreenForTabOrPending(const content::WebContents* web_contents) const +bool WebContentsDelegateQt::IsFullscreenForTabOrPending(const content::WebContents* web_contents) { Q_UNUSED(web_contents); return m_viewClient->isFullScreenMode(); @@ -729,12 +729,12 @@ void WebContentsDelegateQt::BeforeUnloadFired(bool proceed, const base::TimeTick Q_UNUSED(proceed_time); } -bool WebContentsDelegateQt::CheckMediaAccessPermission(content::RenderFrameHost *, const GURL& security_origin, blink::MediaStreamType type) +bool WebContentsDelegateQt::CheckMediaAccessPermission(content::RenderFrameHost *, const GURL& security_origin, blink::mojom::MediaStreamType type) { switch (type) { - case blink::MEDIA_DEVICE_AUDIO_CAPTURE: + case blink::mojom::MediaStreamType::DEVICE_AUDIO_CAPTURE: return m_viewClient->profileAdapter()->checkPermission(toQt(security_origin), ProfileAdapter::AudioCapturePermission); - case blink::MEDIA_DEVICE_VIDEO_CAPTURE: + case blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE: return m_viewClient->profileAdapter()->checkPermission(toQt(security_origin), ProfileAdapter::VideoCapturePermission); default: LOG(INFO) << "WebContentsDelegateQt::CheckMediaAccessPermission: " @@ -833,28 +833,28 @@ void WebContentsDelegateQt::setLoadingState(LoadingState state) webContentsAdapter()->updateRecommendedState(); } -int &WebContentsDelegateQt::streamCount(blink::MediaStreamType type) +int &WebContentsDelegateQt::streamCount(blink::mojom::MediaStreamType type) { // Based on MediaStreamCaptureIndicator::WebContentsDeviceUsage::GetStreamCount switch (type) { - case blink::MEDIA_DEVICE_AUDIO_CAPTURE: + case blink::mojom::MediaStreamType::DEVICE_AUDIO_CAPTURE: return m_audioStreamCount; - case blink::MEDIA_DEVICE_VIDEO_CAPTURE: + case blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE: return m_videoStreamCount; - case blink::MEDIA_GUM_TAB_AUDIO_CAPTURE: - case blink::MEDIA_GUM_TAB_VIDEO_CAPTURE: + case blink::mojom::MediaStreamType::GUM_TAB_AUDIO_CAPTURE: + case blink::mojom::MediaStreamType::GUM_TAB_VIDEO_CAPTURE: return m_mirroringStreamCount; - case blink::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE: - case blink::MEDIA_GUM_DESKTOP_AUDIO_CAPTURE: - case blink::MEDIA_DISPLAY_VIDEO_CAPTURE: - case blink::MEDIA_DISPLAY_AUDIO_CAPTURE: + case blink::mojom::MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE: + case blink::mojom::MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE: + case blink::mojom::MediaStreamType::DISPLAY_VIDEO_CAPTURE: + case blink::mojom::MediaStreamType::DISPLAY_AUDIO_CAPTURE: return m_desktopStreamCount; - case blink::MEDIA_NO_SERVICE: - case blink::NUM_MEDIA_TYPES: + case blink::mojom::MediaStreamType::NO_SERVICE: + case blink::mojom::MediaStreamType::NUM_MEDIA_TYPES: NOTREACHED(); return m_videoStreamCount; } diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 19d1f9d58..ba8c6b5a1 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -130,7 +130,7 @@ public: content::JavaScriptDialogManager *GetJavaScriptDialogManager(content::WebContents *source) override; void EnterFullscreenModeForTab(content::WebContents *web_contents, const GURL &origin, const blink::WebFullscreenOptions &) override; void ExitFullscreenModeForTab(content::WebContents*) override; - bool IsFullscreenForTabOrPending(const content::WebContents* web_contents) const override; + bool IsFullscreenForTabOrPending(const content::WebContents* web_contents) override; void RunFileChooser(content::RenderFrameHost* render_frame_host, std::unique_ptr<content::FileSelectListener> listener, const blink::mojom::FileChooserParams& params) override; @@ -144,7 +144,7 @@ public: void UpdateTargetURL(content::WebContents* source, const GURL& url) override; void RequestToLockMouse(content::WebContents *web_contents, bool user_gesture, bool last_unlocked_by_target) override; void BeforeUnloadFired(content::WebContents* tab, bool proceed, bool* proceed_to_fire_unload) override; - bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host, const GURL& security_origin, blink::MediaStreamType type) override; + bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host, const GURL& security_origin, blink::mojom::MediaStreamType type) override; void RegisterProtocolHandler(content::WebContents* web_contents, const std::string& protocol, const GURL& url, bool user_gesture) override; void UnregisterProtocolHandler(content::WebContents* web_contents, const std::string& protocol, const GURL& url, bool user_gesture) override; bool TakeFocus(content::WebContents *source, bool reverse) override; @@ -209,7 +209,7 @@ private: LoadingState determineLoadingState(content::WebContents *contents); void setLoadingState(LoadingState state); - int &streamCount(blink::MediaStreamType type); + int &streamCount(blink::mojom::MediaStreamType type); WebContentsAdapterClient *m_viewClient; QVector<int64_t> m_loadingErrorFrameList; diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index f8a2a7f6e..d4dfaba28 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -53,10 +53,13 @@ #include "chrome/browser/printing/print_job_manager.h" #include "components/printing/browser/features.h" #endif +#include "components/discardable_memory/service/discardable_shared_memory_manager.h" #include "components/viz/common/features.h" #include "components/web_cache/browser/web_cache_manager.h" +#include "content/app/service_manager_environment.h" #include "content/browser/devtools/devtools_http_handler.h" #include "content/browser/scheduler/browser_task_executor.h" +#include "content/browser/startup_data_impl.h" #include "content/browser/startup_helper.h" #include "content/public/app/content_main.h" #include "content/public/app/content_main_runner.h" @@ -81,6 +84,7 @@ #include "services/network/public/cpp/network_switches.h" #include "services/resource_coordinator/public/cpp/resource_coordinator_features.h" #include "services/service_manager/sandbox/switches.h" +#include "services/tracing/public/cpp/tracing_features.h" #include "third_party/blink/public/common/features.h" #include "ui/events/event_switches.h" #include "ui/native_theme/native_theme_features.h" @@ -281,6 +285,11 @@ void WebEngineContext::destroy() // Destroy the main runner, this stops main message loop m_browserRunner.reset(); + // These would normally be in the content-runner, but we allocated them separately: + m_startupData.reset(); + m_serviceManagerEnvironment.reset(); + m_discardableSharedMemoryManager.reset(); + // Destroying content-runner will force Chromium at_exit calls to run, and // reap child processes. m_contentRunner.reset(); @@ -512,6 +521,9 @@ WebEngineContext::WebEngineContext() // This is deprecated behavior, and will be removed in a future Chromium version, as per // upstream Chromium commit ba52f56207a4b9d70b34880fbff2352e71a06422. appendToFeatureList(enableFeatures, features::kAllowContentInitiatedDataUrlNavigations.name); + + appendToFeatureList(enableFeatures, features::kTracingServiceInProcess.name); + // The video-capture service is not functioning at this moment (since 69) appendToFeatureList(disableFeatures, features::kMojoVideoCapture.name); @@ -527,6 +539,7 @@ WebEngineContext::WebEngineContext() // Explicitly tell Chromium about default-on features we do not support appendToFeatureList(disableFeatures, features::kBackgroundFetch.name); appendToFeatureList(disableFeatures, features::kOriginTrials.name); + appendToFeatureList(disableFeatures, features::kSmsReceiver.name); appendToFeatureList(disableFeatures, features::kWebAuth.name); appendToFeatureList(disableFeatures, features::kWebAuthCable.name); appendToFeatureList(disableFeatures, features::kWebPayments.name); @@ -541,8 +554,6 @@ WebEngineContext::WebEngineContext() } if (!enableViz) { - // Surface synchronization breaks our current graphics integration (since 65) - appendToFeatureList(disableFeatures, features::kEnableSurfaceSynchronization.name); // Viz Display Compositor is enabled by default since 73. Doesn't work for us (also implies SurfaceSynchronization) appendToFeatureList(disableFeatures, features::kVizDisplayCompositor.name); // VideoSurfaceLayer is enabled by default since 75. We don't support it. @@ -649,7 +660,9 @@ WebEngineContext::WebEngineContext() #endif m_contentRunner->Initialize(contentMainParams); - mojo::core::Init(); + mojo::core::Configuration mojoConfiguration; + mojoConfiguration.is_broker_process = true; + mojo::core::Init(mojoConfiguration); // This block mirrors ContentMainRunnerImpl::RunServiceManager(): m_mainDelegate->PreCreateMainMessageLoop(); @@ -658,12 +671,16 @@ WebEngineContext::WebEngineContext() m_mainDelegate->PostEarlyInitialization(false); content::StartBrowserThreadPool(); content::BrowserTaskExecutor::PostFeatureListSetup(); + m_discardableSharedMemoryManager = std::make_unique<discardable_memory::DiscardableSharedMemoryManager>(); + m_serviceManagerEnvironment = std::make_unique<content::ServiceManagerEnvironment>(content::BrowserTaskExecutor::CreateIOThread()); + m_startupData = m_serviceManagerEnvironment->CreateBrowserStartupData(); // Once the MessageLoop has been created, attach a top-level RunLoop. m_runLoop.reset(new base::RunLoop); m_runLoop->BeforeRun(); content::MainFunctionParams mainParams(*base::CommandLine::ForCurrentProcess()); + mainParams.startup_data = m_startupData.get(); m_browserRunner->Initialize(mainParams); m_devtoolsServer.reset(new DevToolsServerQt()); diff --git a/src/core/web_engine_context.h b/src/core/web_engine_context.h index 2364bacbe..5892017c5 100644 --- a/src/core/web_engine_context.h +++ b/src/core/web_engine_context.h @@ -56,6 +56,12 @@ class ContentMainRunner; class GpuProcess; class GpuThreadController; class InProcessChildThreadParams; +class ServiceManagerEnvironment; +struct StartupData; +} + +namespace discardable_memory { +class DiscardableSharedMemoryManager; } namespace gpu { @@ -116,6 +122,9 @@ private: std::unique_ptr<ContentMainDelegateQt> m_mainDelegate; std::unique_ptr<content::ContentMainRunner> m_contentRunner; std::unique_ptr<content::BrowserMainRunner> m_browserRunner; + std::unique_ptr<discardable_memory::DiscardableSharedMemoryManager> m_discardableSharedMemoryManager; + std::unique_ptr<content::StartupData> m_startupData; + std::unique_ptr<content::ServiceManagerEnvironment> m_serviceManagerEnvironment; std::unique_ptr<QObject> m_globalQObject; std::unique_ptr<ProfileAdapter> m_defaultProfileAdapter; std::unique_ptr<DevToolsServerQt> m_devtoolsServer; diff --git a/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro b/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro index 912c59092..57f79f582 100644 --- a/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro +++ b/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro @@ -30,6 +30,9 @@ win32: QMAKE_CXXFLAGS_WARN_ON = -wd4577 # Issue with some template compliation, smb smart should look at it win32: DEFINES += NOMINMAX +# To avoid conflict between windows.h and BoringSSL headers +win32: DEFINES += WIN32_LEAN_AND_MEAN + CHROMIUM_SRC_DIR = $$QTWEBENGINE_ROOT/$$getChromiumSrcDir() INCLUDEPATH += $$CHROMIUM_SRC_DIR \ $$CHROMIUM_SRC_DIR/third_party/boringssl/src/include \ diff --git a/src/webenginewidgets/api/qwebenginecertificateerror.cpp b/src/webenginewidgets/api/qwebenginecertificateerror.cpp index f5a8e6c6d..45277e19d 100644 --- a/src/webenginewidgets/api/qwebenginecertificateerror.cpp +++ b/src/webenginewidgets/api/qwebenginecertificateerror.cpp @@ -110,9 +110,9 @@ QWebEngineCertificateError::QWebEngineCertificateError(const QSharedPointer<Cert d->chain = controller->chain(); } -QWebEngineCertificateError::QWebEngineCertificateError(const QWebEngineCertificateError &other) = default; +QWebEngineCertificateError::QWebEngineCertificateError(const QWebEngineCertificateError &) = default; -QWebEngineCertificateError& QWebEngineCertificateError::operator=(const QWebEngineCertificateError &other) = default; +QWebEngineCertificateError& QWebEngineCertificateError::operator=(const QWebEngineCertificateError &) = default; /*! \internal */ diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py index 716a5ea3b..2cdc1e3fb 100644 --- a/tools/scripts/version_resolver.py +++ b/tools/scripts/version_resolver.py @@ -38,8 +38,8 @@ import json import urllib2 import git_submodule as GitSubmodule -chromium_version = '76.0.3809.94' -chromium_branch = '3809' +chromium_version = '77.0.3865.98' +chromium_branch = '3865' ninja_version = 'v1.9.0' json_url = 'http://omahaproxy.appspot.com/all.json' |