diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-23 18:26:28 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-09-22 08:47:19 +0000 |
commit | c0419ae89fbc4fbdc58aef5b8b01ab0b45f8ff98 (patch) | |
tree | d0bdc1f0ef144bb63ed75b8e6fcfb6f039628210 /src/core/web_contents_adapter.cpp | |
parent | 1e89fa4226be870d97d3b21c6c7087886c81bbc5 (diff) |
Adaptations for Chromium 68
Together-with: Tamas Zakor<ztamas@inf.u-szeged.hu>
Change-Id: I805246b6f01cb151fff48588744408c676d87c14
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'src/core/web_contents_adapter.cpp')
-rw-r--r-- | src/core/web_contents_adapter.cpp | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 2e3f3785a..8ea7187d4 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -222,7 +222,7 @@ static void callbackOnPdfSavingFinished(WebContentsAdapterClient *adapterClient, } #endif -static content::WebContents *createBlankWebContents(WebContentsAdapterClient *adapterClient, content::BrowserContext *browserContext) +static std::unique_ptr<content::WebContents> createBlankWebContents(WebContentsAdapterClient *adapterClient, content::BrowserContext *browserContext) { content::WebContents::CreateParams create_params(browserContext, NULL); create_params.routing_id = MSG_ROUTING_NONE; @@ -323,7 +323,8 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex, false, // The extra headers are not sync'ed across sessions. std::string(), - browserContext); + browserContext, + nullptr); entry->SetTitle(toString16(title)); entry->SetPageState(content::PageState::CreateFromEncodedData(std::string(pageState.data(), pageState.size()))); @@ -370,7 +371,7 @@ QSharedPointer<WebContentsAdapter> WebContentsAdapter::createFromSerializedNavig return QSharedPointer<WebContentsAdapter>(); // Unlike WebCore, Chromium only supports Restoring to a new WebContents instance. - content::WebContents* newWebContents = createBlankWebContents(adapterClient, adapterClient->profileAdapter()->profile()); + std::unique_ptr<content::WebContents> newWebContents = createBlankWebContents(adapterClient, adapterClient->profileAdapter()->profile()); content::NavigationController &controller = newWebContents->GetController(); controller.Restore(currentIndex, content::RestoreType::LAST_SESSION_EXITED_CLEANLY, &entries); @@ -385,12 +386,29 @@ QSharedPointer<WebContentsAdapter> WebContentsAdapter::createFromSerializedNavig content::ChildProcessSecurityPolicy::GetInstance()->GrantReadFile(id, *file); } - return QSharedPointer<WebContentsAdapter>::create(newWebContents); + return QSharedPointer<WebContentsAdapter>::create(std::move(newWebContents)); } -WebContentsAdapter::WebContentsAdapter(content::WebContents *webContents) +WebContentsAdapter::WebContentsAdapter() : m_profileAdapter(nullptr) - , m_webContents(webContents) + , m_webContents(nullptr) +#if QT_CONFIG(webengine_webchannel) + , m_webChannel(nullptr) + , m_webChannelWorld(0) +#endif + , m_adapterClient(nullptr) + , m_nextRequestId(CallbackDirectory::ReservedCallbackIdsEnd) + , m_lastFindRequestId(0) + , m_currentDropAction(blink::kWebDragOperationNone) + , m_devToolsFrontend(nullptr) +{ + // This has to be the first thing we create, and the last we destroy. + WebEngineContext::current(); +} + +WebContentsAdapter::WebContentsAdapter(std::unique_ptr<content::WebContents> webContents) + : m_profileAdapter(nullptr) + , m_webContents(std::move(webContents)) #if QT_CONFIG(webengine_webchannel) , m_webChannel(nullptr) , m_webChannelWorld(0) @@ -439,7 +457,7 @@ void WebContentsAdapter::initialize(content::SiteInstance *site) create_params.initial_size = gfx::Size(kTestWindowWidth, kTestWindowHeight); create_params.context = reinterpret_cast<gfx::NativeView>(m_adapterClient); create_params.initially_hidden = true; - m_webContents.reset(content::WebContents::Create(create_params)); + m_webContents = content::WebContents::Create(create_params); } content::RendererPreferences* rendererPrefs = m_webContents->GetMutableRendererPrefs(); @@ -1375,7 +1393,7 @@ void WebContentsAdapter::startDragging(QObject *dragSource, const content::DropD } { - base::MessageLoop::ScopedNestableTaskAllower allow(base::MessageLoop::current()); + base::MessageLoop::ScopedNestableTaskAllower allow; drag->exec(allowedActions); } |