summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2013-11-22 18:52:20 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-26 13:34:49 +0100
commit9362404ac152a4fa874c8af4c5436bdca9ba7329 (patch)
tree653bae2cfefba134675324f79a890056badacac2
parent3c4ccfaa280a3fe4a737b8c585ce441849dfae3b (diff)
Save cookies.
Create an instance of the default sqlite cookie store and set it on the URLRequestContextStorage. Change-Id: I657ed947962bbfaa7369db0b4ce5cad22ee7de7f Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
-rw-r--r--lib/url_request_context_getter_qt.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/url_request_context_getter_qt.cpp b/lib/url_request_context_getter_qt.cpp
index f12eb6305..99bf68b1c 100644
--- a/lib/url_request_context_getter_qt.cpp
+++ b/lib/url_request_context_getter_qt.cpp
@@ -44,9 +44,9 @@
#include "base/strings/string_util.h"
#include "base/threading/worker_pool.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/cookie_store_factory.h"
#include "net/base/cache_type.h"
#include "net/cert/cert_verifier.h"
-#include "net/cookies/cookie_monster.h"
#include "net/dns/host_resolver.h"
#include "net/dns/mapped_host_resolver.h"
#include "net/http/http_auth_handler_factory.h"
@@ -88,8 +88,13 @@ net::URLRequestContext *URLRequestContextGetterQt::GetURLRequestContext()
m_networkDelegate.reset(new NetworkDelegateQt);
m_urlRequestContext->set_network_delegate(m_networkDelegate.get());
+
+ base::FilePath cookiesPath = m_basePath.Append(FILE_PATH_LITERAL("Cookies"));
+ scoped_refptr<net::CookieStore> cookieStore = content::CreatePersistentCookieStore(cookiesPath, true, NULL, NULL);
+ cookieStore->GetCookieMonster()->SetPersistSessionCookies(true);
+
m_storage.reset(new net::URLRequestContextStorage(m_urlRequestContext.get()));
- m_storage->set_cookie_store(new net::CookieMonster(NULL, NULL));
+ m_storage->set_cookie_store(cookieStore.get());
m_storage->set_server_bound_cert_service(new net::ServerBoundCertService(
new net::DefaultServerBoundCertStore(NULL),
base::WorkerPool::GetTaskRunner(true)));