Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Unified Diff: mojo/services/network/network_context.cc

Issue 1179413010: mandoline filesystem: Save cookie data to the mojo:filesystem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sqlite-fs
Patch Set: Maybe this time. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/services/network/network_context.cc
diff --git a/mojo/services/network/network_context.cc b/mojo/services/network/network_context.cc
index 32248eafa475062706c7f4119f4202e647465fae..3e85400854f0e07a6ac6f8feb9f5adf9dd93cc9a 100644
--- a/mojo/services/network/network_context.cc
+++ b/mojo/services/network/network_context.cc
@@ -13,9 +13,12 @@
#include "base/path_service.h"
#include "mojo/common/user_agent.h"
#include "mojo/services/network/url_loader_impl.h"
+#include "net/cookies/cookie_monster.h"
+#include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
#include "net/log/net_log_util.h"
#include "net/log/write_to_file_net_log_observer.h"
#include "net/proxy/proxy_service.h"
+#include "net/ssl/channel_id_service.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_builder.h"
@@ -24,7 +27,7 @@ namespace mojo {
namespace {
// Logs network information to the specified file.
const char kLogNetLog[] = "log-net-log";
-}
+} // namespace
class NetworkContext::MojoNetLog : public net::NetLog {
public:
@@ -72,8 +75,10 @@ NetworkContext::NetworkContext(
url_request_context_->set_net_log(net_log_.get());
}
-NetworkContext::NetworkContext(const base::FilePath& base_path)
- : NetworkContext(MakeURLRequestContext(base_path)) {
+NetworkContext::NetworkContext(
+ const base::FilePath& base_path,
+ const scoped_refptr<base::SequencedTaskRunner>& background_task_runner)
+ : NetworkContext(MakeURLRequestContext(base_path, background_task_runner)) {
}
NetworkContext::~NetworkContext() {
@@ -107,7 +112,8 @@ size_t NetworkContext::GetURLLoaderCountForTesting() {
// static
scoped_ptr<net::URLRequestContext> NetworkContext::MakeURLRequestContext(
- const base::FilePath& base_path) {
+ const base::FilePath& base_path,
+ const scoped_refptr<base::SequencedTaskRunner>& background_task_runner) {
net::URLRequestContextBuilder builder;
builder.set_accept_language("en-us,en");
builder.set_user_agent(mojo::common::GetUserAgent());
@@ -130,6 +136,18 @@ scoped_ptr<net::URLRequestContext> NetworkContext::MakeURLRequestContext(
builder.EnableHttpCache(cache_params);
builder.set_file_enabled(true);
+ // TODO: The rest of these things need to be filled out. I need the various
+ // task runners. I need to figure out |config| members.
+ net::SQLitePersistentCookieStore* sqlite_store =
+ new net::SQLitePersistentCookieStore(
+ base::FilePath(FILE_PATH_LITERAL("Cookies")),
+ base::MessageLoop::current()->task_runner(),
+ background_task_runner,
+ false, // TODO(erg): Make RESTORED_SESSION_COOKIES configurable.
+ nullptr);
+ builder.SetCookieAndChannelIdStores(
+ new net::CookieMonster(sqlite_store, nullptr) , nullptr);
+
return make_scoped_ptr(builder.Build());
}

Powered by Google App Engine
This is Rietveld 408576698