summaryrefslogtreecommitdiffstats
path: root/src/core/browser_context_qt.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-11-07 17:07:48 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2014-11-07 17:17:55 +0100
commitf343e9d69a9aa8d64fe61725cf17c824f8f2d703 (patch)
treeb6ca22d2d475751c600fcf07ad16a858df8014dc /src/core/browser_context_qt.cpp
parentd2d5baeb8c3b10579f7f144e918b2935af66bec5 (diff)
Cache to QStandardPaths::CacheLocation
We should save our cache in the configured CacheLocation, and ensure we are prepared for multiple BrowserContext by caching to a Default subdir. This matches how chromium caches on linux. Change-Id: Ibe914fca35435ea1658565be87747cfabc71e97b Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'src/core/browser_context_qt.cpp')
-rw-r--r--src/core/browser_context_qt.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/core/browser_context_qt.cpp b/src/core/browser_context_qt.cpp
index 3913b7548..44b6ca4ef 100644
--- a/src/core/browser_context_qt.cpp
+++ b/src/core/browser_context_qt.cpp
@@ -72,9 +72,21 @@ base::FilePath BrowserContextQt::GetPath() const
dataLocation = QDir::homePath() % QDir::separator() % QChar::fromLatin1('.') % QCoreApplication::applicationName();
dataLocation.append(QDir::separator() % QLatin1String("QtWebEngine"));
+ dataLocation.append(QDir::separator() % QLatin1String("Default"));
return base::FilePath(toFilePathString(dataLocation));
}
+base::FilePath BrowserContextQt::GetCachePath() const
+{
+ QString cacheLocation = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
+ if (cacheLocation.isEmpty())
+ cacheLocation = QDir::homePath() % QDir::separator() % QChar::fromLatin1('.') % QCoreApplication::applicationName();
+
+ cacheLocation.append(QDir::separator() % QLatin1String("QtWebEngine"));
+ cacheLocation.append(QDir::separator() % QLatin1String("Default"));
+ return base::FilePath(toFilePathString(cacheLocation));
+}
+
bool BrowserContextQt::IsOffTheRecord() const
{
return false;
@@ -133,7 +145,7 @@ content::PushMessagingService *BrowserContextQt::GetPushMessagingService()
net::URLRequestContextGetter *BrowserContextQt::CreateRequestContext(content::ProtocolHandlerMap *protocol_handlers)
{
- url_request_getter_ = new URLRequestContextGetterQt(GetPath(), protocol_handlers);
+ url_request_getter_ = new URLRequestContextGetterQt(GetPath(), GetCachePath(), protocol_handlers);
static_cast<ResourceContextQt*>(resourceContext.get())->set_url_request_context_getter(url_request_getter_.get());
return url_request_getter_.get();
}