1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Correctly create off-the-record profile for private browsing

This commit is contained in:
David Rosca 2015-05-24 17:29:41 +02:00
parent a601223d15
commit 6da67fc53d
3 changed files with 13 additions and 3 deletions

View File

@ -88,6 +88,7 @@ MainApplication::MainApplication(int &argc, char** argv)
, m_searchEnginesManager(0)
, m_html5PermissionsManager(0)
, m_desktopNotifications(0)
, m_webProfile(0)
, m_autoSaver(0)
, m_proxyStyle(0)
, m_lastActiveWindow(0)
@ -576,6 +577,14 @@ DesktopNotificationsFactory* MainApplication::desktopNotifications()
return m_desktopNotifications;
}
QWebEngineProfile *MainApplication::webProfile()
{
if (!m_webProfile) {
m_webProfile = m_isPrivate ? new QWebEngineProfile(this) : QWebEngineProfile::defaultProfile();
}
return m_webProfile;
}
// static
MainApplication* MainApplication::instance()
{
@ -891,8 +900,6 @@ void MainApplication::loadSettings()
#if QTWEBENGINE_DISABLED
webSettings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
#endif
profile->setHttpCacheType(QWebEngineProfile::MemoryHttpCache);
profile->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
history()->setSaving(false);
}

View File

@ -27,6 +27,7 @@
#include "qzcommon.h"
class QMenu;
class QWebEngineProfile;
class QNetworkAccessManager;
class History;
@ -97,6 +98,7 @@ public:
SearchEnginesManager* searchEnginesManager();
HTML5PermissionsManager* html5PermissionsManager();
DesktopNotificationsFactory* desktopNotifications();
QWebEngineProfile* webProfile();
static MainApplication* instance();
@ -161,6 +163,7 @@ private:
SearchEnginesManager* m_searchEnginesManager;
HTML5PermissionsManager* m_html5PermissionsManager;
DesktopNotificationsFactory* m_desktopNotifications;
QWebEngineProfile* m_webProfile;
AutoSaver* m_autoSaver;
ProxyStyle* m_proxyStyle;

View File

@ -71,7 +71,7 @@ QTime WebPage::s_lastUnsupportedUrlTime;
QList<WebPage*> WebPage::s_livingPages;
WebPage::WebPage(QObject* parent)
: QWebEnginePage(parent)
: QWebEnginePage(mApp->webProfile(), parent)
, m_view(0)
, m_fileWatcher(0)
, m_runningLoop(0)