diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-09-25 15:33:01 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-01-25 14:41:02 +0000 |
commit | 448478729cfdf5098dd24a6a870bacdbcd8cf9a7 (patch) | |
tree | 546386ed2957dfc39725180a992191745dbef177 /src/core | |
parent | 5ab157588214bfbbc1d1f258a461b1cab4cc3991 (diff) |
Adaptations for Chromium 62
Change-Id: I49cd3c419d4dd1180144c3c07bdd9a628ab73caa
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'src/core')
31 files changed, 246 insertions, 169 deletions
diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp index e31951307..1c96ac538 100644 --- a/src/core/browser_accessibility_qt.cpp +++ b/src/core/browser_accessibility_qt.cpp @@ -214,8 +214,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::Section; case ui::AX_ROLE_BLOCKQUOTE: return QAccessible::Section; - case ui::AX_ROLE_BUSY_INDICATOR: - return QAccessible::NoRole; // This is unused and planned to be removed. case ui::AX_ROLE_BUTTON: return QAccessible::Button; case ui::AX_ROLE_BUTTON_DROP_DOWN: @@ -297,8 +295,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::Graphic; case ui::AX_ROLE_IMAGE_MAP: return QAccessible::Graphic; - case ui::AX_ROLE_IMAGE_MAP_LINK: - return QAccessible::Link; case ui::AX_ROLE_INLINE_TEXT_BOX: return QAccessible::EditableText; case ui::AX_ROLE_INPUT_TIME: @@ -355,8 +351,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::Section; case ui::AX_ROLE_NOTE: return QAccessible::Note; - case ui::AX_ROLE_OUTLINE: - return QAccessible::Tree; case ui::AX_ROLE_PANE: return QAccessible::Pane; case ui::AX_ROLE_PARAGRAPH: @@ -381,14 +375,8 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::RowHeader; case ui::AX_ROLE_RUBY: return QAccessible::StaticText; - case ui::AX_ROLE_RULER: - return QAccessible::NoRole; // FIXME - case ui::AX_ROLE_SCROLL_AREA: - return QAccessible::Client; // FIXME case ui::AX_ROLE_SCROLL_BAR: return QAccessible::ScrollBar; - case ui::AX_ROLE_SEAMLESS_WEB_AREA: - return QAccessible::NoRole; // FIXME case ui::AX_ROLE_SEARCH: return QAccessible::Section; case ui::AX_ROLE_SEARCH_BOX: @@ -417,8 +405,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::Section; case ui::AX_ROLE_TAB: return QAccessible::PageTab; - case ui::AX_ROLE_TAB_GROUP: // blink doesn't use (uses ROLE_TAB_LIST) - return QAccessible::NoRole; // FIXME case ui::AX_ROLE_TAB_LIST: return QAccessible::PageTabList; case ui::AX_ROLE_TAB_PANEL: @@ -456,8 +442,6 @@ QAccessible::State BrowserAccessibilityQt::state() const { QAccessible::State state = QAccessible::State(); int32_t s = GetState(); - if (s & (1 << ui::AX_STATE_BUSY)) - state.busy = true; if (s & (1 << ui::AX_STATE_COLLAPSED)) state.collapsed = true; if (s & (1 << ui::AX_STATE_DEFAULT)) @@ -497,6 +481,8 @@ QAccessible::State BrowserAccessibilityQt::state() const if (manager()->GetFocus() == this) state.focused = true; + if (GetBoolAttribute(ui::AX_ATTR_BUSY)) + state.busy = true; if (HasIntAttribute(ui::AX_ATTR_CHECKED_STATE)) { ui::AXCheckedState checkedState = (ui::AXCheckedState)GetIntAttribute(ui::AX_ATTR_CHECKED_STATE); switch (checkedState) { diff --git a/src/core/browser_message_filter_qt.cpp b/src/core/browser_message_filter_qt.cpp index 13d74df72..5248c2a73 100644 --- a/src/core/browser_message_filter_qt.cpp +++ b/src/core/browser_message_filter_qt.cpp @@ -58,7 +58,7 @@ BrowserMessageFilterQt::BrowserMessageFilterQt(int /*render_process_id*/) bool BrowserMessageFilterQt::OnMessageReceived(const IPC::Message& message) { IPC_BEGIN_MESSAGE_MAP(BrowserMessageFilterQt, message) -#if BUILDFLAG(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) IPC_MESSAGE_HANDLER( QtWebEngineHostMsg_IsInternalPluginAvailableForMimeType, OnIsInternalPluginAvailableForMimeType) @@ -68,7 +68,7 @@ bool BrowserMessageFilterQt::OnMessageReceived(const IPC::Message& message) return true; } -#if BUILDFLAG(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) void BrowserMessageFilterQt::OnIsInternalPluginAvailableForMimeType( const std::string& mime_type, bool* is_available, std::vector<base::string16>* additional_param_names, @@ -93,6 +93,6 @@ void BrowserMessageFilterQt::OnIsInternalPluginAvailableForMimeType( *is_available = false; } -#endif // BUILDFLAG(ENABLE_PEPPER_CDMS) +#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) } // namespace QtWebEngineCore diff --git a/src/core/browser_message_filter_qt.h b/src/core/browser_message_filter_qt.h index 054625c96..175319805 100644 --- a/src/core/browser_message_filter_qt.h +++ b/src/core/browser_message_filter_qt.h @@ -41,7 +41,7 @@ #define BROWSER_MESSAGE_FILTER_QT_H #include "content/public/browser/browser_message_filter.h" -#include "ppapi/features/features.h" +#include "media/media_features.h" namespace QtWebEngineCore { @@ -52,7 +52,7 @@ public: private: bool OnMessageReceived(const IPC::Message& message) override; -#if BUILDFLAG(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) // Returns whether any internal plugin supporting |mime_type| is registered // and enabled. Does not determine whether the plugin can actually be // instantiated (e.g. whether it has all its dependencies). diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index 152c4db63..cff975e61 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -223,7 +223,7 @@ void ClipboardQt::WriteObjects(ui::ClipboardType type, const ObjectMap& objects) 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)); + WriteObjects(ui::CLIPBOARD_TYPE_SELECTION, ObjectMap(text_iter, ++next_iter, base::KEEP_FIRST_OF_DUPES)); } } } diff --git a/src/core/common/qt_messages.h b/src/core/common/qt_messages.h index fae80186b..3bedb10d2 100644 --- a/src/core/common/qt_messages.h +++ b/src/core/common/qt_messages.h @@ -4,6 +4,7 @@ // Multiply-included file, no traditional include guard. +#include "media/media_features.h" #include "content/public/common/common_param_traits.h" #include "ipc/ipc_message_macros.h" #include "ppapi/features/features.h" @@ -73,7 +74,7 @@ IPC_MESSAGE_ROUTED1(WebChannelIPCTransportHost_SendMessage, std::vector<char> /* // Misc messages // These are messages sent from the renderer to the browser process. -#if BUILDFLAG(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) // Returns whether any internal plugin supporting |mime_type| is registered and // enabled. Does not determine whether the plugin can actually be instantiated // (e.g. whether it has all its dependencies). diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 5689a4fb8..7a53e28c7 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -72,7 +72,7 @@ #include "net/ssl/client_cert_identity.h" #include "services/service_manager/public/cpp/bind_source_info.h" #include "services/service_manager/public/cpp/binder_registry.h" -#include "third_party/WebKit/public/platform/modules/sensitive_input_visibility/sensitive_input_visibility_service.mojom.h" +#include "third_party/WebKit/public/platform/modules/insecure_input/insecure_input_service.mojom.h" #include "ui/base/ui_base_switches.h" #include "ui/display/screen.h" #include "ui/gl/gl_context.h" @@ -358,6 +358,14 @@ public: { return nullptr; } + const gl::ExtensionSet& GetExtensions() override + { + static const gl::ExtensionSet s_emptySet; + return s_emptySet; + } + void ResetExtensions() override + { + } private: void *m_handle; @@ -413,7 +421,7 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost* const int id = host->GetID(); content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme(id, url::kFileScheme); static_cast<BrowserContextQt*>(host->GetBrowserContext())->m_adapter->userResourceController()->renderProcessStartedWithHost(host); -#if BUILDFLAG(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) host->AddFilter(new BrowserMessageFilterQt(id)); #endif #if defined(Q_OS_MACOS) && BUILDFLAG(ENABLE_SPELLCHECK) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) @@ -512,7 +520,7 @@ void ContentBrowserClientQt::GetAdditionalViewSourceSchemes(std::vector<std::str } #if defined(Q_OS_LINUX) -void ContentBrowserClientQt::GetAdditionalMappedFilesForChildProcess(const base::CommandLine& command_line, int child_process_id, content::FileDescriptorInfo* mappings) +void ContentBrowserClientQt::GetAdditionalMappedFilesForChildProcess(const base::CommandLine& command_line, int child_process_id, content::PosixFileDescriptorInfo* mappings) { const std::string &locale = GetApplicationLocale(); const base::FilePath &locale_file_path = ui::ResourceBundle::GetSharedInstance().GetLocaleFilePath(locale, true); @@ -542,7 +550,7 @@ content::DevToolsManagerDelegate* ContentBrowserClientQt::GetDevToolsManagerDele // This is a really complicated way of doing absolutely nothing, but Mojo demands it: class ServiceDriver - : public blink::mojom::SensitiveInputVisibilityService + : public blink::mojom::InsecureInputService , public content::WebContentsUserData<ServiceDriver> { public: @@ -561,38 +569,38 @@ public: return nullptr; return FromWebContents(web_contents); } - static void BindSensitiveInputVisibilityService(blink::mojom::SensitiveInputVisibilityServiceRequest request, - content::RenderFrameHost* render_frame_host) + static void BindInsecureInputService(blink::mojom::InsecureInputServiceRequest request, content::RenderFrameHost *render_frame_host) { CreateForRenderFrameHost(render_frame_host); ServiceDriver *driver = FromRenderFrameHost(render_frame_host); if (driver) - driver->BindSensitiveInputVisibilityServiceRequest(std::move(request)); + driver->BindInsecureInputServiceRequest(std::move(request)); } - void BindSensitiveInputVisibilityServiceRequest(blink::mojom::SensitiveInputVisibilityServiceRequest request) + void BindInsecureInputServiceRequest(blink::mojom::InsecureInputServiceRequest request) { - m_sensitiveInputVisibilityBindings.AddBinding(this, std::move(request)); + m_insecureInputServiceBindings.AddBinding(this, std::move(request)); } - // blink::mojom::SensitiveInputVisibility: + // blink::mojom::InsecureInputService: void PasswordFieldVisibleInInsecureContext() override { } void AllPasswordFieldsInInsecureContextInvisible() override { } + void DidEditFieldInInsecureContext() override + { } private: explicit ServiceDriver(content::WebContents* /*web_contents*/) { } friend class content::WebContentsUserData<ServiceDriver>; - mojo::BindingSet<blink::mojom::SensitiveInputVisibilityService> m_sensitiveInputVisibilityBindings; - + mojo::BindingSet<blink::mojom::InsecureInputService> m_insecureInputServiceBindings; }; void ContentBrowserClientQt::InitFrameInterfaces() { m_frameInterfaces = base::MakeUnique<service_manager::BinderRegistry>(); m_frameInterfacesParameterized = base::MakeUnique<service_manager::BinderRegistryWithArgs<content::RenderFrameHost*>>(); - m_frameInterfacesParameterized->AddInterface(base::Bind(&ServiceDriver::BindSensitiveInputVisibilityService)); + m_frameInterfacesParameterized->AddInterface(base::Bind(&ServiceDriver::BindInsecureInputService)); } void ContentBrowserClientQt::BindInterfaceRequestFromFrame(content::RenderFrameHost* render_frame_host, diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h index db5cbd191..736519036 100644 --- a/src/core/content_browser_client_qt.h +++ b/src/core/content_browser_client_qt.h @@ -153,7 +153,7 @@ public: const net::CookieOptions& options) override; #if defined(Q_OS_LINUX) - void GetAdditionalMappedFilesForChildProcess(const base::CommandLine& command_line, int child_process_id, content::FileDescriptorInfo* mappings) override; + void GetAdditionalMappedFilesForChildProcess(const base::CommandLine& command_line, int child_process_id, content::PosixFileDescriptorInfo* mappings) override; #endif #if BUILDFLAG(ENABLE_PLUGINS) diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index a3a460cb4..66c63b1b8 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -202,7 +202,7 @@ void AddPepperFlashFromCommandLine(std::vector<content::PepperPluginInfo>* plugi void AddPepperWidevine(std::vector<content::PepperPluginInfo>* plugins) { -#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS) && !defined(WIDEVINE_CDM_IS_COMPONENT) +#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS) && !defined(WIDEVINE_CDM_IS_COMPONENT) QStringList pluginPaths; const base::CommandLine::StringType widevine_argument = base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(switches::kPpapiWidevinePath); if (!widevine_argument.empty()) diff --git a/src/core/cookie_monster_delegate_qt.cpp b/src/core/cookie_monster_delegate_qt.cpp index 58cd481dc..abc386204 100644 --- a/src/core/cookie_monster_delegate_qt.cpp +++ b/src/core/cookie_monster_delegate_qt.cpp @@ -86,6 +86,17 @@ CookieMonsterDelegateQt::~CookieMonsterDelegateQt() } +void CookieMonsterDelegateQt::AddStore(net::CookieStore *store) +{ + std::unique_ptr<net::CookieStore::CookieChangedSubscription> sub = + store->AddCallbackForAllChanges( + base::Bind(&CookieMonsterDelegateQt::OnCookieChanged, + // this object's destruction will deregister the subscription. + base::Unretained(this))); + + m_subscriptions.push_back(std::move(sub)); +} + bool CookieMonsterDelegateQt::hasCookieMonster() { return m_cookieMonster; @@ -184,9 +195,13 @@ void CookieMonsterDelegateQt::DeleteAllOnIOThread(net::CookieMonster::DeleteCall void CookieMonsterDelegateQt::setCookieMonster(net::CookieMonster* monster) { - if (!monster && !m_cookieMonster) + if (monster == m_cookieMonster) return; + m_subscriptions.clear(); + if (monster) + AddStore(monster); + m_cookieMonster = monster; if (!m_client) @@ -227,11 +242,11 @@ bool CookieMonsterDelegateQt::canGetCookies(const QUrl &firstPartyUrl, const QUr return m_client->d_func()->canAccessCookies(firstPartyUrl, url); } -void CookieMonsterDelegateQt::OnCookieChanged(const net::CanonicalCookie& cookie, bool removed, net::CookieStore::ChangeCause cause) +void CookieMonsterDelegateQt::OnCookieChanged(const net::CanonicalCookie& cookie, net::CookieStore::ChangeCause cause) { if (!m_client) return; - m_client->d_func()->onCookieChanged(toQt(cookie), removed); + m_client->d_func()->onCookieChanged(toQt(cookie), cause != net::CookieStore::ChangeCause::INSERTED); } } diff --git a/src/core/cookie_monster_delegate_qt.h b/src/core/cookie_monster_delegate_qt.h index 941992a7b..8aceca9c9 100644 --- a/src/core/cookie_monster_delegate_qt.h +++ b/src/core/cookie_monster_delegate_qt.h @@ -64,9 +64,10 @@ namespace QtWebEngineCore { static const char* const kCookieableSchemes[] = { "http", "https", "qrc", "ws", "wss" }; -class QWEBENGINE_EXPORT CookieMonsterDelegateQt: public net::CookieMonsterDelegate { +class QWEBENGINE_EXPORT CookieMonsterDelegateQt : public base::RefCountedThreadSafe<CookieMonsterDelegateQt> { QPointer<QWebEngineCookieStore> m_client; net::CookieMonster *m_cookieMonster; + std::vector<std::unique_ptr<net::CookieStore::CookieChangedSubscription>> m_subscriptions; public: CookieMonsterDelegateQt(); ~CookieMonsterDelegateQt(); @@ -84,7 +85,9 @@ public: bool canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url); bool canGetCookies(const QUrl &firstPartyUrl, const QUrl &url); - void OnCookieChanged(const net::CanonicalCookie& cookie, bool removed, net::CookieStore::ChangeCause cause) override; + + void AddStore(net::CookieStore *store); + void OnCookieChanged(const net::CanonicalCookie &cookie, net::CookieStore::ChangeCause cause); private: void GetAllCookiesOnIOThread(net::CookieMonster::GetCookieListCallback callback); diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp index de39300c9..8d400882d 100644 --- a/src/core/delegated_frame_node.cpp +++ b/src/core/delegated_frame_node.cpp @@ -69,8 +69,8 @@ #include "cc/quads/texture_draw_quad.h" #include "cc/quads/tile_draw_quad.h" #include "cc/quads/yuv_video_draw_quad.h" -#include "cc/resources/returned_resource.h" -#include "cc/resources/transferable_resource.h" +#include "components/viz/common/resources/returned_resource.h" +#include "components/viz/common/resources/transferable_resource.h" #include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" #include "gpu/command_buffer/service/mailbox_manager.h" #include "ui/gl/gl_context.h" @@ -151,17 +151,17 @@ private: #endif // QT_NO_OPENGL class ResourceHolder { public: - ResourceHolder(const cc::TransferableResource &resource); + ResourceHolder(const viz::TransferableResource &resource); QSharedPointer<QSGTexture> initTexture(bool quadIsAllOpaque, RenderWidgetHostViewQtDelegate *apiDelegate = 0); QSGTexture *texture() const { return m_texture.data(); } - cc::TransferableResource &transferableResource() { return m_resource; } - cc::ReturnedResource returnResource(); + viz::TransferableResource &transferableResource() { return m_resource; } + viz::ReturnedResource returnResource(); void incImportCount() { ++m_importCount; } bool needsToFetch() const { return !m_resource.is_software && m_texture && !m_texture.data()->textureId(); } private: QWeakPointer<QSGTexture> m_texture; - cc::TransferableResource m_resource; + viz::TransferableResource m_resource; int m_importCount; }; @@ -449,7 +449,7 @@ static QSGNode *buildRenderPassChain(QSGNode *chainParent) return zCompressNode; } -static QSGNode *buildLayerChain(QSGNode *chainParent, const cc::SharedQuadState *layerState) +static QSGNode *buildLayerChain(QSGNode *chainParent, const viz::SharedQuadState *layerState) { QSGNode *layerChain = chainParent; if (layerState->is_clipped) { @@ -634,7 +634,7 @@ void MailboxTexture::fetchTexture(gpu::gles2::MailboxManager *mailboxManager) } #endif //QT_NO_OPENGL -ResourceHolder::ResourceHolder(const cc::TransferableResource &resource) +ResourceHolder::ResourceHolder(const viz::TransferableResource &resource) : m_resource(resource) , m_importCount(1) { @@ -671,9 +671,9 @@ QSharedPointer<QSGTexture> ResourceHolder::initTexture(bool quadNeedsBlending, R return texture; } -cc::ReturnedResource ResourceHolder::returnResource() +viz::ReturnedResource ResourceHolder::returnResource() { - cc::ReturnedResource returned; + viz::ReturnedResource returned; // The ResourceProvider ensures that the resource isn't used by the parent compositor's GL // context in the GPU process by inserting a sync point to be waited for by the child // compositor's GL context. We don't need this since we are triggering the delegated frame @@ -765,8 +765,8 @@ static YUVVideoMaterial::ColorSpace toQt(cc::YUVVideoDrawQuad::ColorSpace color_ return YUVVideoMaterial::REC_601; } -static bool areSharedQuadStatesEqual(const cc::SharedQuadState *layerState, - const cc::SharedQuadState *prevLayerState) +static bool areSharedQuadStatesEqual(const viz::SharedQuadState *layerState, + const viz::SharedQuadState *prevLayerState) { if (layerState->is_clipped != prevLayerState->is_clipped || layerState->clip_rect != prevLayerState->clip_rect) @@ -824,7 +824,7 @@ static bool areRenderPassStructuresEqual(cc::CompositorFrame *frameData, } void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData, - std::vector<cc::ReturnedResource> *resourcesToRelease, + std::vector<viz::ReturnedResource> *resourcesToRelease, RenderWidgetHostViewQtDelegate *apiDelegate) { m_chromiumCompositorData = chromiumCompositorData; @@ -849,7 +849,7 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData, // candidates to be picked up by quads, it's then our responsibility to return unused resources // to the producing child compositor. for (unsigned i = 0; i < frameData->resource_list.size(); ++i) { - const cc::TransferableResource &res = frameData->resource_list.at(i); + const viz::TransferableResource &res = frameData->resource_list.at(i); if (QSharedPointer<ResourceHolder> resource = resourceCandidates.value(res.id)) resource->incImportCount(); else @@ -947,13 +947,13 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData, std::deque<std::unique_ptr<cc::DrawPolygon>> polygonQueue; int nextPolygonId = 0; int currentSortingContextId = 0; - const cc::SharedQuadState *currentLayerState = nullptr; + const viz::SharedQuadState *currentLayerState = nullptr; QSGNode *currentLayerChain = nullptr; const auto quadListBegin = pass->quad_list.BackToFrontBegin(); const auto quadListEnd = pass->quad_list.BackToFrontEnd(); for (auto it = quadListBegin; it != quadListEnd; ++it) { const cc::DrawQuad *quad = *it; - const cc::SharedQuadState *quadState = quad->shared_quad_state; + const viz::SharedQuadState *quadState = quad->shared_quad_state; gfx::Rect targetRect = cc::MathUtil::MapEnclosingClippedRect(quadState->quad_to_target_transform, @@ -1019,7 +1019,7 @@ void DelegatedFrameNode::flushPolygons( const auto actionHandler = [&](cc::DrawPolygon *polygon) { const cc::DrawQuad *quad = polygon->original_ref(); - const cc::SharedQuadState *quadState = quad->shared_quad_state; + const viz::SharedQuadState *quadState = quad->shared_quad_state; QSGNode *currentLayerChain = nullptr; if (renderPassChain) diff --git a/src/core/delegated_frame_node.h b/src/core/delegated_frame_node.h index 4bddf4a62..21670e40f 100644 --- a/src/core/delegated_frame_node.h +++ b/src/core/delegated_frame_node.h @@ -42,7 +42,7 @@ #include "cc/output/compositor_frame.h" #include "cc/quads/render_pass.h" -#include "cc/resources/transferable_resource.h" +#include "components/viz/common/resources/transferable_resource.h" #include "gpu/command_buffer/service/sync_point_manager.h" #include "ui/gl/gl_fence.h" #include <QMutex> @@ -91,7 +91,7 @@ public: DelegatedFrameNode(); ~DelegatedFrameNode(); void preprocess(); - void commit(ChromiumCompositorData *chromiumCompositorData, std::vector<cc::ReturnedResource> *resourcesToRelease, RenderWidgetHostViewQtDelegate *apiDelegate); + void commit(ChromiumCompositorData *chromiumCompositorData, std::vector<viz::ReturnedResource> *resourcesToRelease, RenderWidgetHostViewQtDelegate *apiDelegate); private: void flushPolygons( diff --git a/src/core/devtools_manager_delegate_qt.cpp b/src/core/devtools_manager_delegate_qt.cpp index 8ea3c2fb7..305e32278 100644 --- a/src/core/devtools_manager_delegate_qt.cpp +++ b/src/core/devtools_manager_delegate_qt.cpp @@ -159,8 +159,7 @@ void DevToolsServerQt::start() m_isStarted = true; DevToolsAgentHost::StartRemoteDebuggingServer( std::move(socketFactory), std::string(), - base::FilePath(), base::FilePath(), - std::string(), std::string()); + base::FilePath(), base::FilePath()); } void DevToolsServerQt::stop() diff --git a/src/core/gl_surface_qt.cpp b/src/core/gl_surface_qt.cpp index f731b0231..e9491eaba 100644 --- a/src/core/gl_surface_qt.cpp +++ b/src/core/gl_surface_qt.cpp @@ -102,20 +102,24 @@ public: explicit GLSurfaceQtEGL(const gfx::Size& size); static bool InitializeOneOff(); + static bool InitializeExtensionSettingsOneOff(); bool Initialize(GLSurfaceFormat format) override; void Destroy() override; void* GetHandle() override; - bool Resize(const gfx::Size& size, float scale_factor, bool has_alpha) override; + bool Resize(const gfx::Size& size, float scale_factor, ColorSpace color_space, bool has_alpha) override; protected: ~GLSurfaceQtEGL(); private: EGLSurface m_surfaceBuffer; + static bool s_initialized; DISALLOW_COPY_AND_ASSIGN(GLSurfaceQtEGL); }; +bool GLSurfaceQtEGL::s_initialized = false; + // The following comment is cited from chromium/ui/gl/gl_surface_egl.cc: // SurfacelessEGL is used as Offscreen surface when platform supports // KHR_surfaceless_context and GL_OES_surfaceless_context. This would avoid the @@ -128,7 +132,7 @@ public: bool Initialize(GLSurfaceFormat format) override; void Destroy() override; bool IsSurfaceless() const override; - bool Resize(const gfx::Size& size, float scale_factor, bool has_alpha) override; + bool Resize(const gfx::Size& size, float scale_factor, ColorSpace color_space, bool has_alpha) override; EGLSurface GetHandle() override; void* GetShareHandle() override; @@ -136,7 +140,6 @@ private: DISALLOW_COPY_AND_ASSIGN(GLSurfacelessQtEGL); }; - GLSurfaceQt::~GLSurfaceQt() { } @@ -152,6 +155,7 @@ public: explicit GLSurfaceQtGLX(const gfx::Size& size); static bool InitializeOneOff(); + static bool InitializeExtensionSettingsOneOff(); bool Initialize(GLSurfaceFormat format) override; void Destroy() override; @@ -161,6 +165,7 @@ protected: ~GLSurfaceQtGLX(); private: + static bool s_initialized; XID m_surfaceBuffer; DISALLOW_COPY_AND_ASSIGN(GLSurfaceQtGLX); }; @@ -170,6 +175,9 @@ GLSurfaceQtGLX::~GLSurfaceQtGLX() Destroy(); } + +bool GLSurfaceQtGLX::s_initialized = false; + bool GLSurfaceGLX::IsCreateContextSupported() { return ExtensionsContain(g_extensions, "GLX_ARB_create_context"); @@ -205,6 +213,23 @@ bool GLSurfaceGLX::IsOMLSyncControlSupported() return false; // ExtensionsContain(g_extensions, "GLX_OML_sync_control"); } +bool GLSurfaceQtGLX::InitializeExtensionSettingsOneOff() +{ + if (!s_initialized) + return false; + + Display* display = static_cast<Display*>(g_display); + g_extensions = glXQueryExtensionsString(display, 0); + g_driver_glx.InitializeExtensionBindings(); + + return true; +} + +bool GLSurfaceGLX::InitializeExtensionSettingsOneOff() +{ + return GLSurfaceQtGLX::InitializeExtensionSettingsOneOff(); +} + bool GLSurfaceGLX::HasGLXExtension(const char *name) { return ExtensionsContain(g_extensions, name); @@ -222,8 +247,7 @@ const char* GLSurfaceGLX::GetGLXExtensions() bool GLSurfaceQtGLX::InitializeOneOff() { - static bool initialized = false; - if (initialized) + if (s_initialized) return true; XInitThreads(); @@ -252,8 +276,7 @@ bool GLSurfaceQtGLX::InitializeOneOff() return false; } - g_extensions = glXQueryExtensionsString(display, 0); - initialized = true; + s_initialized = true; return true; } @@ -374,8 +397,7 @@ GLSurfaceQt::GLSurfaceQt() bool GLSurfaceQtEGL::InitializeOneOff() { - static bool initialized = false; - if (initialized) + if (s_initialized) return true; g_display = GLContextHelper::getEGLDisplay(); @@ -390,31 +412,12 @@ bool GLSurfaceQtEGL::InitializeOneOff() return false; } - g_extensions = eglQueryString(g_display, EGL_EXTENSIONS); if (!eglInitialize(g_display, NULL, NULL)) { LOG(ERROR) << "eglInitialize failed with error " << GetLastEGLErrorString(); return false; } - g_egl_surfaceless_context_supported = ExtensionsContain(g_extensions, "EGL_KHR_surfaceless_context"); - if (g_egl_surfaceless_context_supported) { - scoped_refptr<GLSurface> surface = new GLSurfacelessQtEGL(gfx::Size(1, 1)); - gl::GLContextAttribs attribs; - scoped_refptr<GLContext> context = init::CreateGLContext( - NULL, surface.get(), attribs); - - if (!context->MakeCurrent(surface.get())) - g_egl_surfaceless_context_supported = false; - - // Ensure context supports GL_OES_surfaceless_context. - if (g_egl_surfaceless_context_supported) { - g_egl_surfaceless_context_supported = context->HasExtension( - "GL_OES_surfaceless_context"); - context->ReleaseCurrent(surface.get()); - } - } - - initialized = true; + s_initialized = true; return true; } @@ -443,10 +446,57 @@ bool GLSurfaceEGL::IsEGLContextPrioritySupported() return false; } +bool GLSurfaceEGL::IsRobustResourceInitSupported() +{ + return false; +} + +bool GLSurfaceEGL::IsDisplayTextureShareGroupSupported() +{ + return false; +} + +bool GLSurfaceEGL::IsCreateContextClientArraysSupported() +{ + return false; +} + void GLSurfaceEGL::ShutdownOneOff() { } +bool GLSurfaceQtEGL::InitializeExtensionSettingsOneOff() +{ + if (!s_initialized) + return false; + + g_extensions = eglQueryString(g_display, EGL_EXTENSIONS); + g_egl_surfaceless_context_supported = ExtensionsContain(g_extensions, "EGL_KHR_surfaceless_context"); + if (g_egl_surfaceless_context_supported) { + scoped_refptr<GLSurface> surface = new GLSurfacelessQtEGL(gfx::Size(1, 1)); + gl::GLContextAttribs attribs; + scoped_refptr<GLContext> context = init::CreateGLContext( + NULL, surface.get(), attribs); + + if (!context->MakeCurrent(surface.get())) + g_egl_surfaceless_context_supported = false; + + // Ensure context supports GL_OES_surfaceless_context. + if (g_egl_surfaceless_context_supported) { + g_egl_surfaceless_context_supported = context->HasExtension( + "GL_OES_surfaceless_context"); + context->ReleaseCurrent(surface.get()); + } + } + + return true; +} + +bool GLSurfaceEGL::InitializeExtensionSettingsOneOff() +{ + return GLSurfaceQtEGL::InitializeExtensionSettingsOneOff(); +} + const char* GLSurfaceEGL::GetEGLExtensions() { return g_extensions; @@ -546,7 +596,7 @@ GLSurfaceFormat GLSurfaceQt::GetFormat() } -bool GLSurfaceQtEGL::Resize(const gfx::Size& size, float scale_factor, bool has_alpha) +bool GLSurfaceQtEGL::Resize(const gfx::Size& size, float scale_factor, ColorSpace /*color_space*/, bool has_alpha) { if (size == m_size) return true; @@ -606,7 +656,7 @@ bool GLSurfacelessQtEGL::IsSurfaceless() const return true; } -bool GLSurfacelessQtEGL::Resize(const gfx::Size& size, float scale_factor, bool has_alpha) +bool GLSurfacelessQtEGL::Resize(const gfx::Size& size, float scale_factor, ColorSpace color_space, bool has_alpha) { m_size = size; return true; @@ -676,7 +726,7 @@ CreateOffscreenGLSurfaceWithFormat(const gfx::Size& size, GLSurfaceFormat format if (surface->Initialize(format)) return surface; } - // no break + Q_FALLTHROUGH(); #endif } case kGLImplementationEGLGLES2: { diff --git a/src/core/network_delegate_qt.cpp b/src/core/network_delegate_qt.cpp index f82d47fa1..968b3df3f 100644 --- a/src/core/network_delegate_qt.cpp +++ b/src/core/network_delegate_qt.cpp @@ -120,7 +120,7 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, const net::C QWebEngineUrlRequestInfoPrivate *infoPrivate = new QWebEngineUrlRequestInfoPrivate(toQt(resourceType), toQt(navigationType), qUrl, - toQt(request->first_party_for_cookies()), + toQt(request->site_for_cookies()), QByteArray::fromStdString(request->method())); QWebEngineUrlRequestInfo requestInfo(infoPrivate); interceptor->interceptRequest(requestInfo); @@ -238,12 +238,12 @@ bool NetworkDelegateQt::OnCanSetCookie(const net::URLRequest& request, const std::string& cookie_line, net::CookieOptions*) { - return canSetCookies(request.first_party_for_cookies(), request.url(), cookie_line); + return canSetCookies(request.site_for_cookies(), request.url(), cookie_line); } bool NetworkDelegateQt::OnCanGetCookies(const net::URLRequest& request, const net::CookieList&) { - return canGetCookies(request.first_party_for_cookies(), request.url()); + return canGetCookies(request.site_for_cookies(), request.url()); } bool NetworkDelegateQt::canSetCookies(const GURL &first_party, const GURL &url, const std::string &cookie_line) const diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index 5328166d1..95d01dd07 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -67,6 +67,8 @@ BrowserContextAdapter::PermissionType toQt(content::PermissionType type) case content::PermissionType::MIDI: case content::PermissionType::DURABLE_STORAGE: case content::PermissionType::BACKGROUND_SYNC: + case content::PermissionType::SENSORS: + case content::PermissionType::ACCESSIBILITY_EVENTS: case content::PermissionType::NUM: break; } diff --git a/src/core/print_view_manager_base_qt.cpp b/src/core/print_view_manager_base_qt.cpp index cbd8ea03a..5edf9e9a5 100644 --- a/src/core/print_view_manager_base_qt.cpp +++ b/src/core/print_view_manager_base_qt.cpp @@ -171,7 +171,7 @@ void PrintViewManagerBaseQt::OnDidPrintPage( } } - std::unique_ptr<printing::PdfMetafileSkia> metafile(new printing::PdfMetafileSkia(printing::PDF_SKIA_DOCUMENT_TYPE)); + std::unique_ptr<printing::PdfMetafileSkia> metafile(new printing::PdfMetafileSkia(printing::SkiaDocumentType::PDF)); if (metafile_must_be_valid) { if (!metafile->InitFromData(shared_buf->memory(), params.data_size)) { NOTREACHED() << "Invalid metafile header"; @@ -328,7 +328,7 @@ void PrintViewManagerBaseQt::ShouldQuitFromInnerMessageLoop() m_isInsideInnerMessageLoop) { // We are in a message loop created by RenderAllMissingPagesNow. Quit from // it. - base::MessageLoop::current()->QuitWhenIdle(); + base::MessageLoop::current()->QuitWhenIdleClosure(); m_isInsideInnerMessageLoop = false; } } @@ -440,15 +440,15 @@ bool PrintViewManagerBaseQt::RunInnerMessageLoop() { // memory-bound. static const int kPrinterSettingsTimeout = 60000; base::OneShotTimer quit_timer; + base::RunLoop runLoop; quit_timer.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kPrinterSettingsTimeout), - base::MessageLoop::current(), &base::MessageLoop::QuitWhenIdle); + runLoop.QuitWhenIdleClosure()); m_isInsideInnerMessageLoop = true; // Need to enable recursive task. { - base::RunLoop runLoop; m_quitClosure = runLoop.QuitClosure(); base::MessageLoop* loop = base::MessageLoop::current(); base::MessageLoop::ScopedNestableTaskAllower allowNested(loop); diff --git a/src/core/print_view_manager_qt.cpp b/src/core/print_view_manager_qt.cpp index b8df5a131..2e10a6f7d 100644 --- a/src/core/print_view_manager_qt.cpp +++ b/src/core/print_view_manager_qt.cpp @@ -105,7 +105,7 @@ static void SavePdfFile(scoped_refptr<base::RefCountedBytes> data, DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); DCHECK_GT(data->size(), 0U); - printing::PdfMetafileSkia metafile(printing::PDF_SKIA_DOCUMENT_TYPE); + printing::PdfMetafileSkia metafile(printing::SkiaDocumentType::PDF); metafile.InitFromData(static_cast<const void*>(data->front()), data->size()); base::File file(path, diff --git a/src/core/qtwebengine.gni b/src/core/qtwebengine.gni index a86e93f5b..eeaf6c15f 100644 --- a/src/core/qtwebengine.gni +++ b/src/core/qtwebengine.gni @@ -7,6 +7,7 @@ chromium_version = exec_script("//build/util/version.py", [ "-f", rebase_path("/ include_dirs = [ "//skia/config", + "//third_party", "//third_party/skia/include/core" ] @@ -41,7 +42,7 @@ if (enable_widevine) { } if (enable_webrtc) { - deps += [ "//third_party/webrtc/base:base" ] + deps += [ "//third_party/webrtc_overrides" ] } if (is_linux && !is_desktop_linux) { diff --git a/src/core/qtwebengine_resources.gni b/src/core/qtwebengine_resources.gni index 6bff6a9a4..bc86eee7b 100644 --- a/src/core/qtwebengine_resources.gni +++ b/src/core/qtwebengine_resources.gni @@ -44,11 +44,11 @@ repack("qtwebengine_repack_resources_100") { "$root_gen_dir/components/components_resources_100_percent.pak", "$root_gen_dir/content/app/resources/content_resources_100_percent.pak", "$root_gen_dir/chrome/renderer_resources_100_percent.pak", - "$root_gen_dir/blink/public/resources/blink_image_resources_100_percent.pak", + "$root_gen_dir/blink/public/resources/blink_scaled_resources_100_percent.pak", ] output = "$root_out_dir/qtwebengine_resources_100p.pak" deps = [ - "//third_party/WebKit/public:image_resources_grit", + "//third_party/WebKit/public:scaled_resources_100_percent", "//chrome/renderer:resources_grit", "//components/resources:components_scaled_resources_grit", "//content/app/resources:resources_grit", @@ -62,11 +62,11 @@ repack("qtwebengine_repack_resources_200") { "$root_gen_dir/components/components_resources_200_percent.pak", "$root_gen_dir/content/app/resources/content_resources_200_percent.pak", "$root_gen_dir/chrome/renderer_resources_200_percent.pak", - "$root_gen_dir/blink/public/resources/blink_image_resources_200_percent.pak", + "$root_gen_dir/blink/public/resources/blink_scaled_resources_200_percent.pak", ] output = "$root_out_dir/qtwebengine_resources_200p.pak" deps = [ - "//third_party/WebKit/public:image_resources_grit", + "//third_party/WebKit/public:scaled_resources_200_percent", "//chrome/renderer:resources_grit", "//components/resources:components_scaled_resources_grit", "//content/app/resources:resources_grit", diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index f0cd9c088..de9ee63ab 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -67,7 +67,6 @@ #include "third_party/skia/include/core/SkColor.h" #include "third_party/WebKit/public/platform/WebColor.h" #include "third_party/WebKit/public/platform/WebCursorInfo.h" -#include "third_party/WebKit/public/web/WebCompositionUnderline.h" #include "ui/base/clipboard/scoped_clipboard_writer.h" #include "ui/events/blink/blink_event_util.h" #include "ui/events/event.h" @@ -342,8 +341,8 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget , m_wheelAckPending(false) { auto* task_runner = base::ThreadTaskRunnerHandle::Get().get(); - m_beginFrameSource.reset(new cc::DelayBasedBeginFrameSource( - base::MakeUnique<cc::DelayBasedTimeSource>(task_runner))); + m_beginFrameSource.reset(new viz::DelayBasedBeginFrameSource( + base::MakeUnique<viz::DelayBasedTimeSource>(task_runner))); m_host->SetView(this); #ifndef QT_NO_ACCESSIBILITY @@ -353,6 +352,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget content::BrowserAccessibilityStateImpl::GetInstance()->EnableAccessibility(); } #endif // QT_NO_ACCESSIBILITY + if (GetTextInputManager()) GetTextInputManager()->AddObserver(this); @@ -724,7 +724,7 @@ bool RenderWidgetHostViewQt::HasAcceleratedSurface(const gfx::Size&) return false; } -void RenderWidgetHostViewQt::DidCreateNewRendererCompositorFrameSink(cc::mojom::CompositorFrameSinkClient *frameSink) +void RenderWidgetHostViewQt::DidCreateNewRendererCompositorFrameSink(viz::mojom::CompositorFrameSinkClient *frameSink) { // Accumulated resources belong to the old RendererCompositorFrameSink and // should not be returned. @@ -1138,7 +1138,7 @@ void RenderWidgetHostViewQt::ProcessAckedTouchEvent(const content::TouchEventWit void RenderWidgetHostViewQt::sendDelegatedFrameAck() { m_beginFrameSource->DidFinishFrame(this); - std::vector<cc::ReturnedResource> resources; + std::vector<viz::ReturnedResource> resources; m_resourcesToRelease.swap(resources); if (m_rendererCompositorFrameSink) m_rendererCompositorFrameSink->DidReceiveCompositorFrameAck(resources); @@ -1211,7 +1211,7 @@ void RenderWidgetHostViewQt::handleKeyEvent(QKeyEvent *ev) if (ev->type() == QEvent::KeyRelease) { m_receivedEmptyImeText = false; m_host->ImeSetComposition(toString16(ev->text()), - std::vector<ui::CompositionUnderline>(), + std::vector<ui::ImeTextSpan>(), gfx::Range::InvalidRange(), gfx::Range::InvalidRange().start(), gfx::Range::InvalidRange().end()); @@ -1262,7 +1262,7 @@ void RenderWidgetHostViewQt::handleInputMethodEvent(QInputMethodEvent *ev) gfx::Range selectionRange = gfx::Range::InvalidRange(); const QList<QInputMethodEvent::Attribute> &attributes = ev->attributes(); - std::vector<ui::CompositionUnderline> underlines; + std::vector<ui::ImeTextSpan> underlines; bool hasSelection = false; for (const auto &attribute : attributes) { @@ -1287,7 +1287,7 @@ void RenderWidgetHostViewQt::handleInputMethodEvent(QInputMethodEvent *ev) if (format.underlineStyle() != QTextCharFormat::NoUnderline) underlineColor = format.underlineColor(); - underlines.push_back(ui::CompositionUnderline(start, end, toSk(underlineColor), /*thick*/ false, SK_ColorTRANSPARENT)); + underlines.push_back(ui::ImeTextSpan(ui::ImeTextSpan::Type::kComposition, start, end, toSk(underlineColor), /*thick*/ false, SK_ColorTRANSPARENT)); break; } case QInputMethodEvent::Cursor: @@ -1672,7 +1672,7 @@ void RenderWidgetHostViewQt::updateNeedsBeginFramesInternal() m_addedFrameObserver = m_needsBeginFrames; } -bool RenderWidgetHostViewQt::OnBeginFrameDerivedImpl(const cc::BeginFrameArgs& args) +bool RenderWidgetHostViewQt::OnBeginFrameDerivedImpl(const viz::BeginFrameArgs& args) { m_beginFrameSource->OnUpdateVSyncParameters(args.frame_time, args.interval); if (m_rendererCompositorFrameSink) diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index 1ac32456a..16b0aa573 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -43,8 +43,8 @@ #include "render_widget_host_view_qt_delegate.h" #include "base/memory/weak_ptr.h" -#include "cc/scheduler/begin_frame_source.h" -#include "cc/resources/transferable_resource.h" +#include "components/viz/common/frame_sinks/begin_frame_source.h" +#include "components/viz/common/resources/transferable_resource.h" #include "content/browser/accessibility/browser_accessibility_manager.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/browser/renderer_host/text_input_manager.h" @@ -102,7 +102,7 @@ class RenderWidgetHostViewQt , public ui::GestureProviderClient , public RenderWidgetHostViewQtDelegateClient , public base::SupportsWeakPtr<RenderWidgetHostViewQt> - , public cc::BeginFrameObserverBase + , public viz::BeginFrameObserverBase #ifndef QT_NO_ACCESSIBILITY , public QAccessible::ActivationObserver #endif // QT_NO_ACCESSIBILITY @@ -151,7 +151,7 @@ public: void Destroy() override; void SetTooltipText(const base::string16 &tooltip_text) override; bool HasAcceleratedSurface(const gfx::Size&) override; - void DidCreateNewRendererCompositorFrameSink(cc::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) override; + void DidCreateNewRendererCompositorFrameSink(viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) override; void SubmitCompositorFrame(const viz::LocalSurfaceId&, cc::CompositorFrame) override; void WheelEventAck(const blink::WebMouseWheelEvent &event, content::InputEventAckState ack_result) override; @@ -180,7 +180,7 @@ public: void OnTextSelectionChanged(content::TextInputManager *text_input_manager, RenderWidgetHostViewBase *updated_view) override; // cc::BeginFrameObserverBase implementation. - bool OnBeginFrameDerivedImpl(const cc::BeginFrameArgs& args) override; + bool OnBeginFrameDerivedImpl(const viz::BeginFrameArgs& args) override; void OnBeginFrameSourcePausedChanged(bool paused) override; void handleMouseEvent(QMouseEvent*); @@ -243,14 +243,14 @@ private: std::unique_ptr<RenderWidgetHostViewQtDelegate> m_delegate; QExplicitlySharedDataPointer<ChromiumCompositorData> m_chromiumCompositorData; - std::vector<cc::ReturnedResource> m_resourcesToRelease; + std::vector<viz::ReturnedResource> m_resourcesToRelease; bool m_needsDelegatedFrameAck; LoadVisuallyCommittedState m_loadVisuallyCommittedState; QMetaObject::Connection m_adapterClientDestroyedConnection; WebContentsAdapterClient *m_adapterClient; MultipleMouseClickHelper m_clickHelper; - cc::mojom::CompositorFrameSinkClient *m_rendererCompositorFrameSink; + viz::mojom::CompositorFrameSinkClient *m_rendererCompositorFrameSink; bool m_imeInProgress; bool m_receivedEmptyImeText; @@ -258,7 +258,7 @@ private: bool m_initPending; - std::unique_ptr<cc::SyntheticBeginFrameSource> m_beginFrameSource; + std::unique_ptr<viz::SyntheticBeginFrameSource> m_beginFrameSource; bool m_needsBeginFrames; bool m_addedFrameObserver; diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 5980d7b84..a77bcf785 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -49,10 +49,11 @@ #include "components/spellcheck/renderer/spellcheck_provider.h" #endif #include "components/cdm/renderer/widevine_key_system_properties.h" +#include "components/error_page/common/error.h" #include "components/error_page/common/error_page_params.h" #include "components/error_page/common/localized_error.h" #if BUILDFLAG(ENABLE_BASIC_PRINTING) -#include "components/printing/renderer/print_web_view_helper.h" +#include "components/printing/renderer/print_render_frame_helper.h" #endif // if BUILDFLAG(ENABLE_BASIC_PRINTING) #include "components/visitedlink/renderer/visitedlink_slave.h" #include "components/web_cache/renderer/web_cache_impl.h" @@ -136,7 +137,7 @@ void ContentRendererClientQt::RenderFrameCreated(content::RenderFrame* render_fr new SpellCheckProvider(render_frame, m_spellCheck.data()); #endif #if BUILDFLAG(ENABLE_BASIC_PRINTING) - new printing::PrintWebViewHelper( + new printing::PrintRenderFrameHelper( render_frame, base::WrapUnique(new PrintWebViewHelperDelegateQt())); #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) @@ -166,14 +167,13 @@ void ContentRendererClientQt::RunScriptsAtDocumentEnd(content::RenderFrame* rend UserResourceController::instance()->RunScriptsAtDocumentEnd(render_frame); } -bool ContentRendererClientQt::HasErrorPage(int httpStatusCode, std::string *errorDomain) +bool ContentRendererClientQt::HasErrorPage(int httpStatusCode) { // Use an internal error page, if we have one for the status code. - if (!error_page::LocalizedError::HasStrings(error_page::LocalizedError::kHttpErrorDomain, httpStatusCode)) { + if (!error_page::LocalizedError::HasStrings(error_page::Error::kHttpErrorDomain, httpStatusCode)) { return false; } - *errorDomain = error_page::LocalizedError::kHttpErrorDomain; return true; } @@ -182,6 +182,20 @@ bool ContentRendererClientQt::ShouldSuppressErrorPage(content::RenderFrame *fram return !(frame->GetWebkitPreferences().enable_error_page); } +std::string domain2String(blink::WebURLError::Domain domain) +{ + switch (domain) { + case blink::WebURLError::Domain::kEmpty: + return "(null)"; + case blink::WebURLError::Domain::kNet: + return "net"; + case blink::WebURLError::Domain::kTest: + return "testing"; + } + Q_UNREACHABLE(); + return std::string(); +} + // To tap into the chromium localized strings. Ripped from the chrome layer (highly simplified). void ContentRendererClientQt::GetNavigationErrorStrings(content::RenderFrame* renderFrame, const blink::WebURLRequest &failedRequest, const blink::WebURLError &error, std::string *errorHtml, base::string16 *errorDescription) { @@ -196,12 +210,12 @@ void ContentRendererClientQt::GetNavigationErrorStrings(content::RenderFrame* re // TODO(elproxy): We could potentially get better diagnostics here by first calling // NetErrorHelper::GetErrorStringsForDnsProbe, but that one is harder to untangle. - error_page::LocalizedError::GetStrings(error.reason, error.domain.Utf8(), error.unreachable_url, isPost - , error.stale_copy_in_cache && !isPost, false, false, locale - , std::unique_ptr<error_page::ErrorPageParams>(), &errorStrings); + error_page::LocalizedError::GetStrings( + error.reason, domain2String(error.domain), error.unreachable_url, isPost, + error.stale_copy_in_cache, false, false, + locale, std::unique_ptr<error_page::ErrorPageParams>(), &errorStrings); resourceId = IDR_NET_ERROR_HTML; - const base::StringPiece template_html(ui::ResourceBundle::GetSharedInstance().GetRawDataResource(resourceId)); if (template_html.empty()) NOTREACHED() << "unable to load template. ID: " << resourceId; @@ -210,7 +224,7 @@ void ContentRendererClientQt::GetNavigationErrorStrings(content::RenderFrame* re } if (errorDescription) - *errorDescription = error_page::LocalizedError::GetErrorDetails(error.domain.Utf8(), error.reason, isPost); + *errorDescription = error_page::LocalizedError::GetErrorDetails(domain2String(error.domain), error.reason, isPost); } unsigned long long ContentRendererClientQt::VisitedLinkHash(const char *canonicalUrl, size_t length) @@ -228,7 +242,7 @@ bool ContentRendererClientQt::IsLinkVisited(unsigned long long linkHash) // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE.Chromium file. -#if BUILDFLAG(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) static const char kExternalClearKeyPepperType[] = "application/x-ppapi-clearkey-cdm"; static bool IsPepperCdmAvailable(const std::string& pepper_type, @@ -410,7 +424,7 @@ static void AddPepperBasedWidevine(std::vector<std::unique_ptr<media::KeySystemP void ContentRendererClientQt::AddSupportedKeySystems(std::vector<std::unique_ptr<media::KeySystemProperties>> *key_systems) { -#if BUILDFLAG(ENABLE_PEPPER_CDMS) +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) AddExternalClearKey(key_systems); #if defined(WIDEVINE_CDM_AVAILABLE) diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h index 45ad2e872..18cf129c2 100644 --- a/src/core/renderer/content_renderer_client_qt.h +++ b/src/core/renderer/content_renderer_client_qt.h @@ -66,7 +66,7 @@ public: void RenderViewCreated(content::RenderView *render_view) override; void RenderFrameCreated(content::RenderFrame* render_frame) override; bool ShouldSuppressErrorPage(content::RenderFrame *, const GURL &) override; - bool HasErrorPage(int httpStatusCode, std::string *errorDomain) override; + bool HasErrorPage(int http_status_code) override; void GetNavigationErrorStrings(content::RenderFrame* renderFrame, const blink::WebURLRequest& failedRequest, const blink::WebURLError& error, std::string* errorHtml, base::string16* errorDescription) override; diff --git a/src/core/renderer/print_web_view_helper_delegate_qt.h b/src/core/renderer/print_web_view_helper_delegate_qt.h index 68e515d4d..e3020922f 100644 --- a/src/core/renderer/print_web_view_helper_delegate_qt.h +++ b/src/core/renderer/print_web_view_helper_delegate_qt.h @@ -44,7 +44,7 @@ #ifndef PRINT_WEB_VIEW_HELPER_DELEGATE_QT_H #define PRINT_WEB_VIEW_HELPER_DELEGATE_QT_H -#include "components/printing/renderer/print_web_view_helper.h" +#include "components/printing/renderer/print_render_frame_helper.h" namespace content { class RenderView; @@ -52,7 +52,7 @@ class RenderView; namespace QtWebEngineCore { -class PrintWebViewHelperDelegateQt : public printing::PrintWebViewHelper::Delegate +class PrintWebViewHelperDelegateQt : public printing::PrintRenderFrameHelper::Delegate { public: ~PrintWebViewHelperDelegateQt() override; diff --git a/src/core/renderer/user_resource_controller.cpp b/src/core/renderer/user_resource_controller.cpp index f85879053..bae1d95dc 100644 --- a/src/core/renderer/user_resource_controller.cpp +++ b/src/core/renderer/user_resource_controller.cpp @@ -110,7 +110,7 @@ private: // RenderFrameObserver implementation. void DidFinishDocumentLoad() override; void DidFinishLoad() override; - void DidStartProvisionalLoad(blink::WebDataSource* data_source) override; + void DidStartProvisionalLoad(blink::WebDocumentLoader *document_loader) override; void FrameDetached() override; void OnDestruct() override; bool OnMessageReceived(const IPC::Message& message) override; @@ -217,9 +217,9 @@ void UserResourceController::RenderFrameObserverHelper::DidFinishLoad() m_weakPtrFactory.GetWeakPtr(), UserScriptData::AfterLoad, frame)); } -void UserResourceController::RenderFrameObserverHelper::DidStartProvisionalLoad(blink::WebDataSource *data_source) +void UserResourceController::RenderFrameObserverHelper::DidStartProvisionalLoad(blink::WebDocumentLoader *document_loader) { - Q_UNUSED(data_source); + Q_UNUSED(document_loader); blink::WebLocalFrame *frame = render_frame()->GetWebFrame(); m_pendingFrames.remove(frame); } diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp index 22d626e96..aeeb328dc 100644 --- a/src/core/url_request_context_getter_qt.cpp +++ b/src/core/url_request_context_getter_qt.cpp @@ -312,47 +312,44 @@ void URLRequestContextGetterQt::generateCookieStore() new net::DefaultChannelIDStore(channel_id_db.get())))); // Unset it first to get a chance to destroy and flush the old cookie store before opening a new on possibly the same file. - m_storage->set_cookie_store(0); m_cookieDelegate->setCookieMonster(0); + m_storage->set_cookie_store(0); std::unique_ptr<net::CookieStore> cookieStore; switch (m_persistentCookiesPolicy) { case BrowserContextAdapter::NoPersistentCookies: - cookieStore = - content::CreateCookieStore(content::CookieStoreConfig( + cookieStore = content::CreateCookieStore( + content::CookieStoreConfig( base::FilePath(), content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, - NULL, - m_cookieDelegate.get()) - ); + nullptr) + ); break; case BrowserContextAdapter::AllowPersistentCookies: - cookieStore = - content::CreateCookieStore(content::CookieStoreConfig( + cookieStore = content::CreateCookieStore( + content::CookieStoreConfig( toFilePath(m_cookiesPath), content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES, - NULL, - m_cookieDelegate.get()) + nullptr) ); break; case BrowserContextAdapter::ForcePersistentCookies: - cookieStore = - content::CreateCookieStore(content::CookieStoreConfig( + cookieStore = content::CreateCookieStore( + content::CookieStoreConfig( toFilePath(m_cookiesPath), content::CookieStoreConfig::RESTORED_SESSION_COOKIES, - NULL, - m_cookieDelegate.get()) + nullptr) ); break; } net::CookieMonster * const cookieMonster = static_cast<net::CookieMonster*>(cookieStore.get()); cookieStore->SetChannelIDServiceID(m_urlRequestContext->channel_id_service()->GetUniqueID()); + m_cookieDelegate->setCookieMonster(cookieMonster); m_storage->set_cookie_store(std::move(cookieStore)); const std::vector<std::string> cookieableSchemes(kCookieableSchemes, kCookieableSchemes + arraysize(kCookieableSchemes)); cookieMonster->SetCookieableSchemes(cookieableSchemes); - m_cookieDelegate->setCookieMonster(cookieMonster); if (!m_updateAllStorage && m_updateHttpCache) { // HttpCache needs to be regenerated when we generate a new channel id service @@ -509,8 +506,7 @@ void URLRequestContextGetterQt::generateHttpCache() net::MEMORY_CACHE, net::CACHE_BACKEND_DEFAULT, base::FilePath(), - m_httpCacheMaxSize, - BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE) + m_httpCacheMaxSize ); break; case BrowserContextAdapter::DiskHttpCache: @@ -519,8 +515,7 @@ void URLRequestContextGetterQt::generateHttpCache() net::DISK_CACHE, net::CACHE_BACKEND_DEFAULT, toFilePath(m_httpCachePath), - m_httpCacheMaxSize, - BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE) + m_httpCacheMaxSize ); break; case BrowserContextAdapter::NoCache: diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 668e791c1..286856c71 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -884,6 +884,8 @@ QAccessibleInterface *WebContentsAdapter::browserAccessible() content::RenderViewHost *rvh = d->webContents->GetRenderViewHost(); Q_ASSERT(rvh); content::BrowserAccessibilityManager *manager = static_cast<content::RenderFrameHostImpl*>(rvh->GetMainFrame())->GetOrCreateBrowserAccessibilityManager(); + if (!manager) // FIXME! + return nullptr; content::BrowserAccessibility *acc = manager->GetRoot(); content::BrowserAccessibilityQt *accQt = static_cast<content::BrowserAccessibilityQt*>(acc); return accQt; diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 7b765d99b..51ea7eda3 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -295,9 +295,8 @@ void WebContentsDelegateQt::didFailLoad(const QUrl &url, int errorCode, const QS EmitLoadFinished(false /* success */ , url, false /* isErrorPage */, errorCode, errorDescription); } -void WebContentsDelegateQt::DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code, const base::string16& error_description, bool was_ignored_by_handler) +void WebContentsDelegateQt::DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code, const base::string16& error_description) { - Q_UNUSED(was_ignored_by_handler); if (render_frame_host->GetParent()) return; diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index c056d36ab..7e21e4b55 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -133,8 +133,7 @@ public: void RenderFrameDeleted(content::RenderFrameHost *render_frame_host) override; void DidStartNavigation(content::NavigationHandle *navigation_handle) override; void DidFinishNavigation(content::NavigationHandle *navigation_handle) override; - void DidFailLoad(content::RenderFrameHost *render_frame_host, const GURL &validated_url, - int error_code, const base::string16 &error_description, bool was_ignored_by_handler) override; + void DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code, const base::string16& error_description) override; void DidFinishLoad(content::RenderFrameHost *render_frame_host, const GURL &validated_url) override; void BeforeUnloadFired(const base::TimeTicks& proceed_time) override; void DidUpdateFaviconURL(const std::vector<content::FaviconURL> &candidates) override; diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 84f6ce738..64e608b1f 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -377,6 +377,8 @@ WebEngineContext::WebEngineContext() // upstream Chromium commit ba52f56207a4b9d70b34880fbff2352e71a06422. parsedCommandLine->AppendSwitchASCII(switches::kEnableFeatures, features::kAllowContentInitiatedDataUrlNavigations.name); + // If the renderer renders the validation messages, we no longer get the callbacks we have in the API. + parsedCommandLine->AppendSwitchASCII(switches::kDisableBlinkFeatures, "ValidationBubbleInRenderer"); if (useEmbeddedSwitches) { parsedCommandLine->AppendSwitchASCII(switches::kEnableFeatures, features::kOverlayScrollbar.name); @@ -464,8 +466,9 @@ WebEngineContext::WebEngineContext() } } - if (qt_gl_global_share_context()->format().profile() == QSurfaceFormat::CompatibilityProfile) - parsedCommandLine->AppendSwitch(switches::kCreateDefaultGLContext); +// FIXME: +// if (qt_gl_global_share_context()->format().profile() == QSurfaceFormat::CompatibilityProfile) +// parsedCommandLine->AppendSwitch(switches::kCreateDefaultGLContext); } else { qWarning("WebEngineContext used before QtWebEngine::initialize() or OpenGL context creation failed."); } |