From 65909d55417c78e88308644dea30a65fae2d9c4a Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 15 Feb 2019 11:30:19 +0100 Subject: Remove hack with passing WebContentsAdapterClient as NativeView MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead delay creating our render view just a little bit further in WebContentImpl::OpenWindow until it calls delegate->WebContentsCreated() Change-Id: Idd911d208bbfe419a2567220933eccb2ba726347 Reviewed-by: Jüri Valdmann --- src/core/web_contents_adapter.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/core/web_contents_adapter.cpp') diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index fe31a5b51..607412e16 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -240,9 +240,13 @@ static std::unique_ptr createBlankWebContents(WebContentsA content::WebContents::CreateParams create_params(browserContext, NULL); create_params.routing_id = MSG_ROUTING_NONE; create_params.initial_size = gfx::Size(kTestWindowWidth, kTestWindowHeight); - create_params.context = reinterpret_cast(adapterClient); create_params.initially_hidden = true; - return content::WebContents::Create(create_params); + + std::unique_ptr webContents = content::WebContents::Create(create_params); + WebContentsViewQt* contentsView = static_cast(static_cast(webContents.get())->GetView()); + contentsView->setClient(adapterClient); + + return webContents; } static void serializeNavigationHistory(const content::NavigationController &controller, QDataStream &output) @@ -468,7 +472,6 @@ void WebContentsAdapter::initialize(content::SiteInstance *site) if (!m_webContents) { content::WebContents::CreateParams create_params(m_profileAdapter->profile(), site); create_params.initial_size = gfx::Size(kTestWindowWidth, kTestWindowHeight); - create_params.context = reinterpret_cast(m_adapterClient); create_params.initially_hidden = true; m_webContents = content::WebContents::Create(create_params); } @@ -506,7 +509,7 @@ void WebContentsAdapter::initialize(content::SiteInstance *site) // Let the WebContent's view know about the WebContentsAdapterClient. WebContentsViewQt* contentsView = static_cast(static_cast(m_webContents.get())->GetView()); - contentsView->initialize(m_adapterClient); + contentsView->setClient(m_adapterClient); // This should only be necessary after having restored the history to a new WebContentsAdapter. m_webContents->GetController().LoadIfNecessary(); -- cgit v1.2.3