OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/services/network/network_context.h" | 5 #include "mojo/services/network/network_context.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 161 } |
162 builder.set_http_network_session_params(params); | 162 builder.set_http_network_session_params(params); |
163 | 163 |
164 if (command_line->HasSwitch(kHostResolverRules)) { | 164 if (command_line->HasSwitch(kHostResolverRules)) { |
165 scoped_ptr<net::HostResolver> host_resolver( | 165 scoped_ptr<net::HostResolver> host_resolver( |
166 net::HostResolver::CreateDefaultResolver(nullptr)); | 166 net::HostResolver::CreateDefaultResolver(nullptr)); |
167 scoped_ptr<net::MappedHostResolver> remapped_host_resolver( | 167 scoped_ptr<net::MappedHostResolver> remapped_host_resolver( |
168 new net::MappedHostResolver(host_resolver.Pass())); | 168 new net::MappedHostResolver(host_resolver.Pass())); |
169 remapped_host_resolver->SetRulesFromString( | 169 remapped_host_resolver->SetRulesFromString( |
170 command_line->GetSwitchValueASCII(kHostResolverRules)); | 170 command_line->GetSwitchValueASCII(kHostResolverRules)); |
171 host_resolver.reset(remapped_host_resolver.release()); | 171 builder.set_host_resolver(remapped_host_resolver.Pass()); |
172 builder.set_host_resolver(host_resolver.release()); | |
173 } | 172 } |
174 | 173 |
175 builder.set_accept_language("en-us,en"); | 174 builder.set_accept_language("en-us,en"); |
176 builder.set_user_agent(mojo::common::GetUserAgent()); | 175 builder.set_user_agent(mojo::common::GetUserAgent()); |
177 builder.set_proxy_service(net::ProxyService::CreateDirect()); | 176 builder.set_proxy_service(make_scoped_ptr(net::ProxyService::CreateDirect())); |
178 builder.set_transport_security_persister_path(base_path); | 177 builder.set_transport_security_persister_path(base_path); |
179 | 178 |
180 net::URLRequestContextBuilder::HttpCacheParams cache_params; | 179 net::URLRequestContextBuilder::HttpCacheParams cache_params; |
181 #if defined(OS_ANDROID) | 180 #if defined(OS_ANDROID) |
182 // On Android, we store the cache on disk becase we can run only a single | 181 // On Android, we store the cache on disk becase we can run only a single |
183 // instance of the shell at a time. | 182 // instance of the shell at a time. |
184 cache_params.type = net::URLRequestContextBuilder::HttpCacheParams::DISK; | 183 cache_params.type = net::URLRequestContextBuilder::HttpCacheParams::DISK; |
185 cache_params.path = base_path.Append(FILE_PATH_LITERAL("Cache")); | 184 cache_params.path = base_path.Append(FILE_PATH_LITERAL("Cache")); |
186 #else | 185 #else |
187 // On desktop, we store the cache in memory so we can run many shells | 186 // On desktop, we store the cache in memory so we can run many shells |
(...skipping 15 matching lines...) Expand all Loading... |
203 delegate, | 202 delegate, |
204 base::FilePath(FILE_PATH_LITERAL("Cookies")), | 203 base::FilePath(FILE_PATH_LITERAL("Cookies")), |
205 base::MessageLoop::current()->task_runner(), | 204 base::MessageLoop::current()->task_runner(), |
206 background_task_runner, | 205 background_task_runner, |
207 false, // TODO(erg): Make RESTORED_SESSION_COOKIES configurable. | 206 false, // TODO(erg): Make RESTORED_SESSION_COOKIES configurable. |
208 nullptr); | 207 nullptr); |
209 builder.SetCookieAndChannelIdStores( | 208 builder.SetCookieAndChannelIdStores( |
210 new net::CookieMonster(cookie_store, nullptr), nullptr); | 209 new net::CookieMonster(cookie_store, nullptr), nullptr); |
211 } | 210 } |
212 | 211 |
213 return make_scoped_ptr(builder.Build()); | 212 return builder.Build().Pass(); |
214 } | 213 } |
215 | 214 |
216 } // namespace mojo | 215 } // namespace mojo |
OLD | NEW |