diff options
author | Michal Klocek <michal.klocek@qt.io> | 2021-06-02 19:40:10 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2021-06-25 01:33:45 +0200 |
commit | d0ff107c0096fa0e0347ddadda9a98438d27631e (patch) | |
tree | c11519ed00eeff9092c83401b2b337a507aa9815 /examples | |
parent | a5e627160cf9a05ce0dd92e541d44b1861eb84c0 (diff) | |
download | qtwebengine-d0ff107c0096fa0e0347ddadda9a98438d27631e.tar.gz |
Make default profile off the record
Make default profile otr, this prevents accessing
data cache which could be created by older other
version of Chromium. Allow to register a protocol
handler on ort profile.
[ChangeLog][QtWebEngineCore] Default profile is off-the-record
Off-the-record profile can have registered protocol handlers.
Task-number: QTBUG-66068
Pick-to: 6.2
Change-Id: Ief202de5c6734d293cb64d83ad447b1eba19e9a4
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/webenginewidgets/simplebrowser/browser.cpp | 12 | ||||
-rw-r--r-- | examples/webenginewidgets/simplebrowser/browser.h | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/examples/webenginewidgets/simplebrowser/browser.cpp b/examples/webenginewidgets/simplebrowser/browser.cpp index 68458b2a4..f5f7e6fc1 100644 --- a/examples/webenginewidgets/simplebrowser/browser.cpp +++ b/examples/webenginewidgets/simplebrowser/browser.cpp @@ -63,13 +63,13 @@ Browser::Browser() BrowserWindow *Browser::createWindow(bool offTheRecord) { - if (offTheRecord && !m_otrProfile) { - m_otrProfile.reset(new QWebEngineProfile); - QObject::connect( - m_otrProfile.get(), &QWebEngineProfile::downloadRequested, - &m_downloadManagerWidget, &DownloadManagerWidget::downloadRequested); + if (!offTheRecord && !m_profile) { + m_profile.reset(new QWebEngineProfile( + QString::fromLatin1("simplebrowser.%1").arg(qWebEngineChromiumVersion()))); + QObject::connect(m_profile.get(), &QWebEngineProfile::downloadRequested, + &m_downloadManagerWidget, &DownloadManagerWidget::downloadRequested); } - auto profile = offTheRecord ? m_otrProfile.get() : QWebEngineProfile::defaultProfile(); + auto profile = !offTheRecord ? m_profile.get() : QWebEngineProfile::defaultProfile(); auto mainWindow = new BrowserWindow(this, profile, false); m_windows.append(mainWindow); QObject::connect(mainWindow, &QObject::destroyed, [this, mainWindow]() { diff --git a/examples/webenginewidgets/simplebrowser/browser.h b/examples/webenginewidgets/simplebrowser/browser.h index cb84ea670..2296eda9a 100644 --- a/examples/webenginewidgets/simplebrowser/browser.h +++ b/examples/webenginewidgets/simplebrowser/browser.h @@ -73,6 +73,6 @@ public: private: QList<BrowserWindow*> m_windows; DownloadManagerWidget m_downloadManagerWidget; - QScopedPointer<QWebEngineProfile> m_otrProfile; + QScopedPointer<QWebEngineProfile> m_profile; }; #endif // BROWSER_H |