OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/network/network_context.h" | 5 #include "content/network/network_context.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "content/network/cache_url_loader.h" | 10 #include "content/network/cache_url_loader.h" |
11 #include "content/network/network_service_url_loader_factory_impl.h" | 11 #include "content/network/network_service_url_loader_factory_impl.h" |
12 #include "content/network/url_loader_impl.h" | 12 #include "content/network/url_loader_impl.h" |
13 #include "content/public/common/content_client.h" | 13 #include "content/public/common/content_client.h" |
14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
15 #include "net/dns/host_resolver.h" | 15 #include "net/dns/host_resolver.h" |
16 #include "net/dns/mapped_host_resolver.h" | 16 #include "net/dns/mapped_host_resolver.h" |
| 17 #include "net/http/http_network_session.h" |
17 #include "net/proxy/proxy_config.h" | 18 #include "net/proxy/proxy_config.h" |
18 #include "net/proxy/proxy_config_service_fixed.h" | 19 #include "net/proxy/proxy_config_service_fixed.h" |
19 #include "net/url_request/url_request_context.h" | 20 #include "net/url_request/url_request_context.h" |
20 #include "net/url_request/url_request_context_builder.h" | 21 #include "net/url_request/url_request_context_builder.h" |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 std::unique_ptr<net::URLRequestContext> MakeURLRequestContext() { | 27 std::unique_ptr<net::URLRequestContext> MakeURLRequestContext() { |
27 net::URLRequestContextBuilder builder; | 28 net::URLRequestContextBuilder builder; |
28 net::URLRequestContextBuilder::HttpNetworkSessionParams params; | 29 net::HttpNetworkSession::Params params; |
29 const base::CommandLine* command_line = | 30 const base::CommandLine* command_line = |
30 base::CommandLine::ForCurrentProcess(); | 31 base::CommandLine::ForCurrentProcess(); |
31 if (command_line->HasSwitch(switches::kIgnoreCertificateErrors)) | 32 if (command_line->HasSwitch(switches::kIgnoreCertificateErrors)) |
32 params.ignore_certificate_errors = true; | 33 params.ignore_certificate_errors = true; |
33 | 34 |
34 if (command_line->HasSwitch(switches::kTestingFixedHttpPort)) { | 35 if (command_line->HasSwitch(switches::kTestingFixedHttpPort)) { |
35 int value; | 36 int value; |
36 base::StringToInt( | 37 base::StringToInt( |
37 command_line->GetSwitchValueASCII(switches::kTestingFixedHttpPort), | 38 command_line->GetSwitchValueASCII(switches::kTestingFixedHttpPort), |
38 &value); | 39 &value); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 mojom::URLLoaderClientPtr client) { | 130 mojom::URLLoaderClientPtr client) { |
130 StartCacheURLLoader(url, url_request_context_.get(), std::move(client)); | 131 StartCacheURLLoader(url, url_request_context_.get(), std::move(client)); |
131 } | 132 } |
132 | 133 |
133 NetworkContext::NetworkContext() | 134 NetworkContext::NetworkContext() |
134 : url_request_context_(MakeURLRequestContext()), | 135 : url_request_context_(MakeURLRequestContext()), |
135 in_shutdown_(false), | 136 in_shutdown_(false), |
136 binding_(this) {} | 137 binding_(this) {} |
137 | 138 |
138 } // namespace content | 139 } // namespace content |
OLD | NEW |