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

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

Issue 858093002: Update the network service from the Mojo repo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « mojo/services/network/network_context.h ('k') | mojo/services/network/network_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/network/network_context.cc
diff --git a/mojo/services/network/network_context.cc b/mojo/services/network/network_context.cc
index 0f94ebdec7a7a50260391d5526936fb65b1db15f..b2a965fa5ab65220fc1837d5800f7f1631cfd4d8 100644
--- a/mojo/services/network/network_context.cc
+++ b/mojo/services/network/network_context.cc
@@ -5,13 +5,29 @@
#include "mojo/services/network/network_context.h"
#include "base/base_paths.h"
+#include "base/path_service.h"
#include "net/proxy/proxy_service.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_builder.h"
namespace mojo {
-NetworkContext::NetworkContext(const base::FilePath& base_path) {
+NetworkContext::NetworkContext(
+ scoped_ptr<net::URLRequestContext> url_request_context)
+ : url_request_context_(url_request_context.Pass()) {
+}
+
+NetworkContext::NetworkContext(const base::FilePath& base_path)
+ : NetworkContext(MakeURLRequestContext(base_path)) {
+}
+
+NetworkContext::~NetworkContext() {
+ // TODO(darin): Be careful about destruction order of member variables?
+}
+
+// static
+scoped_ptr<net::URLRequestContext> NetworkContext::MakeURLRequestContext(
+ const base::FilePath& base_path) {
net::URLRequestContextBuilder builder;
builder.set_accept_language("en-us,en");
// TODO(darin): This is surely the wrong UA string.
@@ -29,11 +45,7 @@ NetworkContext::NetworkContext(const base::FilePath& base_path) {
builder.set_file_enabled(true);
- url_request_context_.reset(builder.Build());
-}
-
-NetworkContext::~NetworkContext() {
- // TODO(darin): Be careful about destruction order of member variables?
+ return make_scoped_ptr(builder.Build());
}
} // namespace mojo
« no previous file with comments | « mojo/services/network/network_context.h ('k') | mojo/services/network/network_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698